How to Run High-Performance Open-Source LLMs on a Single 24GB GPU
A practical guide to deploying open-source LLMs on a single GPU with about 24GB of VRAM. It explains VRAM budgeting, KV cache estimation, 4-bit quantization choices, MoE suitability, task-based model selection, context and throughput control, multimodal use, and deployment practices such as load testing, monitoring, and rollback.
Introduction: What a Single 24GB GPU Can and Cannot Do
When deploying large language models privately and locally, a single consumer GPU with around 24GB of VRAM is a typical hardware baseline. It can run many high-performance open-source models, but it does not scale as freely as a multi-GPU server. Developers often ask: How large a model can 24GB of VRAM run? How should 4-bit quantization be chosen? Is MoE suitable for a single card? The answer is not a fixed model. It is a method built around VRAM budget, quantization strategy, model architecture, and load testing.
How Large a Model Can Run on 24GB of VRAM?
VRAM budget: the starting point for model selection
Large-model VRAM usage is mainly determined by three parts:
- Model weights: roughly proportional to parameter count.
- KV cache: related to context length, concurrency, number of layers, and KV head dimension.
- Runtime overhead: frameworks, kernels, temporary buffers, VRAM fragmentation, and safety margin.
Rough estimate: 4-bit weights take about “parameters in billions × 0.5GB.” For example, a 30B model uses about 15GB of weight memory, and a 24B model uses about 12GB. If KV cache and runtime overhead are added, a 30B model can approach the 24GB limit under moderate context and concurrency, so real measurement is required.
For KV cache, a rough reference is:
KV ≈ 2 × number of layers × total KV head dimension × context length × concurrency × bytes per element.
Example: assume the model has about 60 layers, a total KV head dimension of 1024, FP16 KV cache, a context length of 4096, and concurrency of 2. The KV cache is about 2GB. If the context length increases to 8192 and concurrency increases to 4, it may approach 8GB. Adding 1.5-2.5GB for framework and buffer overhead can noticeably change total usage.
| Component | Example condition | Estimated usage | Notes |
|---|---|---|---|
| Model weights | 30B, 4-bit | About 15GB | Parameter count determines it |
| KV cache | 4096 context, 2 concurrent requests | About 2GB | Affected by layers and KV heads |
| Runtime reservation | Framework and buffers | 1.5-2.5GB | Keep margin |
| Total reference | 30B model | About 18.5-19.5GB | Verify with real tests |
How should 4-bit quantization be chosen?
4-bit quantization is a mainstream choice for single-card deployment. It can significantly reduce VRAM usage and may improve decoding speed. However, different methods differ, and compressed size alone is not enough to judge. Common differences include:
- Group size: smaller groups are usually more precise but may increase computational overhead.
- Whether some layers are kept at higher precision: this can improve stability of key layers but increases usage slightly.
- Calibration dataset: calibration data should be close to the business distribution.
- Evaluation metrics: accuracy, perplexity, code/math pass rate, and business sample performance should be checked together.
It is advisable to validate with a small test set first, then run load tests. If quantization causes semantic drift, format errors, or incorrect key fields, roll back to higher precision or try another method. Quantization and load testing should be done in an isolated environment to avoid directly affecting production services.
Is MoE Suitable for a Single GPU?
Mixture-of-Experts (MoE) models split parameters into multiple experts, and each token activates only part of them. For example, a model with 30B total parameters and about 3B active parameters still needs about 15GB of weight VRAM, but the computational activation is close to that of a small model. Therefore, the value of MoE on a single GPU is: use total parameters for broader knowledge, and use low activation for inference speed.
However, actual throughput is not determined by active parameters alone. It is also affected by expert routing, weight reading, batching strategy, VRAM bandwidth, and framework implementation. MoE is not necessarily faster, especially under high concurrency, long context, or significant routing overhead. First-token latency and token generation speed must be tested.
Model Selection: Balancing Capability, Size, and Scenario
For a 24GB single GPU, model selection can follow “scenario → model category → budget → validation metrics”:
| Task scenario | Recommended model category | VRAM budget reference | Latency and throughput focus | Multimodal switch | Validation metrics |
|---|---|---|---|---|---|
| General question answering | 14B-32B dense or low-active MoE | About 10-18GB under 4-bit | First-token latency, token generation speed | Can be disabled | Accuracy, fluency |
| Code assistance | Models with strong code capability | 12-20GB | Long-context stability | Usually disabled | Code pass rate |
| Math reasoning | Reasoning-enhanced models or MoE | 14-20GB | Long outputs, higher latency | Disabled | GSM8K, MATH, etc. |
| Multimodal understanding | Vision-language models | Higher, requires extra margin | Image preprocessing latency | Must be enabled | Image question answering accuracy |
| Structured extraction | Small/medium models + templates | 8-16GB | High concurrency, low latency | Disabled | Field accuracy |
When selecting, first define the main task, then choose the model category, and finally validate with real business corpus. Do not treat a model as a fixed answer. Treat it as a replaceable component so that you can switch between quality, speed, and cost.
Context and Throughput: Two Easily Overlooked Variables
The longer the context, the larger the KV cache, and the lower the concurrency that can be supported. On a single GPU, blindly enabling very long context can quickly approach the VRAM limit after only a few requests. Recommendations:
- Set an upper limit on context length according to business needs, and do not enable the maximum length by default.
- Use session history trimming, summary compression, or sliding windows.
- Set a concurrency limit and prepare queuing or degradation strategies.
For throughput, offline batch processing can appropriately increase batch size to improve throughput. Online services should control batch size and concurrency, prioritizing first-token latency. It is recommended to record first-token latency, token generation speed, error rate, peak VRAM usage, and timeout fallback conditions.
Multimodal: Is It Worth Enabling on a Single GPU?
Multimodal models can handle image and text understanding, but they usually add a visual encoder, high-resolution image preprocessing, and extra VRAM overhead. If the core scenario is text-only, first ensure the text model’s context, throughput, and stability. If image understanding is truly needed, reserve more VRAM and limit image resolution and batch size. A “text first, vision later” degradation scheme can be used: prioritize text requests, and rate-limit or asynchronously process image requests.
Deployment Practice: From Loading to Stable Operation
Recommended steps:
- Load validation: choose a mature inference framework, load the quantized model, and verify VRAM usage.
- Load testing checklist: record first-token latency, token generation speed, error rate, peak VRAM, and concurrency capacity.
- Monitoring and alerting: set thresholds for VRAM, latency, and error rate, and alert on anomalies.
- Elastic scaling: if peak usage exceeds the local single GPU, expand as needed using general infrastructure such as public cloud GPU instances, container platforms, and object storage. This is a general engineering example and does not constitute a specific product recommendation.
For production, quantized models should undergo canary validation before rollout. If VRAM overflow, rising error rates, or service anomalies occur, roll back to a smaller model, lower context length, or lower concurrency to avoid resource waste and service interruption.
Conclusion
A single GPU with about 24GB of VRAM can run capable, high-performance open-source large models. The key is to define boundaries with VRAM budgeting, control usage with 4-bit quantization, balance capability and speed with MoE or better architectures, and then perform load testing and selection around the task scenario. With this method, you can achieve a more stable, verifiable, and maintainable deployment plan on limited hardware.
