[Paper Review] Reducing hallucination in structured outputs via Retrieval-Augmented Generation
The paper applies retrieval-augmented generation (RAG) to a structured output task (natural language to workflows in JSON) to reduce hallucination and enable deployment with smaller LLMs and a tiny retriever. It shows RAG substantially lowers hallucinated steps and tables and supports out-of-domain generalization.
A common and fundamental limitation of Generative AI (GenAI) is its propensity to hallucinate. While large language models (LLM) have taken the world by storm, without eliminating or at least reducing hallucinations, real-world GenAI systems may face challenges in user adoption. In the process of deploying an enterprise application that produces workflows based on natural language requirements, we devised a system leveraging Retrieval Augmented Generation (RAG) to greatly improve the quality of the structured output that represents such workflows. Thanks to our implementation of RAG, our proposed system significantly reduces hallucinations in the output and improves the generalization of our LLM in out-of-domain settings. In addition, we show that using a small, well-trained retriever encoder can reduce the size of the accompanying LLM, thereby making deployments of LLM-based systems less resource-intensive.
Motivation & Objective
- Demonstrate that RAG can reduce hallucination in structured output generation (natural language to workflow JSON).
- Show that a small, well-trained retriever with a modest LLM can achieve competitive performance.
- Illustrate deployment benefits, including reduced model size and modular architecture for enterprise use.
Proposed method
- Train a domain-specific retriever encoder to map natural language to existing workflow steps and database tables.
- Build a FAISS index of steps and tables and use cosine similarity to retrieve top candidates.
- Fine-tune a small encoder and LLM separately (LoRA) in a RAG setup where the retriever output is prepended to the LLM prompt.
- Use contrastive loss to train the retriever with positive and negative pairs (including BM25/ANCE negatives).
- Evaluate with Trigger Exact Match, Bag of Steps, and Hallucination metrics on in-domain and out-of-domain splits.
Experimental results
Research questions
- RQ1Does retrieval-augmented generation reduce hallucinations in generating structured workflow JSON?
- RQ2Can a small retriever plus a modest LLM match or exceed larger models without retrieval in this task?
- RQ3How well does the RAG approach generalize to out-of-domain deployments (OOD data) without retraining?
- RQ4What is the impact of different negative sampling strategies on retriever performance?
- RQ5What are practical deployment considerations (latency, scalability) for a production system using RAG?
Key findings
- RAG reduces hallucinated steps to below 7.5% and hallucinated tables to below 4.5% on the Human Eval split with StarCoderBase variants.
- Without a retriever, hallucination can reach about 21% for steps and tables, indicating a strong benefit from retrieval.
- A 7B parameter RAG model offers the best trade-off between performance and compute, with marginal gains over larger models while enabling deployment.
- Fine-tuning the smallest encoder (110M) is insufficient; however, all-mpnet-base-v2 with proper fine-tuning achieves strong recall in retrieval (Recall@15 for steps up to 0.743 and Recall@10 for tables up to 0.766).
- RAG-equipped StarCoderBase-7B matches or surpasses several larger LLMs in Trigger EM and Bag of Steps while maintaining lower hallucination.
- OOD evaluation shows average performance with retriever comparable to in-domain results, indicating good generalization without retraining.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.