IntermediateEnglish19 lectures · 2h 8m

GraphRAG in Production

Real documents, production indexing and cost, LLM-judge evaluation, provenance and a GraphRAG agent

Watch 3 lectures free

01

What changes after this course

  • ●Instead of shipping GraphRAG because the demo looked good, you justify or reject it with cost and quality measured against a vector baseline
  • ●Instead of trusting what the LLM extracted, you judge the extraction and own the evaluation of the graph
  • ●Instead of an agent whose answers you cannot check, you build one whose answers trace back to a source

02

Why it matters now

A demo on a tutorial corpus does not tell you whether to ship GraphRAG. On real congressional documents in this course, the vector baseline outscored both graph retrievals on simple factual questions at a thirtieth of the cost. Knowing when the graph earns its cost and when it does not is the decision this course teaches, with numbers you can rerun.

03

What you leave with

  • ✓Five notebooks: data preparation, indexing, evaluation, multi-source graphs and an agent
  • ✓A public-domain corpus you may redistribute and build on commercially
  • ✓An evaluation pipeline and a token diet that cut the corpus by a quarter

04

Skills you'll build

  • →Clean real PDF and HTML documents and cut their tokens before indexing
  • →Run a production-size index and read its wall time, token use and dollar cost
  • →Judge extraction with an LLM, compare answer quality against a vector baseline, and trace answers to their sources

Inside the course

Screens from the lectures. The notebooks on screen are the ones you download, run on public US congressional documents. Microsoft GraphRAG and the OpenAI API are third-party tools, and this course is independent of them.

Table estimating chunks, extraction calls, communities and USD for four combinations of chunk size and max gleanings

notebooks/1a_data_preparation.ipynb

Estimate the bill before you index

Before any indexing, the notebook estimates calls and cost for four settings. Chunk 600 with 1 gleaning means 424 extraction calls and 0.39 USD; chunk 1200 with no gleaning means 97 calls and 0.15 USD.

Lecture 1.2 · cleaning token diet cost estimate

Cost table by indexing stage with call counts and USD, and the total of 0.57 USD for the first uncached run

notebooks/1b_production_indexing.ipynb

The real index bill, stage by stage

The first uncached run took 15.3 min and cost 0.57 USD for 109,233 corpus tokens. Graph extraction and community reports take most of it, 0.259 and 0.238 USD.

Lecture 1.3 · project settings prompt tune indexing run

Network plot titled Congressional AI corpus: 60 highest-degree entities, with nodes coloured by type such as bill, committee, agency and person

notebooks/1b_production_indexing.ipynb

The graph built from congressional documents

The 60 most connected entities in the finished index, coloured by type: bills, laws, committees, agencies, organisations, people, programs and topics.

Lecture 1.4 · inspect results graph plot local search

Three plots: degree distribution on log-log axes, sizes of 11 connected components, and community size by Leiden level L0 to L4

notebooks/2_evaluation_pipeline.ipynb

Check the graph before you check the answers

The evaluation starts with the graph itself: a heavy-tailed degree distribution, 11 connected components with the largest holding 1122 nodes, and the spread of community sizes at each Leiden level.

Lecture 2.1 · graph structure metrics and the meter

Table of faithfulness, completeness, relevance, overall, citations, latency and USD for vector, local and global search on two question types, with wins per question

notebooks/2_evaluation_pipeline.ipynb

Three search methods, scored side by side

On local-type questions vector search scores 4.83 overall at 0.0005 USD, and global search 3.86 at 0.0169 USD. On global-type questions global search scores 5.00 but takes 43.88 s. Wins per question are counted under the table.

Lecture 2.3 · answer judging dashboard and tuning

Comparison of a floor-statements-only index with a floor, bills and reports index: node and community counts, entities by type, degree distribution and indexing cost

notebooks/3_multi_source_graphrag.ipynb

What adding bills and reports does to the graph

Indexing floor statements together with bills and reports gives 579 nodes instead of 191 and 118 communities instead of 44, for 0.28 USD instead of 0.09 USD.

Lecture 3.3 · tracing answers cross source and single vs multi

Agent run asking who introduced the CREATE AI Act: one local_search call, then a final answer with a source citation

notebooks/4_graphrag_agent.ipynb

The agent picks local search for an entity question

Asked who introduced the CREATE AI Act, the agent makes one local_search call, gets 2539 chars back in 5.7s, and writes an answer that keeps the source citation.

