Running Strong Open-Source LLMs on a Single 24GB GPU: Model Choice and Deployment
A practical guide to fitting capable open-source LLMs on one 24GB GPU: VRAM budgeting, Q4 quantization, dense vs MoE trade-offs, coding and OCR model picks, and inference-stack choices.
With open-source models improving quickly, a single 24GB consumer GPU is a common setup for individual developers and small teams. VRAM is the hard constraint: parameter count, precision, quantization, and the inference stack all decide whether a model runs, how fast it is, and how well it performs. This article focuses on picking the strongest model that actually fits in 24GB, covering hardware limits, architecture trade-offs, quantization, scenario-based selection, and deployment practice.
Start with the VRAM budget: what 24GB can hold
The first step is not picking a model; it is estimating memory. Skipping this is a common source of failed deployments.
How inference memory breaks down
Runtime VRAM is mainly three parts:
- Weights: the largest share. A rough formula is parameter count × bytes per parameter. A 30B model is about 60GB in BF16, about 30GB in INT8, and about 15–18GB in 4-bit.
- KV cache: grows with context length and concurrency. At 32K tokens and above it can take several GB or more; leave headroom.
- Activations and framework overhead: CUDA context, the runtime, and temporary tensors. Reserve about 1–2GB.
Conclusion: 30B-class models in BF16 or INT8 exceed 24GB. The realistic option is 4-bit quantization. That is why Q4 is the default for single-GPU 30B-class serving: it often lands around 18–20GB, leaving room for KV cache and overhead.
Precision trade-offs
Quantization is not free:
- BF16: full quality, roughly double the memory; not viable on one 24GB card.
- Q8/FP8: very small quality loss, but ~30GB for 30B; still over the limit.
- Q4 (typical grouped 4-bit formats): some quality drop, usually acceptable for most tasks; the practical sweet spot for 30B on 24GB.
- Q3/Q2: smaller, but quality loss becomes obvious; avoid except in extreme cases.
In practice, prefer well-tested balanced formats such as Q4_K_M.
Dense vs MoE
At similar total size, dense vs mixture-of-experts is the main architecture choice for single-GPU serving.
How they differ
- Dense: every token uses all parameters. A 31B dense model computes all 31B weights per forward pass. Compute per token is high; quality is often more consistent.
- MoE: large total parameter count, but only a subset of experts is active per token. Names like “30B-A3B” mean ~30B total and ~3B active per token. With similar VRAM, inference can be several times faster than a dense model of similar class.
How to choose
Same-generation dense models (e.g. ~31B) often score slightly above MoE models (e.g. ~26B class). The gap is usually small. MoE’s speed advantage is large, especially for:
- Agent loops, where latency compounds
- Long-document waits
- Higher concurrent throughput on the same GPU
For most single-GPU users, prefer MoE. A small quality gap is usually worth much faster responses, especially for coding agents that call the model often.
Scenario-based picks: coding and OCR
Coding: Agent capability is a hard requirement
Coding models are now usable in production. Chat-style completion from prompts only covers basics. Useful models need Agent workflows: function calling, multi-step planning, and repo-scale context.
Evaluate:
- Tool-calling reliability: stable structured calls and retry behavior
- Code quality: completeness in common languages and project-context understanding
- Context length: agents often inject large code contexts
- Quality after quantization: some models degrade more; measure it
Under 24GB, notable options include:
- Lightweight coding MoE (Q4, ~18–19GB): coding-oriented, mature tool calling; a strong pick for coding agents
- General MoE (Q4, ~18GB): balanced; some support multimodality if you need more than code
- Recent ~27B general models (Q4): solid overall, often without a dedicated coding variant; better for general use
Do not rely only on leaderboards. Run a small benchmark on real coding tasks from your workflow.
OCR: small models can be enough
OCR often fits a single GPU or even CPU. The field has moved toward very small models:
- ~1B OCR specialists: about 2–3GB in FP16, roughly one second per page, usable on CPU, with complete pipelines. Some attach a separate layout model for more flexibility.
- Multi-billion-parameter OCR models: layout built in, slightly higher accuracy, slower.
For high-throughput OCR, prefer production engines such as vLLM or SGLang over lightweight local runners. Match the stack to the load: interactive chat can use a simple runner; batch production should use a high-throughput engine.
Deployment notes
Inference stacks
Three common local paths:
- Lightweight local runners: one-click start and easy model management; slower support for new architectures and weaker throughput
- vLLM / SGLang: continuous batching, PagedAttention, high throughput; preferred for eval and batch serving
- Check support first: new models land in frameworks at different times. Confirm your version supports the architecture (especially MoE and new attention).
Checklist
1. VRAM budget: Q4 model size + KV cache + ~2GB spare ≤ 24GB2. Framework support: target architecture is implemented in your engine version3. Long-context stress test: run max expected context and watch peak VRAM4. Tool calling: test function calling on a real Agent workflow5. Speed baseline: record tokens/s for later tuning
Cloud as an alternative
Teams that do not want to run local GPUs can use cloud GPU instances and model hosting. For example, Baidu AI Cloud offers GPU VMs and a model platform for common open-source models, with object storage for weights and monitoring for uptime. You can validate a design in the cloud, then decide whether to self-host. Cloud-first, local later reduces trial-and-error cost. Do not assume any given cloud product is available in every region.
Summary
On a single 24GB GPU, three things matter: budget VRAM, pick the architecture, match the scenario.
- 30B-class is the current ceiling on 24GB and needs Q4
- Prefer MoE at similar class: trade a small quality gap for much higher speed
- Coding: prioritize Agent tool calling; OCR: tiny models plus a high-throughput engine
- Match the engine to the load: light runners for chat, vLLM/SGLang for production batches
Open models change every few months. A reusable eval and deploy process lasts longer than chasing any single “best” checkpoint.
