Beyond Code Snippets: Benchmarking LLMs on Repository-Level Question Answering
This paper introduces StackRepoQA, the first repository-level question answering dataset derived from 1,318 real developer questions across 134 Java projects, and uses it to demonstrate that while retrieval-augmented methods improve LLM performance, current models still struggle with genuine repository-scale comprehension, often relying on memorized Stack Overflow answers rather than true reasoning.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are trying to fix a massive, 100-year-old library. You don't just need to know how to read a single book; you need to understand how Book A in the History section connects to a map in the Geography section, which then links to a diary in the Biography wing.
This is the challenge of Repository-Level Question Answering. It's about asking a computer to understand an entire software project (a "repository") rather than just a tiny snippet of code.
Here is a breakdown of the paper "Beyond Code Snippets" using simple analogies.
1. The Problem: The "Single-Page" Trap
Most current AI models (Large Language Models or LLMs) are like brilliant students who only study flashcards. They are amazing at answering questions about a single sentence or a short paragraph of code.
But real-world software is like a giant, interconnected city. To fix a traffic light, you might need to know about the power grid, the city planning laws, and the traffic sensors.
- The Issue: When developers ask AI questions about their whole project, the AI often gets lost because it's used to looking at just one "flashcard" (a single file) instead of the whole "city map."
2. The New Tool: StackRepoQA
The researchers built a new testing ground called StackRepoQA.
- The Analogy: Imagine they took 1,318 real questions that developers asked on a giant forum (Stack Overflow) and matched them to the actual "blueprints" (GitHub repositories) of 134 different software projects.
- Why it matters: Before this, we only tested AI on isolated puzzles. Now, we are testing them on the real, messy, multi-file projects they will actually face in the real world.
3. The Experiment: Memory vs. Reasoning
The researchers asked two questions:
- Can the AI answer these questions on its own?
- Does giving the AI a "search tool" (Retrieval-Augmented Generation or RAG) help?
They tested two main strategies for the "search tool":
- File-Level Search (The "Keyword" Search): Like searching a library by typing a word into a catalog. It finds books with that word, but maybe not the right chapter.
- Graph-Based Search (The "Map" Search): Like having a librarian who understands the structure of the library. They know that "Chapter 3" depends on "Chapter 1," even if the words are different. This is Graph RAG.
4. The Big Surprise: The "Cheat Sheet" Effect
Here is the most shocking finding: The AI was mostly cheating.
When the AI answered questions without any help, it got a decent score (around 6 out of 10). But when the researchers asked: "Hey, don't use your memory. Only look at the files we just gave you," the AI's score plummeted.
- The Metaphor: It turns out the AI had memorized the answers to these specific questions because they were in its training data (like a student who memorized the answer key to a practice test). It wasn't actually "thinking" or "reasoning" through the code; it was just reciting what it had seen before.
- The Proof: When they tested questions that were asked after the AI was trained (new questions), the AI got much worse. This proved that its earlier success was just memorization, not true understanding.
5. The Solution: The "Architect" vs. The "Librarian"
When they forced the AI to rely on the "search tools":
- The "Keyword" Search (File-RAG): Helped a little bit. It was like giving the AI a stack of random pages. It found some relevant info but got distracted by noise.
- The "Map" Search (Graph-RAG): This was the winner. By understanding the structure (how classes connect, who calls whom), the AI performed significantly better.
- Analogy: If you ask a human, "How do I fix the engine?" and they just read a manual page about "oil," they might miss the point. But if they have a diagram showing how the oil pump connects to the engine block, they can actually solve the problem. The Graph RAG provided that diagram.
6. The Takeaway for the Real World
The paper concludes with a warning and a hope:
- The Warning: We cannot just trust AI to fix our software projects right now. If the AI hasn't seen the project before, or if the project is private (not on the internet), the AI might hallucinate or give outdated advice. It's currently too reliant on "cheat sheets" (memorized data) rather than genuine reasoning.
- The Hope: If we give AI the right tools—specifically structural maps (Graph RAG) that show how code pieces fit together—it can get much better at understanding complex systems.
In a nutshell:
Current AI is like a student who aces the practice test by memorizing answers but fails the real exam when the questions are slightly different. To make AI a reliable engineer, we need to stop testing it on flashcards and start giving it blueprints and maps so it can learn to actually think about how the whole system works.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.