Running Open-Source LLMs on Your Own Hardware

When it makes sense to run open-source language models on your own machines, how much memory you need, what quantisation does and which tools to use for serving.

Hosted AI APIs are the quickest way to add language model features to a product, but they are not right for every situation. Some businesses cannot send customer documents to an outside provider, some find that per-token bills grow faster than expected, and some need AI that works on a factory floor or in a clinic with unreliable internet.

Open-weight language models, which you can download and run yourself, offer an alternative. The catch is hardware: choose too small a machine and the model will not load or will crawl; choose too large and you have spent money on idle GPUs. This article explains when self-hosting makes sense, how to estimate memory needs, what quantisation does and which software to use.

Why run models yourself

There are three common reasons to self-host:

  • Privacy and data control: prompts and documents never leave your servers. This can simplify obligations under India's DPDP Act, 2023 and contractual commitments to clients, although your own security practices still matter.
  • Cost control: for steady, high-volume workloads such as classifying thousands of documents a day, a fixed hardware cost can be more predictable than per-token pricing.
  • Offline and low-latency use: a model on a local server keeps working when the internet link does not, and avoids round trips to distant data centres.

The trade-offs are real. The largest hosted models are generally more capable than what most businesses can run locally, you take on maintenance, updates and security, and GPU hardware is expensive to buy and power. Always check each model's licence for commercial-use terms before deploying it.

Model size and memory: the basic arithmetic

A model's size is described by its number of parameters, such as 7 billion (7B) or 70 billion (70B). To run it, the weights must fit in memory: GPU VRAM for fast inference, or system RAM when running on the CPU.

A useful rule of thumb is:

Memory for weights ≈ parameters × bytes per parameter

  • At 16-bit precision (FP16 or BF16), each parameter takes 2 bytes, so a 7B model needs about 14 GB just for weights.
  • At 8-bit, about 1 byte per parameter: roughly 7 GB for a 7B model.
  • At 4-bit, about half a byte per parameter: roughly 3.5 to 4.5 GB for a 7B model, depending on the format.

On top of the weights you need memory for the KV cache, which grows with context length and the number of simultaneous requests, plus some overhead for the runtime. Long documents and many concurrent users can need several extra gigabytes.

Quantisation: trading a little quality for a lot of memory

Quantisation stores model weights at lower precision, for example 4 or 8 bits instead of 16. This cuts memory use and often speeds up inference, because less data moves between memory and the processor.

The cost is some loss of quality. In general, 8-bit quantisation is close to the original, and well-made 4-bit versions remain usable for many business tasks such as summarisation, extraction and classification. Very aggressive quantisation (3-bit or lower) tends to degrade noticeably. A larger model at 4-bit often outperforms a smaller model at full precision for the same memory, but the only reliable answer is to test on your own data.

Common formats include GGUF (used by llama.cpp and tools built on it) and GPU-oriented formats such as AWQ and GPTQ, which serving engines like vLLM can load.

The tools: llama.cpp, Ollama and vLLM

Three widely used open-source projects cover most needs, and they play different roles:

  • llama.cpp is a C/C++ inference engine that runs quantised models efficiently on CPUs, consumer GPUs and Apple Silicon. It uses the GGUF format and includes a simple HTTP server. It is the foundation for many other tools.
  • Ollama wraps local model running in a convenient package: it downloads models, manages them and exposes a local HTTP API, including an OpenAI-compatible endpoint. It is an easy starting point for development machines and small internal deployments.
  • vLLM is a high-throughput serving engine for GPUs, designed to handle many concurrent requests efficiently through techniques such as continuous batching and efficient KV cache management. It also offers an OpenAI-compatible server and suits production workloads with multiple users.

A practical path is to prototype with Ollama, measure quality and speed, then move to vLLM on a GPU server if you need to serve many users at once.

Serving the model behind an API

Your applications should not talk to the model runtime directly from the internet. Run the model server on a private network or localhost, and put your own API or a reverse proxy in front that handles authentication, rate limiting and logging. Because Ollama and vLLM both offer OpenAI-compatible endpoints, application code written for a hosted API can often switch to a local model by changing the base URL.

For example, after pulling a model with Ollama, an internal service can call its chat API like this (replace MODEL_NAME with the model you pulled):

curl http://localhost:11434/api/chat -d '{
  "model": "MODEL_NAME",
  "messages": [{"role": "user", "content": "Summarise this GST invoice in two lines."}],
  "stream": false
}'

Ollama listens only on localhost by default. If you expose it to other machines, place it behind a reverse proxy with authentication and firewall rules; never leave a model server open to the public internet.

Hardware sizing: rough guidance

The table below is approximate and meant only as a starting point for planning. Actual requirements depend on the model architecture, quantisation format, context length, number of concurrent users and the runtime you choose. Test before buying.

Model size (approx.)Typical useMemory at 4-bit (approx.)Example setup (approx.)
1B–4BSimple classification, extraction, offline assistants1–3 GBModern CPU with 16 GB RAM, or a small GPU
7B–9BChat, summarisation, internal Q&A4–6 GB plus KV cacheGPU with 8–12 GB VRAM, or Apple Silicon with 16 GB or more
13B–14BBetter reasoning and writing quality8–10 GB plus KV cacheGPU with 16 GB or more VRAM
30B–34BStronger general-purpose assistant18–22 GB plus KV cacheGPU with 24 GB or more VRAM, or two smaller GPUs
70BClose to larger hosted models for many tasksAbout 40 GB plus KV cacheMultiple GPUs or a data-centre GPU with large VRAM

A few further points to plan for:

  • CPU-only inference works for small models and low traffic but is much slower than GPU inference.
  • Power and cooling matter for GPU servers in an office; consider a colocation facility or a GPU cloud instance in an Indian region as alternatives.
  • Storage: keep fast SSD space for model files, which range from a few to tens of gigabytes each.
  • Start with a pilot: rent a GPU server for a few weeks, measure real throughput, then decide whether to buy.

How NextWebGen can help

NextWebGen is a software company, so we focus on the parts around the hardware: setting up Linux servers, deploying model runtimes such as Ollama or vLLM, securing them behind an authenticated API and connecting them to your web, mobile or ERP applications. If you are considering self-hosted AI, see our server management services to discuss sizing, deployment and ongoing maintenance.