Running a 1B parameter model on a phone used to be a battery-draining science experiment. Llama 3.2 1B changed that. It fits in 2GB RAM, tokenizes fast on Neural Engine or GPU, and costs zero dollars per inference. But the base model hallucinates on your private docs. Fine-tuning fixes that, and the economics are brutal: 80% cloud cost reduction when you move RAG to the edge.
Why On-Device RAG Now
Cloud RAG architectures bleed money three ways: embedding API calls, LLM API calls, and egress bandwidth for context windows. A typical enterprise chatbot serving 10k daily users spends $12k-18k monthly on inference alone. On-device shifts compute to hardware users already own. No API keys, no latency variance, no data leaving the device. Privacy compliance becomes a feature, not a retrofit.
The Fine-Tuning Pipeline
We used LoRA rank 16 with 4-bit QLoRA quantization. Training data: 50k synthetic QA pairs generated from internal PDFs using GPT-4o-mini, filtered for factual consistency. Hardware: 2x A100 40GB, 3 hours, $42 cloud compute. The adapter weighs 32MB. Merged model stays under 1.3GB quantized to 4-bit GGUF.
Benchmark Results
| Metric | Base 1B | Fine-tuned 1B | GPT-4o-mini |
|---|---|---|---|
| RAGAS Faithfulness | 0.61 | 0.87 | 0.91 |
| RAGAS Answer Relevancy | 0.58 | 0.84 | 0.89 |
| Latency (iPhone 15 Pro) | 1.2s | 1.3s | N/A |
| Monthly Cost/10k Users | $14,200 | $2,840 | $18,600 |
Deployment Reality Check
App bundle size increases by 1.1GB. First launch compiles Metal shaders — add a splash screen. Memory pressure kills background apps on 6GB devices; implement model offloading to disk. Update cycle: retrain adapters weekly, push via OTA without App Store review. We use MLC-LLM for iOS, llama.cpp for Android. Both support speculative decoding for 2x throughput.
"The model doesn't need to know everything. It needs to know your everything.
— Edge ML Lead, Duolingo
Cost Breakdown at Scale
| Component | Cloud RAG | On-Device RAG |
|---|---|---|
| Embedding API | $3,200/mo | $0 |
| LLM API | $9,800/mo | $0 |
| Bandwidth | $1,200/mo | $0 |
| Adapter Training | $0 | $42/mo |
| Client Distribution | $0 | $2,800/mo (CDN) |
Next Steps
Clone the repo. Swap your PDFs into data/raw. Run python generate_synthetic.py then python train_lora.py. Export GGUF. Drop into your iOS/Android build. Monitor faithfulness drift weekly; retrain when it drops below 0.82. Your cloud bill drops next invoice cycle.










