WhoBuilt

GraphRAG methods to create optimized LLM context windows for Retrieval

Jun 27, 2025· 15 min· 4.0K views·Watch on YouTube

Speaker

Jonathan Larson, who leads the Graph team at Microsoft Research, presents at AI Engineer on using GraphRAG to give LLMs structured context for code understanding, evaluation, and agent tasks.

GraphRAG for repository understanding

Larson compares regular RAG with GraphRAG on a small, previously unseen game codebase of about 200 lines across seven files. Regular RAG gives a generic description, while GraphRAG identifies the player, moving obstacles, background, and keyboard controls. He also shows GraphRAG translating the Python game into Rust that runs, while a direct LLM translation fails to compile.

Using graphs to modify Doom

Larson applies the approach to the 100,000-line Doom codebase, spread across 231 files. GraphRAG generates documentation at both repository and module level, and supports questions about the code. In a demonstration, GitHub Copilot coding agent uses GraphRAG for Code to plan and implement a player jump feature across multiple files, which Larson says worked out of the box.

QED for evaluating RAG

Larson announces Benchmark QED as open source, with three components: AutoQ generates questions for a dataset, AutoE uses an LLM judge to evaluate results, and AutoD summarizes and samples datasets. AutoQ covers local and global questions, as well as data-driven and persona or activity-driven questions. AutoE reports a composite score using comprehensiveness, diversity, empowerment, and relevance.

LazyGraphRAG results and applications

On the reported benchmarks, LazyGraphRAG beats vector RAG 92%, 90%, and 91% of the time on data-local questions against 8K, 120K, and one-million-token context windows, respectively. Larson says the longer context window made little difference, and LazyGraphRAG cost one-tenth as much as the million-token configuration in their test. He says LazyGraphRAG is being incorporated into Azure Local and Microsoft Discovery.

Takeaways

  • Use repository structure to help agents plan changes that span multiple files.
  • Test code assistants on unfamiliar projects; model familiarity with a codebase may not include its specifics.
  • Evaluate retrieval across local and global questions, including questions grounded in activities or personas.
  • Compare retrieval quality and cost across context window sizes instead of assuming a longer window helps.
  • Use structured LLM memory as a foundation for applications that need broad codebase understanding.

Mentioned in this talk

Search inside this talk

What was claimed 12

  • works at
    Senior Principal Data Architect, Special Projects; leads the GraphRAG team
    “I run the Graph team at Microsoft Research.”
    YouTube
    Verified2 sources· Talk, Web· archived
  • built
    “our Graphite paper ... inspired many other offerings.”
    YouTube
    Verified2 sources· Talk, Web· archived
  • feature
    GraphRAG: Supports local and global queries over repositories
    “It requires understanding the whole repository to answer correctly.”
    YouTube
    Unverified1 source· Talk
  • feature
    GraphRAG: Helps translate a Python game codebase into working Rust files
    “we had a full video game translated from Python and working natively in Rust.”
    YouTube
    Unverified1 source· Talk
  • feature
    coding agents: Created a holistic plan and implemented Doom jumping across multiple files
    “It changed a lot of files and worked out of the box.”
    YouTube
    Unverified1 source· Talk
  • uses
    open source
    “The QED benchmark is available now as open source on GitHub.”
    YouTube
    Unverified1 source· Talk
  • feature
    QED benchmark: Includes AutoQ for query generation, AutoE for evaluation, and AutoD for dataset summarization and sampling
    “There are three components to this.”
    YouTube
    Unverified1 source· Talk
  • metric
    LazyGraphRAG: Won 92% of data-local comparisons against 8K context, 90% against 120K, and 91% against one-million-token context
    “It wins 92%, 90%, and 91% of the time.”
    YouTube
    Unverified1 source· Talk
Show all 12 facts

Related talks