Running Open-Source LLMs Locally: Hands-On Tests of Quantization, VRAM, and Inference Optimization
This article explains how to estimate VRAM needs for running next-generation open-source LLMs on a PC or small server, how to balance quantization against output quality, and when local deployment makes more sense than cloud token services. It includes one set of hands-on test results, along with their limitations, and a pre-deployment checklist.
1. Who This Article Is For
This article is for developers and technical leads who want to run open-source large language models on their own computers or small servers. It does not list marketing numbers. Instead, it covers three things: how to estimate VRAM requirements, how to trade off quantization against output quality, and which scenarios suit local deployment and which suit cloud token services.
2. Estimate VRAM First, Then Choose Quantization
VRAM is the first hurdle for local deployment. After a model loads, its VRAM use comes mainly from three parts: the model weights, the KV Cache (the cache that stores the state of previous tokens), and the overhead of the inference framework itself. Weight size is proportional to parameter count and quantization bit width. For example, quantizing the same model from 16-bit to 4-bit reduces the weight size to about one quarter of the original. The KV Cache grows linearly with context length, so the longer the context, the more memory it uses. Even when the weights fit, long contexts can still exhaust VRAM.
In practice, you can make decisions in the following order:
- Determine the target context length and the number of concurrent requests.
- Estimate the weight size, and reserve VRAM for the KV Cache and runtime overhead.
- Choose a quantization bit width. A good starting point is 4-bit weights combined with an 8-bit KV Cache.
- Measure the peak VRAM usage and generation speed, then decide whether to make adjustments.
3. One Hands-On Test and Its Limitations
The author tested on a modified consumer graphics card with 22 GB of VRAM. The used price of this card is about 2,000 RMB, and prices fluctuate significantly, so check current market prices before buying. The test used a mainstream open-source inference framework with multi-token prediction enabled. The author reported the following results:
| Model | Quantization | Context | Reported Speed | Current Status |
|---|---|---|---|---|
| 27B dense model | 4-bit weights, 8-bit KV Cache | Not specified | Up to about 30 tokens/s; code generation averaged about 25–26 tokens/s | Not yet reproduced |
| 27B dense model with image understanding enabled | 4-bit weights, 8-bit KV Cache | 100k | About 23 tokens/s | VRAM usage needs to be verified |
| 35B-A3B mixture-of-experts model | 3-bit weights, 8-bit KV Cache | 256k | About 97 tokens/s | Framework and batch size need to be verified |
The limitations of these numbers are clear. The original test did not publish the complete model version, framework version, batch size, or prompt length. It also did not state how the measurement was taken, including whether only the decoding phase was counted or the prefill phase was included. These numbers only indicate the approximate range under the author’s configuration. They should not be treated as guaranteed values on your machine.
The author also reported that the 27B model performed well on agent tasks and role-play, and that its multimodal image understanding was usable. These quality judgments are subjective. No unified evaluation set was used, so readers should verify them with their own tasks.
4. Two Notable Issues with the Current Models
The first issue is overthinking. When handling complex logic puzzles or lateral-thinking riddles, the model often reaches the correct answer early but keeps re-verifying it more than ten times. The author observed that a single request for some questions consumed more than 5,000 thinking tokens. This observation comes from specific question types and has no statistical sample behind it, so it should not be generalized as typical model behavior. It does suggest that cost-sensitive applications should cap the number of thinking tokens and measure the latency of reasoning requests separately.
The second issue is repetitive generation. It is more common in smaller models, usually those with fewer than 9B parameters. A common mitigation is to increase the repetition penalty parameter. Here is a reference configuration:
inference_params:temperature: 0.7top_p: 0.8repetition_penalty: 1.15 # Reference value; adjust for the model and taskmax_tokens: 4096
Keep two points in mind when using this. First, parameter names vary by framework. vLLM typically uses repetition_penalty, while llama.cpp and Ollama commonly use repeat_penalty. Check the documentation for the framework you use. Second, an overly strong penalty can hurt normal output, for example by discouraging the model from repeating lines that code requires. Change only one parameter at a time, and compare output quality after each change.
5. Long Context: The 1M Claim Is Currently Only a Rumor
Some industry reports claim that this model series can scale to a 1M-token context, but no reliable test data supports this yet, so this article does not rely on that claim. Even when a model accepts very long inputs, the effectiveness of its attention declines with distance, and information in the middle of the input is especially easy to miss. A safer approach is to use retrieval-augmented generation (RAG) to select relevant passages first, then pass them to the model. Long context suits tasks that require understanding a whole document. For most knowledge question answering, retrieval combined with a short context usually uses less VRAM, responds faster, and makes errors easier to trace.
6. Local Deployment or Cloud Token Services
Local deployment is not always cheaper than the cloud. The answer depends on usage volume. You can make a rough monthly estimate with the following formulas:
Monthly local cost ≈ hardware depreciation + electricity + operations time costMonthly cloud cost ≈ monthly token usage × unit price
Local costs are easier to spread out for high-frequency, stable tasks with short inputs and outputs. If your monthly usage is low, or if you frequently handle very difficult tasks, a cloud service is often more economical.
Local deployment keeps data on your own machine or internal network, gives you controllable latency, and avoids pay-per-use billing. It also carries clear risks. You are responsible for data backup and access control. Driver and inference framework upgrades can cause compatibility problems. Running a graphics card at full load for long periods increases electricity costs and cooling requirements. If hardware fails, no ready-made backup resource is available.
Cloud services offer elasticity and reduced operations work. You can scale up quickly during peak demand and release resources when demand drops. Supporting services such as container platforms, object storage, and log monitoring reduce the operational burden of self-hosting. For enterprises, a hybrid deployment is often a reasonable choice. Local infrastructure handles high-frequency, low-cost inference, while the cloud handles complex tasks and data accumulation. This division of work balances cost and risk more easily than moving everything to the cloud or running everything locally.
7. Pre-Deployment Checklist
- VRAM: Estimate peak usage based on the maximum context length, and confirm it with measurements.
- Quantization compatibility: Confirm that your chosen quantization format is supported by your framework, and check whether output quality has degraded.
- Context testing: Test with real long documents rather than relying only on the theoretical maximum.
- Repetition penalty: Adjust one parameter at a time, and record the comparison results.
- Thinking limit: Set a maximum token count for reasoning requests, and track average latency.
- Quality regression testing: Fix a set of 20 to 50 real tasks, and rerun them each time you change the model or quantization method.
- Speed measurement: Record the batch size and prompt length, and report prefill and decoding speeds separately.
Conclusion
Next-generation open-source models make it possible to run mid-sized models on a single consumer graphics card. However, speed, context capacity, and output quality all depend on the specific configuration. Treat published benchmark numbers as references, estimate VRAM first, and then run regression tests on your own tasks for a more reliable result.
