The problem nobody talks about
Here's a scenario that plays out in every multinational compliance team: your company runs an ecommerce platform that operates in both the EU and Singapore. You've built AI-powered product recommendations, personalized pricing, and automated customer service — and now you need to figure out whether any of it is compliant with both jurisdictions. So you pull up the EU AI Act (180+ pages) and Singapore's Model AI Governance Framework (about 50 pages), and you start reading.
Live Demo for the article and code is here https://vishalmysore.github.io/graphraggovernance/
Within an hour, you're lost in a maze of cross-references. The EU calls it a "high-risk AI system." Singapore calls it a "high risk AI decision." Are those the same thing? Close, but not exactly. The EU requires a "conformity assessment." Singapore suggests "testing and validation." Same idea? Overlapping, but the EU's version is legally binding and the Singapore one is voluntary guidance.
This is the kind of problem where you'd normally reach for RAG — Retrieval-Augmented Generation. Chunk up both documents, embed them, and ask questions. But here's where things get interesting, because traditional RAG genuinely struggles with this class of problem.
What traditional RAG does well (and where it falls apart)
Traditional RAG is brilliant for single-document Q&A. "What are the penalties under the EU AI Act?" — chunk retrieval finds the relevant section, the LLM summarizes it, done. Fast, accurate, useful.
But regulatory comparison isn't single-document Q&A. You're not asking "what does document A say?" — you're asking "how does concept X in document A relate to concept Y in document B, and where do they disagree?" That's a fundamentally different kind of question.
Here's why traditional RAG struggles:
1. Chunks destroy relationships.
When you chunk a document into 500-token segments, you lose the structural relationships between concepts. The EU AI Act's Article 6 defines high-risk AI systems. Article 9 requires those systems to have risk management. Article 14 requires human oversight for those same systems. In the original document, these are connected by cross-references. In a vector store, they're three isolated chunks that might not even get retrieved together.
2. Semantic similarity isn't semantic equivalence.
Vector search finds chunks that sound similar. But regulatory comparison needs to know whether two concepts are functionally equivalent. "Human-in-the-loop" (EU) and "Human-in-the-Loop" (Singapore) have identical names but different scopes — the EU version is a legal requirement for high-risk systems, the Singapore version is a recommendation for any risk level. Cosine similarity says these are the same. They're not, at least not in any way that matters for compliance.
3. You can't do gap analysis with chunks.
Try asking a RAG system: "List all requirements in the EU AI Act that have no equivalent in Singapore's framework." The system would need to enumerate every requirement in document A, then check each one against everything in document B. That's not retrieval — that's exhaustive cross-referencing. RAG doesn't do exhaustive.
Enter GraphRAG
GraphRAG takes a different approach. Instead of chunking documents into text fragments, you extract entities and relationships from the documents and build a knowledge graph.
For a governance framework, the entities are things like:
- Regulations — the frameworks themselves
- Risk categories — "high risk," "unacceptable risk," "minimal risk"
- Requirements — specific obligations like "conformity assessment" or "bias detection"
- Principles — guiding concepts like "transparency" or "accountability"
- Organizations — regulatory bodies like the European AI Office or Singapore's PDPC
The relationships are what make this powerful:
- The EU AI Act defines risk classification
- High-risk AI requires human oversight
- Human oversight includes human-in-the-loop
- Conformity assessment leads to CE marking
- Singapore's framework maps to EU's risk classification (same canonical concept, different implementation)
Now you have a structured representation of both frameworks that preserves the connections between concepts — the exact thing that chunking destroys.
How GraphRAG handles the hard problems
Cross-framework alignment
Each concept in the graph gets a canonical_id — a normalized identifier that enables matching across frameworks. "Risk Management System" (EU, mandatory, Article 9) and "Risk Management" (Singapore, voluntary, Section 3.2) both get canonical_id: risk_management_system. The graph engine matches them automatically, and then compares their attributes.
The result: you know these are the same concept, but the EU makes it mandatory and Singapore makes it optional. That's a conflict, not a match — and it's exactly the kind of nuance that matters for compliance.
Traditional RAG would tell you both frameworks mention risk management. GraphRAG tells you how they differ.
Gap analysis falls out naturally
Once both frameworks are graphs, finding gaps is trivial. Walk every node in the base graph. Check if a matching canonical_id exists in the variant graph. If not, it's a gap.
Running this on the EU AI Act vs Singapore produces concrete findings:
- Prohibited practices — The EU explicitly bans social scoring and real-time biometric identification. Singapore's framework doesn't address these at all. That's not a disagreement; it's an entire category of regulation that exists in one framework and is absent from the other.
- Penalties — EU imposes fines up to 7% of global turnover. Singapore has no penalty mechanism because the framework is voluntary. Again, not a disagreement — a structural difference in regulatory approach.
- AI Verify toolkit — Singapore has a practical testing framework with standardized assessments. The EU doesn't have an equivalent (conformity assessment is conceptually similar but procedurally different).
You can get these insights programmatically from the graph structure. No LLM needed for the comparison itself — the graph engine handles it deterministically.
Multi-hop reasoning
This is where GraphRAG really separates itself from traditional RAG.
Question: "If my ecommerce platform uses AI to personalize pricing based on user behavior, what requirements apply in both jurisdictions?"
With traditional RAG, you'd get chunks about pricing or consumer protection from both documents. Maybe useful, maybe not — depends on what the chunking captured.
With GraphRAG, you can traverse the graph:
- "Personalized pricing" → classified as automated decision-making affecting consumers
- Automated decision-making → subject to transparency requirements (EU)
- Automated decision-making → classified as high-risk AI decision if it significantly affects individuals (EU)
- High-risk AI → requires risk management, data governance, transparency, human oversight, conformity assessment
- In Singapore: high-risk AI decision → requires human-in-the-loop oversight and explainability
That's five hops through the graph, and you get a complete compliance picture for your pricing engine. Each step is traceable to a source article. No hallucination, no guessing, no "I found a similar-sounding chunk."
The practical architecture
Building this isn't science fiction. The system we built runs on a straightforward stack:
- Ingestion — Parse governance documents (PDFs or specs). An LLM extracts entities and relationships into JSON-LD format.
- Graph construction — Each entity gets a type (Regulation, Requirement, Principle, etc.), a canonical ID for cross-framework matching, and a relationships array with typed edges.
- Alignment engine — A deterministic comparison engine walks both graphs and classifies every concept into four buckets: Match, Missing, Extension, Conflict.
- Visualization — An interactive graph view where you can click nodes, inspect attributes, and see conflict details.
The LLM does the hard work once — extracting structured knowledge from unstructured text. After that, the comparison is pure graph traversal. No LLM in the loop for the analysis itself, which means the results are reproducible and auditable. That matters a lot in compliance.
When to use which approach
This isn't about GraphRAG replacing traditional RAG everywhere. They solve different problems.
Use traditional RAG when:
- You're doing Q&A against a single document
- The questions are self-contained ("What does Article 5 say?")
- You need speed and simplicity
- The relationships between chunks don't matter much
Use GraphRAG when:
- You're comparing multiple documents or frameworks
- You need to understand relationships between concepts
- Gap analysis or alignment is the goal
- Traceability and auditability matter (compliance, legal, regulatory)
- Multi-hop reasoning is required ("What requirements apply to X, given that X is classified as Y, and Y triggers Z?")
The honest tradeoffs
GraphRAG isn't free. The upfront cost of building knowledge graphs is higher than chunking text. You need decent entity extraction (which means LLM calls), a well-thought-out ontology, and canonical ID design that actually works across documents. If your canonical IDs are wrong, your alignments are wrong.
The ontology design is the hardest part. Deciding that "Regulation," "Requirement," "Principle," and "RiskCategory" are the right entity types for governance frameworks took iteration. Get this wrong and the graph is either too granular (thousands of tiny nodes, hard to reason about) or too coarse (everything is a "Concept," which tells you nothing).
But once the graph is built, you can ask questions that are simply impossible with traditional RAG. "Show me every mandatory EU requirement that Singapore treats as voluntary." "Find all concepts that exist in Singapore but have no EU equivalent." "Trace the full regulatory chain from 'AI system' to 'penalty.'" These are graph queries, not text retrieval, and the answers are exhaustive and deterministic.
For regulatory compliance across jurisdictions — where precision matters, where gaps have legal consequences, and where you need to defend your analysis to auditors — that's a worthwhile trade.
Trying it yourself
The governance comparison tool is open source. Clone it, run npm install && node server.mjs, and toggle Mock Mode to see the EU AI Act vs Singapore comparison without any API keys. The pre-built sample graphs contain 40 EU entities and 34 Singapore entities with typed relationships, and the comparison engine surfaces matches, gaps, extensions and conflicts automatically.
Sometimes the best way to understand why GraphRAG matters is to see it work on a problem you actually care about.
Top comments (0)