Lecture 4.2 · the agent loop tool choice and multi turn

Bar chart of tool calls across 8 test questions and a heatmap of question shape against the tool chosen, with mean cost and latency

notebooks/4_graphrag_agent.ipynb

Which tool the agent chose, by question shape

Across the 8 test questions the agent called local_search 7 times, global_search 2 and lookup_source 4. Theme questions went to global search, composite ones mixed local search and source lookup. A run cost 0.0068 USD on average, with 17.2s mean latency.

Lecture 4.3 · behaviour analysis router comparison and course finale

What you'll learn

  • ✓Prepare real PDF and HTML documents for indexing: parsing pitfalls, cleaning, and a token diet that cuts cost
  • ✓Run a production-size GraphRAG index and read its wall time, token usage and dollar cost
  • ✓Evaluate a knowledge graph: structure metrics, LLM-judged extraction quality, and answer quality against a vector baseline
  • ✓Build a multi-source graph and trace an answer back to its source document and type
  • ✓Build a GraphRAG agent with function calling and compare it with a simple router
  • ✓Decide, with numbers, when GraphRAG is worth its cost and when it is not

About this course

A tutorial corpus never taught anyone what production feels like. This course runs GraphRAG on real public documents — US congressional records, bills and committee reports about artificial intelligence legislation, all public domain — and answers the question that decides whether you ship it: is this graph actually any good?

Session 1 is the document work nobody demos: downloading from govinfo, parsing PDFs and HTML, headers and reprinted text, a token diet that cut our corpus by a quarter, and a cost estimate before you spend anything. Then a production index, with settings, entity types and prompt tuning, and its real wall time and bill. Session 2 evaluates it: graph-structure metrics, entity-extraction quality judged by an LLM against the source text, automatically generated evaluation questions, and answer quality for local search, global search and a plain vector baseline. Session 3 builds multi-source graphs with provenance so an answer can be traced back to the source type it came from. Session 4 puts a function-calling agent in front of the graph and compares it with a simple router.

Every number in the course comes from a run you can repeat — including the uncomfortable one: on simple factual questions the vector baseline outscored both graph retrievals at a thirtieth of the cost. That is taught as the first decision rule, not hidden.

**Licensing.** The corpus is deliberately unencumbered: Congressional Record extracts, House bills and committee reports from govinfo.gov are works of the United States Government and carry no copyright under 17 U.S.C. § 105, so you may redistribute, train on and build commercially on `data/congress/` freely. `Resources/LICENSES.md` records this and covers Microsoft GraphRAG (MIT) and the optional local Ollama models.

Curriculum5 sections · 19 lectures · 2h 8m

Section 0. Welcome

Free preview

Section 1. Real Documents and Production Indexing

Free preview

Section 2. Evaluation Pipeline

  • 🔒section 2 intro0:06
  • 🔒graph structure metrics and the meter8:36
  • 🔒llm judge question generation three answerers8:30
  • 🔒answer judging dashboard and tuning8:30

Section 3. Multi-source GraphRAG

  • 🔒section 3 intro0:06
  • 🔒three source types and existing provenance7:48
  • 🔒csv metadata indexing and source tracking8:18
  • 🔒tracing answers cross source and single vs multi8:30

Section 4. GraphRAG Agent

  • 🔒section 4 intro0:06
  • 🔒function calling and three graphrag tools7:48
  • 🔒the agent loop tool choice and multi turn8:06
  • 🔒behaviour analysis router comparison and course finale8:18

Requirements

  • · A computer with Python 3.10+ (a free Google Colab account is enough for most sessions)
  • · Comfort reading Python code; you do not need to be an expert
  • · GraphRAG basics: indexing, local and global search (our course GraphRAG Hands-On: Knowledge Graphs for RAG, or equivalent)
  • · An OpenAI API key; the whole course costs a couple of dollars in gpt-4o-mini calls

Who this is for

  • · Engineers taking a GraphRAG prototype towards production
  • · Teams that must justify retrieval cost with measurements
  • · Data engineers dealing with messy PDF and HTML corpora
  • · Anyone building agents on top of a knowledge graph

Read alongside the course

    The voice-over in this course is synthesized with a text-to-speech model from scripts written and reviewed by the instructor, and the on-screen material (notebooks, code, slides) is the instructor's own work.

    GraphRAG in Production | SOTAAZ Blog