3B–14B Open-Source LLMs: Selection and Deployment on a Single GPU
A practical guide to evaluating and deploying 3B, 7B, and 14B open-source models on a single GPU with 12–24 GB of VRAM. Learn how to set task-specific acceptance thresholds, estimate memory requirements, compare quantization formats, run a local evaluation script, and manage deployment risks and rollback.
1. Scope and Limitations
Strong model capabilities were once widely associated with large parameter counts and multi-GPU clusters. Over the past year or two, open-source models in the 3B–14B range have made substantial progress in reasoning, coding, and tool calling. They can run on a single GPU, keep data on the local machine, and make per-request inference costs easier to predict.
Comparable capabilities do not make a model a drop-in replacement for an existing solution. Before choosing one, answer three questions: Which tasks can it handle adequately? Is the deployment cost acceptable? How serious are the consequences of failure?
This guide applies only to:
- Hardware: A single consumer or professional GPU with 12–24 GB of VRAM.
- Models: Parameter sizes of 3B, 7B, and 14B.
- Deployment: Single-machine inference services, without multi-GPU tensor parallelism or multi-node clusters.
The memory estimates and thresholds below should not be applied directly outside these boundaries.
2. Four-Dimensional Evaluation: Define Tasks Before Thresholds
2.1 Can an Aggregate Benchmark Score Determine Model Selection?
No. An aggregate score combines results from multiple public benchmarks using weighted averages. It is useful for initial screening, not final selection.
Common benchmarks include MMLU, C-Eval, HumanEval, GSM8K, and the Berkeley Function Calling Leaderboard. Their weights are chosen by the evaluator and may not reflect your workload.
Before evaluating candidates, record the benchmark names, versions, sampling methods, and evaluation date. Make the final decision using samples from your own use cases.
2.2 Calibrating Acceptance Thresholds
| Dimension | Samples and sources | Initial threshold | Cost of an incorrect assessment | Controls |
|---|---|---|---|---|
| General capability | 50 samples from public benchmarks plus 50 internal samples | At least 80% accuracy on internal samples | Selecting a model that does not fit the workload | Prioritize internal samples; use public benchmarks only as a reference |
| Agent tasks | 100 cases from a custom tool-calling test set | At least 95% argument-format accuracy and 80% task completion | Incorrect calls may trigger real business operations | Require human approval before write operations and validate tool arguments against allowlists |
| Knowledge accuracy | 200 samples from the business knowledge base | At least 90% accuracy on critical facts; abstain when uncertain | Hallucinated conclusions that appear credible | Route high-risk conclusions to human review and require supporting sources |
| Multimodal understanding | 100 images from the target workload | At least 90% recognition accuracy for key fields | Text-only models cannot process image inputs | Confirm image support first; otherwise skip this dimension or choose another model |
These thresholds are starting points. Raise them when errors could directly cause financial loss or compliance problems. If a human reviewer can catch errors, lower thresholds may be acceptable in exchange for lower deployment costs.
Sample size determines how much confidence to place in the results. A normal approximation gives a rough 95% confidence interval with a half-width of:
1.96 × √(p(1 − p) / n)
With 50 samples and 80% accuracy, the half-width is approximately 11 percentage points, giving an estimated interval of 69%–91%. This can distinguish clearly weaker models, but not models with similar performance.
With 200 samples and 90% accuracy, the half-width is approximately four percentage points. If two models’ intervals overlap substantially, do not treat the results as clear evidence that one is better.
3. Estimating VRAM and Comparing Quantization Formats
GPU memory consumption has three main components:
VRAM ≈ model weights + KV cache + framework and CUDA runtime overhead
Weight memory can be estimated as:
Weight memory ≈ parameter count × bytes per parameter
FP16 uses two bytes per parameter, INT8 uses one byte, and INT4 uses approximately half a byte. Quantized formats also include metadata such as scaling factors, so actual memory usage is slightly higher than the theoretical estimate.
KV cache memory can be estimated as:
KV cache memory ≈ 2 × number of layers × number of KV heads× head dimension × context length × batch size× bytes per element
The number of layers, KV heads, and head dimension can be found in the model directory’s config.json. Longer contexts and larger batches increase KV cache usage. Long-text workloads are particularly likely to exhaust VRAM here.
The following table provides rough weight-only estimates in decimal GB. It excludes the KV cache and framework overhead. “Headroom” means the memory remaining after loading the weights, which must accommodate those additional components.
| Model size | Precision | Estimated weight memory | 12 GB GPU | 24 GB GPU |
|---|---|---|---|---|
| 3B | FP16 | About 6 GB | Weights fit; about 6 GB headroom | Weights fit; ample headroom |
| 3B | INT8 | About 3 GB | Weights fit | Weights fit |
| 3B | INT4 | About 1.5 GB | Weights fit | Weights fit |
| 7B | FP16 | About 14 GB | Weights do not fit | Weights fit; about 10 GB headroom |
| 7B | INT8 | About 7 GB | Weights fit; about 5 GB headroom | Weights fit |
| 7B | INT4 | About 3.5 GB | Weights fit | Weights fit |
| 14B | FP16 | About 28 GB | Weights do not fit | Weights do not fit |
| 14B | INT8 | About 14 GB | Weights do not fit | Weights fit; about 10 GB headroom |
| 14B | INT4 | About 7 GB | Weights fit; about 5 GB headroom | Weights fit |
Use these figures only to narrow the candidate list. Measure actual memory consumption before deployment.
For each measurement, record:
- GPU model and driver version.
- Inference framework and version.
- Quantization method and source.
- Context length.
- Batch size and concurrency.
Sample GPU memory usage with:
nvidia-smi --query-gpu=name,memory.used,memory.total --format=csv -l 1
Compare quantization formats using the same workload samples. Evaluate both FP16 and the target quantized version. If the accuracy loss exceeds the acceptable tolerance for an evaluation dimension, do not use that quantized version.
This guide does not provide throughput or per-request inference cost figures because they depend heavily on hardware, framework, and concurrency. Before launch, load-test candidates under the same workload and record generated tokens per second and time to first token.
4. Local Evaluation Script and Execution Steps
4.1 Prepare the Environment
The inference service must expose an OpenAI-compatible API, such as one provided by vLLM or llama.cpp server. Once the service is running, the script uses this endpoint by default:
http://127.0.0.1:8000/v1/chat/completions
The script requires only the Python standard library and runs on Python 3.8 or later.
python -m venv .venvsource .venv/bin/activate # On Windows, use .venv\Scripts\activate
4.2 Input Format
Store test cases in a JSONL file, with one case per line:
{"id":"q001","prompt":"What is the main difference between lists and tuples in Python?","expected":"mutable","rule":"contains"}
The supported matching rules are:
contains: The output containsexpected.exact: The output matchesexpectedexactly after leading and trailing whitespace is removed.
The default rule is contains.
4.3 Evaluation Script
Save the following code as eval.py. Set MODEL to the model name loaded by the server.
import csvimport jsonimport sysimport timeimport urllib.requestENDPOINT = "http://127.0.0.1:8000/v1/chat/completions"MODEL = "your-model-name"TIMEOUT = 120def ask(prompt):body = json.dumps({"model": MODEL,"messages": [{"role": "user", "content": prompt}],"temperature": 0,"max_tokens": 256,}).encode("utf-8")req = urllib.request.Request(ENDPOINT, data=body, headers={"Content-Type": "application/json"})with urllib.request.urlopen(req, timeout=TIMEOUT) as resp:data = json.load(resp)return data["choices"][0]["message"]["content"]def judge(output, expected, rule):if rule == "exact":return output.strip() == expected.strip()if rule == "contains":return expected.strip() in outputraise ValueError(f"unknown rule: {rule}")def main():if len(sys.argv) != 4:print("Usage: python eval.py cases.jsonl result.csv 0.80", file=sys.stderr)return 2cases_path, out_path = sys.argv[1], sys.argv[2]threshold = float(sys.argv[3])try:with open(cases_path, encoding="utf-8") as f:cases = [json.loads(line) for line in f if line.strip()]except (OSError, json.JSONDecodeError) as e:print(f"Failed to read test cases: {e}", file=sys.stderr)return 2passed = 0rows = []for case in cases:rule = case.get("rule", "contains")start = time.time()try:output = ask(case["prompt"])except OSError as e:print(f"Inference endpoint unreachable or request timed out: {e}",file=sys.stderr)return 3latency = time.time() - startok = judge(output, case["expected"], rule)passed += int(ok)rows.append([case["id"], rule, int(ok), round(latency, 2), output[:200]])with open(out_path, "w", encoding="utf-8", newline="") as f:writer = csv.writer(f)writer.writerow(["id", "rule", "passed", "latency_s", "output_head"])writer.writerows(rows)rate = passed / len(cases) if cases else 0.0print(f"Samples={len(cases)} Passed={passed} Accuracy={rate:.2%} "f"Threshold={threshold:.2%}")return 0 if rate >= threshold else 1if __name__ == "__main__":sys.exit(main())
4.4 Run the Evaluation and Interpret Exit Codes
python eval.py cases.jsonl result.csv 0.80
The third argument specifies the required pass rate. The result file contains each sample’s ID, matching rule, pass/fail result, elapsed time, and the first 200 characters of the output.
Exit codes are defined as follows:
| Exit code | Meaning |
|---|---|
0 |
Accuracy meets or exceeds the threshold |
1 |
Accuracy is below the threshold |
2 |
Invalid arguments or a problem with the sample file |
3 |
The inference endpoint is unreachable or the request times out |
4.5 Data Handling and Compliance
- Follow the original dataset licenses when using public benchmark samples. Do not copy them directly into public-facing documents.
- De-identify business samples before storing them. Replace phone numbers, government-issued ID numbers, customer names, and similar information with placeholders.
- Store
result.csvin an access-controlled directory. Do not upload complete model outputs to logging platforms.
5. Troubleshooting and Pre-Deployment Risk Checks
5.1 Common Problems and Diagnostic Steps
- Out of memory (OOM): First reduce context length and
max_tokens, then reduce concurrency and batch size. If memory is still insufficient, use a lower-precision version or a smaller model. - Tokenizer or chat-template mismatch: Compare the
chat_templatein the localtokenizer_config.jsonwith the template actually used by the server. A mismatch can substantially reduce output quality for the same question. Align the templates and rerun the evaluation. - Accuracy loss after quantization: Compare FP16 and quantized versions using the same samples. Do not deploy a version whose accuracy loss exceeds the acceptable tolerance.
- Invalid tool-call format: Parse model outputs as JSON and validate them against a schema. Count invalid outputs as failures and do not execute them. One retry may be allowed, but retry outcomes must be included in the statistics rather than retaining only the successful attempt.
- VRAM fragmentation: If memory usage keeps rising during long-running operation, a PyTorch backend can use
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True. Periodically restart the service and perform health checks.
5.2 Pre-Deployment Risk Checklist
| Risk | Check | Control |
|---|---|---|
| Incorrect tool calls trigger real business operations | Do all write operations require human approval? | Require approval before writes and validate tool arguments against allowlists |
| Hallucinated outputs appear credible | Do high-risk conclusions include supporting sources? | Route high-risk conclusions to human review; abstain when sources are unavailable |
| Quality declines after deployment | Does the production input distribution match the evaluation samples? | Continue sampled evaluations in production and update the test set regularly |
| Rollback fails | Are the previous model and configuration retained? | Keep the previous model files and configuration; make switching possible through a single change |
| Data leakage | Do logs or result files contain sensitive information? | De-identify logs and restrict access to result files |
5.3 Rollback and Human Approval
Before deployment, retain the previous model and service configuration. Roll back if accuracy declines, requests time out, or output formats become invalid.
After switching back, rerun the same evaluation samples to confirm that the metrics have recovered. Automated actions involving deletion, sending, deployment, or permission changes must receive human approval before execution.
The figures in this guide are starting points for model selection, not guarantees that any model will work for your workload. Validate candidates against your own samples before deployment, and record the sample size and consequences of failure behind each conclusion.
