How many bachelor’s degrees in Computer Science did the institution with the largest fall 2024 enrollment confer in 2023-24?
IPEDS says 1,096, at Western Governors University. To get there, you need two rows: one that says which school is largest, and one that holds its Computer Science count. A search over CSV rows found the second and missed the first. A query over a graph found both, because it never had to pick which rows to read.
This is the twelfth experiment in a series that uses one public dataset, NCES IPEDS 2024, to show how languages and models change what a knowledge graph says. Experiment 11 analyzed the graph’s structure. This one puts an LLM in front of it. The code, data and results are all on GitHub.
One thing up front: this is one model, one run and 20 questions. Read it as an illustration, not a general result.
Three ways to ask
We wrote 20 questions with known answers about the dataset’s 45 colleges, and asked each one three ways.
| Condition | What the model sees | What it returns |
|---|---|---|
| A. CSV RAG | 20 retrieved CSV rows, plus column descriptions | The answer |
| B. Text-to-SPARQL | The RDF graph’s schema and example triples | One SPARQL query |
| C. Text-to-Cypher | The property graph’s schema and an example path | One Cypher query |
All three prompts got the same dataset notes and the same column descriptions. The conditions differ in what the model works with, not in how well the data is documented.
The CSV retriever is the plain first version most teams build: one chunk per row, keyword search with BM25, no embeddings and no reranking.
The graph conditions never show the model the data. It writes a query without being able to run it, and the score is whatever that query returns when we run it.
The questions cover eight types, from single lookups to multi-hop joins. Some are traps: questions whose honest answer is “the data has no value,” and questions that are easy to answer with the wrong award level or the wrong unit.
Each of the 60 answers came from a separate, fresh Claude session that could read one prompt file and write one reply, with no other tools.
See it: every question, every answer
In the visualization below, pick any question to see the correct answer, each condition’s answer, the queries the model wrote and how many of the needed rows retrieval found.
Open the visualization in a new tab
Results: 10, 20 and 19 out of 20
| Type | CSV RAG | SPARQL | Cypher |
|---|---|---|---|
| Single lookup | 3 / 3 | 3 / 3 | 3 / 3 |
| Filter | 0 / 2 | 2 / 2 | 2 / 2 |
| Aggregate | 0 / 2 | 2 / 2 | 2 / 2 |
| Multi-hop join | 0 / 3 | 3 / 3 | 3 / 3 |
| Comparison | 1 / 2 | 2 / 2 | 2 / 2 |
| Negation / missing data | 2 / 3 | 3 / 3 | 3 / 3 |
| Unit / percent trap | 2 / 2 | 2 / 2 | 1 / 2 |
| Award-level / CIP trap | 2 / 3 | 3 / 3 | 3 / 3 |
| Total | 10 / 20 | 20 / 20 | 19 / 20 |
All three got every single-value lookup right. CSV RAG lost on the questions that need many rows: filters, counts, sums and joins.
No condition produced a wrong join, a wrong field, a misread code or an invented value.
Where CSV RAG goes wrong
Retrieval decides the score. For each question, we listed the CSV rows a correct answer depends on and recorded how many of them the search put in the prompt. CSV RAG was right on all 10 questions where retrieval found every needed row. It was wrong on all 9 where retrieval found only some or none.
| Question | Rows needed | Rows retrieved |
|---|---|---|
| Which schools are in Utah? | 3 | 2 |
| Which schools are 90% or more online? | 6 | 0 |
| How many schools have open admission? | 16 | 0 |
| Computer Science bachelor’s at the largest school | 2 | 1 |
| NYU vs. USC admit rate | 2 | 0 |
| Total doctorates at Howard | 40 | 8 |
The tenth miss asked for a sum over 2,572 program rows. No top-20 retrieval can hold that.
The model said so when it didn’t have the rows. In 9 of its 10 misses, it declined to answer and named what was missing. For the Howard question, it added up the eight doctorate rows it had, got 435, and still declined, because it could see that the research doctorates weren’t there.
That’s a better failure than a confident wrong number. It’s still a failure. On the Utah question, the model listed the two schools it was given and noted that another could be missing. One was: Western Governors University. A user asking “which schools are in Utah?” gets two of three.
Some questions only look easy. The NYU vs. USC question names both schools. The search found rows for both, but from the wrong files. It never retrieved the admissions rows that hold the rate.
Where the graph queries go wrong
One Cypher query used the wrong dialect. The model wrote toFloat(), which is a Neo4j function. Our engine, Kรนzu, casts a different way and rejected the query. The logic was correct, and the prompt named the engine. Every Cypher-family database has a slightly different function list, and the model defaulted to the most common one. The SPARQL version of the same question ran fine.
Our SPARQL prompt had a typo, and the model worked around it. After the run, we found a flaw in our own harness. The schema spelled one property kgn:cipcode. The example triples in the same prompt spelled it kgn:cipCode. The two queries that used it matched either spelling, and both scored correct. A model that trusted the example alone would have returned no rows. We left the prompts as they were run. The flaw made the SPARQL condition harder, not easier.
What this does and doesn’t show
Why the graphs win here. Most of these questions need filtering or aggregation over many rows. Top-k retrieval can’t fit those rows into a prompt, and a query never has to. Queries also execute exactly, so the arithmetic is the database’s, not the model’s.
What we didn’t test. For many teams, the fair comparison isn’t “retrieved rows vs. graph.” It’s “SQL over the full table vs. graph.” A condition that let the model write SQL against the CSVs would likely close much of this gap, because it gets the same exact execution. We didn’t run that. We also didn’t test embeddings, reranking or a larger number of retrieved rows.
Who designed the test. The same model family wrote the questions and the scoring. That could bias the result in either direction. And each question was asked once, so a rerun could move a borderline answer.
For background on the approach, see our guide to GraphRAG and how it compares with vector databases.
What this means for your content
It would be easy to read this as “graphs beat CSVs.” I don’t think that’s the lesson. The useful line is somewhere else:
Can the system compute over all of your data, or only read the few pieces it retrieved?
A few practical takeaways:
- Lookups are the easy case. If a question needs one fact that a search can find, plain retrieval was as accurate as the graph here.
- Lists, counts and comparisons are the hard case. “Which of your programs are online?” needs every program, not the top few matches. That’s where retrieval fell to zero.
- Structure is what makes computing possible. A graph with a published schema is one way to provide it. Clean, well-documented tables behind a query interface are another.
- Document your data. Every condition got the same column descriptions and notes on units and years. All three handled the unit traps and the “no value” questions correctly.
Pro tip: When you test how an LLM answers questions about your organization, include questions that need a complete list. Those are the ones most likely to come back partly right.
Simply put, an LLM can only be as complete as what it’s given to read. This fits how I think about knowledge graphs, AI search and LLMs in general: structured data is infrastructure for getting your facts repeated correctly, not a shortcut to visibility.
Run it yourself
Everything behind this post is in the Experiment 12 folder on GitHub. That includes the 20 questions, the correct answers and scoring rules, every raw model reply exactly as written, and the full results. The README explains how to rerun the answers with a different model.
Next in the series, and the last: putting the graph on a map with GeoSPARQL.
