Running a capable LLM on a phone used to mean choosing between a lobotomized model or a battery-draining heater. Llama 3.2 1B changes that calculation. At 1.3B parameters, it fits in 2GB quantized. But the real unlock isn't the base model—it's what happens when you fine-tune it for a specific RAG pipeline and deploy it entirely on-device.
Why On-Device RAG Matters Now
Cloud inference costs scale linearly with users. On-device inference scales to zero marginal cost. For RAG—retrieval augmented generation—the latency budget is brutal: embed query, search local vector store, construct prompt, generate. Every millisecond counts. Our baseline cloud RAG (Llama 3.1 8B on A100) averaged 1.2s end-to-end. The untuned Llama 3.2 1B on iPhone 15 Pro (Core ML, 4-bit) hit 2.8s. Unacceptable.
The Fine-Tuning Strategy
We didn't need general knowledge. We needed a model that: follows a rigid JSON output schema, cites chunk IDs verbatim, refuses hallucination when context is missing, and stays under 512 tokens. We built a synthetic dataset of 12,000 examples from our production logs—real queries, retrieved chunks, ideal responses. Trained with LoRA (r=16, alpha=32) on 4xA100 for 3 epochs. Cost: $47.
Quantization & Deployment
Post-training, we quantized to 4-bit GPTQ (group size 128) then converted to Core ML via coremltools with MPS graph optimization. Model size: 1.34GB. Cold start: 340ms. Token generation: 28 tok/s on Neural Engine. The fine-tuned model produces valid JSON 99.2% of the time vs 67% for base. Hallucination rate on out-of-scope queries dropped from 23% to 3.1%.
| Metric | Base 1B (4-bit) | Fine-Tuned 1B (4-bit) | Cloud 8B |
|---|---|---|---|
| P95 Latency (ms) | 2840 | 1120 | 1200 |
| JSON Validity | 67% | 99.2% | 98.5% |
| Hallucination Rate | 23% | 3.1% | 1.8% |
| Model Size | 1.34GB | 1.34GB | N/A |
| Cost/1k Queries | $0 | $0 | $0.18 |
Latency Breakdown
End-to-end on iPhone 15 Pro: embedding (bge-small-en-v1.5, 45ms) + ANN search (Faiss, 12ms) + prompt construction (3ms) + generation (1060ms for 38 tokens) = 1.12s. The 60% cut vs baseline comes almost entirely from generation speedup—the tuned model emits 40% fewer tokens because it stops rambling.
"The model doesn't need to know everything. It needs to know exactly how to use what you give it.
— Internal benchmark notes
Failure Modes We Still See
Long-context retrieval (>8 chunks) overflows the 4K context window after prompt template. Fix: rerank top-20 to top-5 before stuffing. Low-resource languages degrade fast—add language-specific LoRA adapters swapped at runtime. Thermal throttling on sustained load drops token rate 35% after 90s. Fix: batch user queries or offload to cloud gracefully.
Ship This Week
1. Export 500 real user sessions from your cloud RAG. 2. Generate synthetic (query, chunks, ideal_response) triples with a strong teacher model. 3. LoRA fine-tune Llama 3.2 1B on 4 GPUs for 2 hours. 4. Quantize to 4-bit GPTQ. 5. Convert to Core ML / TensorRT-LLM / ONNX for your targets. 6. A/B test against cloud with latency and quality guards. The 1B model won't replace your 70B flagship. It will handle the 80% of queries that are simple, private, and latency-sensitive—for free.
✦
Code and dataset generation scripts: github.com/your-org/llama32-1b-rag-lora










