TL;DR
Researchers at the University of São Paulo (USP) developed a Retrieval-Augmented Generation (RAG) system to help students and staff navigate the university’s complex bureaucratic framework. Their study reveals that while RAG significantly boosts LLM accuracy (from 13% to 54% when the right info is found), the "retrieval" step remains a major bottleneck, especially when users don't use the exact phrasing found in official documents.
What Problem Does This Paper Address?
Large Language Models (LLMs) are impressive, but they suffer from two major flaws in institutional settings: they hallucinate and they lack access to private or frequently updated data. For a massive institution like USP—with nearly 100,000 students and a labyrinth of "normative documents" (statutes, ordinances, and resolutions)—a standard ChatGPT-style model isn't enough.
The authors address the challenge of building a reliable virtual assistant that can answer specific questions about university regulations. They specifically look at how different "moving parts" of a RAG system—like how you chop up documents (chunking) and which models you use to find those chunks (retrieval)—impact the final answer's quality.
Methods
The authors employed a Modular RAG architecture, which separates the process into two distinct stages:
- Retrieval: When a user asks a question, the system searches a database of 866 USP documents. They tested several "embedding" models (Sentence-BERT variants like MiniLM and Mpnet) that turn text into math vectors to find semantic matches. They also used BM25, a classic keyword-based search algorithm, as a baseline.
- Generation: Once the most relevant text "chunks" are found, they are fed into an LLM along with the original question. The authors tested both proprietary models (GPT-3.5-turbo) and open-source ones (Llama-3, Mixtral, and the Portuguese-specialized Sabia-2).
A key technical detail was their chunking strategy: they tested sizes of 2K, 4K, and 8K characters, using a 1:10 overlap ratio to ensure that important information wasn't accidentally cut in half at the edge of a chunk.
Datasets
The study utilized two primary data components:
- The Corpus: 866 normative documents collected from USP’s website (Jan 2023 – May 2024).
- The QA Dataset: 592 question-answer pairs generated using GPT-4.
- Version 1 (Original): Questions that often shared vocabulary with the source text.
- Version 2 (Paraphrased): A more difficult set where GPT-4 reformulated the questions to be as linguistically different from the source as possible. This is a crucial benchmark because real users rarely quote legal documents verbatim.
Key Insights and Ideas
- The "Lexical Advantage" of BM25: Surprisingly, the keyword-based BM25 outperformed fancy neural embedding models on the "original" questions. This happened because the questions used the same words as the documents. However, when questions were paraphrased, the neural models (specifically Mpnet) started to close the gap, proving that semantic search is more robust for real-world, natural language queries.
- Retrieval is the Weak Link: The "Top-5" accuracy for the best retriever on paraphrased questions was only 30%. This means that 70% of the time, the correct information wasn't even in the top five results sent to the LLM.
- The Context Jump: The most striking finding was the performance delta. Without any context, the LLM scored 13.68%. With the correct context manually provided, accuracy soared to 54.02%. This confirms that the LLM's "reasoning" is decent, but its "searching" is struggling.
- Chunk Size Matters: Smaller chunks (2K) generally led to better retrieval performance. Larger chunks likely "dilute" the specific answer, making it harder for embedding models to represent the core meaning accurately.
Key Results
- Best Retriever: BM25 was the strongest overall, but Mpnet was the most effective neural model for 2K chunks.
- Best Generator: GPT-3.5-turbo consistently outperformed Llama-3, Mixtral, and Sabia-2 across F1-score and LLM-based evaluations.
- Overall System Performance: The most effective end-to-end configuration achieved a score of 22.04% against ground truth answers. While this sounds low, it highlights the extreme difficulty of providing precise, legally-grounded answers compared to general conversation.
Limitations and Future Work
The authors identify several hurdles for the next generation of institutional assistants:
- Portuguese Language Support: There is a relative scarcity of high-performing embedding models specifically optimized for Portuguese compared to English.
- Multi-hop Reasoning: The current system struggles with questions that require linking information across two different documents (e.g., "How does Resolution A affect the rules in Statute B?").
- Human-in-the-loop: The study relied heavily on GPT-4 for evaluation. The authors note that future work needs systematic evaluation by university staff to ensure the "ground truth" is actually correct in a bureaucratic sense.
- Scaling the Database: The current system only looks at university-wide norms; expanding to specific departments or institutes will significantly increase the "noise" the retriever must filter through.
Summary updated