RAGAL: A Frugal, Fully Local Retrieval-Augmented Assistant for Technical Support at a Government Agency
Summary
RAGAL, a retrieval-augmented assistant, was developed for AFIR, the Romanian Agency for Financing Rural Investments, to support its technical team under stringent conditions: zero data egress, a read-only mandate, and a single 8 GB consumer laptop for all development. Operating on a Romanian corpus of approximately 25,000 document chunks, including 15,073 resolved support tickets, the project found that optimizing retrieval engineering and embedder fine-tuning yielded the most significant improvements. Hybrid dense-sparse retrieval with intent routing boosted internal evaluation from 62% to 81%. Fine-tuning the bge-m3 embedder on real ticket data enhanced recall@10 from 0.663 to 0.850 and MRR from 0.489 to 0.684 within 72 minutes. The project also identified that single-domain fine-tuning could degrade performance on other domains, a problem addressed using locally generated queries (GenQ). PII masking improved generation quality, and an "anchor distillation" scheme prevented SQL hallucination. A 744B-parameter model running on CPU served as an offline evaluation judge. Sanitized pipeline scripts are available.
Key takeaway
For AI Engineers building RAG systems with strict data locality and limited hardware, prioritize retrieval engineering and embedder fine-tuning. Your efforts on hybrid retrieval and domain-specific embedder fine-tuning can significantly boost performance, as shown by the 62% to 81% evaluation increase. Be sure to implement per-domain evaluation sets to catch silent performance degradation. Consider PII masking and "anchor distillation" to enhance generation quality and prevent hallucinations, even on a single 8 GB machine.
Key insights
Frugal, local RAG for sensitive data prioritizes retrieval engineering and embedder fine-tuning over larger generators.
Principles
- Data locality constraints necessitate fully local LLM solutions.
- Retrieval optimization often outweighs generator size.
- Evaluate retrieval per-domain to detect degradation.
Method
Developed a hybrid dense-sparse retrieval system with intent routing, fine-tuned bge-m3 embedder on real data, and used locally generated queries (GenQ) for domain-specific evaluation.
In practice
- Fine-tune embedders on real data for domain adaptation.
- Implement PII masking to improve generation quality.
- Use "anchor distillation" to prevent SQL hallucination.
Topics
- Retrieval-Augmented Generation
- Data Locality
- Embedder Fine-tuning
- Hybrid Retrieval
- Low-Resource AI
- PII Masking
Best for: AI Architect, NLP Engineer, CTO, AI Engineer, Machine Learning Engineer, MLOps Engineer
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by Takara TLDR - Daily AI Papers.