# Open-Source LLM Capabilities: Local Deployment Selection and Hands-On Practice
Open-weight models have become capable enough to handle a full conversation, a structured extraction, or a round of tool calls on your own hardware. This article looks at the capabilities that are now must-haves rather than nice-to-haves, including native function calling, long context, and multimodal input. It then covers the licensing questions to settle before commercial use and a formula-based way to size memory, accounting for weights, KV cache, and runtime overhead. You'll also find quantization trade-offs, a guide to mixture-of-experts (MoE) models, the steps for deploying an OpenAI-compatible local service, practical performance-tuning tips, and ways to combine local and cloud models. The article closes with common pitfalls and a checklist for evaluating models on your own data.
Why more teams are considering running models locally
Open-weight models keep getting stronger, and that has turned “hold a full conversation, run a structured extraction, or complete a round of tool calls on your own hardware” from an experiment into a real engineering option. For developers and enterprise users, local inference mainly pays off in three ways:
- Clearer data boundaries. Sensitive data never has to leave the local environment to take part in inference. The data path is shorter, the exposure surface is smaller, and meeting data-minimization requirements is easier.
- A different cost structure. Pay-per-use API pricing grows linearly with request volume. Local inference shifts the cost forward to hardware, and for internal workloads with steady traffic the marginal cost per request approaches zero.
- More control and better availability. Weights stay fixed on your own machine, model versions can be pinned, and behavior is reproducible. You are not at the mercy of network conditions or service quotas, which makes local inference a good fit for weak-network, edge, or air-gapped settings.
The trade-offs are just as real: hardware investment, ongoing maintenance and upgrades, and a ceiling on quality. So the more pragmatic positioning is a division of labor. Local models take high-frequency, privacy-sensitive, error-tolerant work, while complex reasoning goes to larger cloud models, with the two working together.
1. Choosing a model: which capabilities are now table stakes
Before an open-weight model can enter a production workflow, check whether it has the following.
Native function calling
Function calling, also known as tool calling, lets a model pick tools from a set of JSON Schema declarations, generate structured arguments, and have an external program execute the call and feed the result back. The model then uses that result to compose its final answer. In practice, three things matter:
- Is argument extraction stable, including for nested objects and enum values?
- Is tool selection accurate when several tools are available?
- Can the model recover on its own when a tool returns an error?
Native support is not mandatory. You can use prompting to constrain the model’s output to JSON and parse it yourself, but stability and multi-turn behavior usually suffer.
{"model": "local-assistant","messages": [{ "role": "system", "content": "You can call tools to fulfill the user's request." },{ "role": "user", "content": "Check the weather in Shanghai for tomorrow" }],"tools": [{"type": "function","function": {"name": "get_weather","description": "Query the weather for a given city on a given day","parameters": {"type": "object","properties": {"city": { "type": "string", "description": "City name" },"date": { "type": "string", "description": "Date in YYYY-MM-DD format" }},"required": ["city", "date"]}}}],"tool_choice": "auto"}
Tool definitions take up a lot of context. The more tools you attach, the longer the prompt and the slower the inference, so trim the available tool list to what each use case needs.
Long context
A 100K-token context window means a whole technical manual, a full day of work logs, or the core files of a repository can go in at once. A context window is a ceiling, not a free resource:
- The key/value (KV) cache grows linearly with context length.
- Attention computation grows quadratically with sequence length.
In practice, key information sitting in the middle of a long context is more likely to be overlooked. For long documents, chunk the input and reorder it, and put important instructions and material at the beginning and end.
Context length should also match the model’s advertised capability. Filling the window to the brim does not guarantee gains and can degrade output quality if you exceed the effective length seen during training.
Multimodal input
Some open-weight models accept images, audio, and other inputs. That suits tasks like receipt and invoice recognition, a first-pass assessment of equipment photos, and transcription plus summarization of meeting recordings. Two things to watch when integrating:
- Images are encoded into a large number of visual tokens, so input size and VRAM usage climb noticeably.
- Streaming audio input creates real-time pressure.
Evaluate recognition accuracy on real business samples, not parameter counts alone.
2. Licensing: confirm before you ship
A model’s weight license and its code license are usually separate, so confirm both. Permissive licenses such as Apache-2.0 allow commercial use, modification, and redistribution. Keeping the original copyright and license notices and noting any changes you made to files generally covers the main obligations. Models under such licenses lower the barrier considerably for small teams and enterprises.
But “open source” and “open weights” are not the same thing. Some models use a custom license with additional terms. Common restrictions include:
- Limits on use in specific business domains;
- An additional acceptable use policy;
- An obligation to notify the licensor before large-scale commercial use;
- Rules for naming the model and its derivatives.
Before productization, have your legal and security teams review the model card, the license text, and any additional terms line by line. Make it explicit who is responsible for:
- The accuracy of model outputs;
- Compliance during use;
- Notification obligations when redistributing.
3. Hardware: turn “is memory enough” into arithmetic
The most common deployment mistake is installing a model right at the resource limit, which leads to constant paging or out-of-memory errors. Estimate your needs as follows.
Estimation formulas
- Weight footprint ≈ parameter count × bytes per parameter. At 4-bit quantization, that is roughly 0.5 bytes per parameter, so about 3.5 GB for a 7B model and about 7 GB for a 14B model.
- KV cache ≈ 2 × layers × KV heads × head dimension × context tokens × bytes per element. Grouped-query attention (GQA) lets multiple query heads share a group of key/value heads, and the factor of 2 accounts for K and V.
- Recommended memory ≥ weight footprint + KV cache for your target context + runtime overhead. Allow an extra 15–25% headroom on top.
def estimate_gb(params_b: float, bits: int = 4, layers: int = 32,kv_heads: int = 8, head_dim: int = 128,ctx_tokens: int = 32768, kv_bytes: int = 2,overhead_ratio: float = 0.2) -> dict:weights = params_b * 1e9 * bits / 8 / 1024**3kv_cache = (2 * layers * kv_heads * head_dim * ctx_tokens * kv_bytes) / 1024**3total = (weights + kv_cache) * (1 + overhead_ratio)return {"weights_gb": round(weights, 1),"kv_cache_gb": round(kv_cache, 1),"recommended_gb": round(total, 1)}# Example: ~7B params, 32 layers, 8 KV heads, head dimension 128, 32K contextprint(estimate_gb(params_b=7))# {'weights_gb': 3.3, 'kv_cache_gb': 2.0, 'recommended_gb': 6.4}
These parameters are only an example. Read layer counts, KV head counts, and other structural details from the model card, and account for the extra KV cache that concurrent requests add.
Quantization is not a free lunch
- Precision levels: Quantization shrinks weights. 8-bit usually costs very little accuracy, and 4-bit is acceptable on most general tasks, but math, long-chain reasoning, and similar workloads can degrade noticeably. Compare precision levels on your business evaluation set before deploying.
- Device compatibility: Quantization formats (GPTQ, AWQ, GGUF, and others) vary in how well they work with different inference frameworks. Confirm that your target engine supports the format you need.
- The KV cache can be quantized too: Quantizing the KV cache reduces memory use further in long-context scenarios.
Mixture of Experts (MoE): speed follows active parameters, memory follows total parameters
MoE models split the feed-forward layers into several expert networks, and each token activates only a few of them. As a result, their speed is typically close to that of a dense model with a comparable number of active parameters, while memory usage is determined by the total parameter count.
Take a model with roughly 30B total parameters and about 4B active per token. After 4-bit quantization, its weights come to around 15–18 GB. Its inference speed is close to that of a 4B dense model, but its memory demand is close to that of a 30B dense model. The upside is better quality, provided you have enough memory to hold all the expert weights.
A rough memory-to-model guide
| Available memory | Roughly supportable at 4-bit | Typical scenarios |
|---|---|---|
| 4 GB | Small models with 2–3B parameters, with context best kept to a few thousand tokens | Simple on-device Q&A, text classification |
| 8 GB | 6–8B parameters | Everyday chat and light writing on a personal laptop |
| 16–20 GB | 10–30B parameters (architecture-dependent) | Code assistance, long-document summarization |
| 32 GB and up | 30–70B parameters (quantization-dependent) | Complex reasoning, multi-tool agents, several concurrent streams |
Treat these numbers as a rough reference, and rely on the estimation formulas and your own benchmarks.
4. From model weights to a callable service
Step 1: Inventory your resources and pick an inference runtime
Look beyond total memory. Also check usable headroom, whether you have a discrete GPU and how much VRAM it has, and whether the processor supports the instruction sets you need. On edge devices, factor in power draw and cooling as well.
An inference runtime usually handles model download, inference scheduling, and an HTTP server. Mainstream runtimes have good support across GPU and accelerator types. Some also ship dedicated backends for Apple devices with a unified memory architecture so they can make use of the CPU, GPU, and neural engine together.
Step 2: Pull the model and start the service
Verify the environment with a small model first, then download the real one. That way you don’t discover runtime errors only after a download that can range from a few GB to tens of GB. Pin the model version with a checksum or version number so your team and your environments stay reproducible. Most runtimes pick a quantization format automatically, but you can also specify one manually.
Step 3: Connect it to your application and watch it run
Most inference frameworks provide a local HTTP server with an OpenAI-compatible API. Business code only needs to point its API base URL at the local endpoint and can otherwise stay unchanged. That makes switching between a local and a cloud model nearly free. A rough sketch:
from openai import OpenAIclient = OpenAI(base_url="http://localhost:8000/v1", api_key="local")stream = client.chat.completions.create(model="local-assistant",messages=[{"role": "user", "content": "Summarize the following meeting notes in three sentences..."}],tools=tools, # Tool definitions, see abovestream=True,)for chunk in stream:delta = chunk.choices[0].deltaif delta.content:print(delta.content, end="", flush=True)
Things worth watching during calls:
- The CPU/GPU split across layers;
- VRAM and memory usage;
- Time to first token and output tokens per second.
On devices with a unified memory architecture, the model can usually load entirely into memory with the GPU doing the compute. The more the split favors the GPU, the higher the throughput generally is.
When you expose the service, always configure authentication, transport-layer encryption, rate limiting, and logging of inputs and outputs. Never expose the inference port directly to the public internet.
5. Tuning: faster and leaner local inference
- Quantization: Start with 4-bit and move to 8-bit or higher precision only if quality falls short.
- Context management: Assemble context on demand through summarization and retrieval instead of stuffing the whole window at once.
- Batching and concurrency: Engines with continuous batching merge multiple requests into one computation, which significantly lifts GPU utilization.
- Prefix caching: System prompts, tool definitions, and knowledge-base snippets often repeat across requests, and prefix caching lets you reuse that computation.
- Layer offloading: When VRAM is short, offload some compute layers to system memory. Speed drops, but you gain a bigger model or a longer context.
- Sampling parameters: Use a low temperature for structured output and tool calls, and set sensible stop conditions to cut wasted generation.
6. Local-first, cloud-on-demand
Local inference is not meant to replace cloud services. The two divide the work:
- Task routing: Dispatch requests to a local or cloud model based on data sensitivity, task complexity, and latency requirements.
- Asynchronous pipelines: Batch jobs such as document processing can be buffered with a message queue to smooth out traffic spikes, with inference-service consumers processing them at a steady rate.
- Unified observability: Logs, monitoring alerts, and metric tracking give you a view of how local devices and cloud services are each running.
On Baidu AI Cloud, cloud inference services can run on cloud servers or elastic container platforms. Model weights, fine-tuning data, and evaluation datasets are kept in object storage, and unified alerting is handled through cloud monitoring. This keeps the privacy and cost advantages of local inference while adding elastic compute for traffic spikes or heavier tasks.
7. Common mistakes and how to evaluate
- “It loads” is not “it works.” Successful loading only means you have enough resources. Quality has to be verified on your own business data.
- Leaderboard scores are not business performance. Public benchmarks are a reference point, but your task distribution differs. Build a small evaluation set with typical cases, boundary cases, and adversarial samples, and track task success rate, structured-output parse rate, tool-call argument accuracy, and latency percentiles.
- “Local” is not zero cost. Include hardware depreciation, electricity, and operations labor in the calculation, and compare the total against pay-as-you-go cloud pricing.
- Mind the hardware. Local inference quality is also limited by memory bandwidth, so peak compute alone doesn’t tell the whole story.
Conclusion
Running models on your own hardware is essentially about balancing privacy, cost, latency, and quality. In practice, one rule of thumb is a good starting point:
| Available memory | Suggested starting point |
|---|---|
| 4 GB | Run the smallest models for simple Q&A |
| 6–8 GB | Run models with a few billion parameters for everyday chat and light writing |
| 16–20 GB | Run models in the 10B–100B+ range for code assistance and long-document summarization |
| 32 GB and up | Run models with tens of billions of parameters for complex reasoning and multi-tool agents |
Confirm that the license allows your intended use, estimate memory with the formulas and leave headroom, pick a suitable quantization precision, connect through a compatible API, and validate quality on your own evaluation set. Follow that process, and open-source LLMs go from a “it runs” demo to a genuinely reliable productivity tool.
