Skip to content
    HAQQ
    Přihlaste se
    Kontaktujte obchod
    Vyzkoušejte HAQQ
    Vyzkoušejte HAQQ
    1. Domů
    2. Blog
    3. Právní ontologie AI: Jak znalostní graf snížil náklady na Legal AI o 97 %
    AI a legal tech

    Právní ontologie AI: Jak znalostní graf snížil náklady na Legal AI o 97 %

    Mexická ontologie pracovního práva nahradila 300 nástrojů MCP sedmi a snížila náklady na zprávu z 0,60 USD na 0,02 USD. Metoda, data o halucinacích ze Stanfordu a plán vývoje.

    Stephane BoghossianStephane Boghossian|
    1. dubna 2026
    8 min čtení
    Právní ontologie AI: Jak znalostní graf snížil náklady na Legal AI o 97 %

    In short: a legal ontology built by Dynamic Interfaces for Mexican labour law replaced 300 MCP tools with 7, and its cost per message fell from $0.60 to $0.02, a 97% drop. The saving comes from about 88,000 fewer tool-description tokens per request plus a cheaper model the smaller tool set allowed.

    Method. System examined: Dynamic Interfaces' legal ontology for Mexican federal labour law, which we explored through its MCP server in March 2026. Corpus: 4 federal laws, 1,689 articles, 11 entity types, 7 judicial precedents, 12 typed cross-reference kinds, 10 enum taxonomies. Tools exposed to the model: about 300 before (one per database operation), 7 after (one per legal operation). Tool descriptions in context: about 90,000 tokens before, about 2,100 after (roughly 300 tokens per tool). Cost per message: $0.60 before, $0.02 after, as measured and reported to us by Dynamic Interfaces; the $0.02 figure also reflects a move from a frontier model to a cheaper open-weight one. HAQQ did not re-run the cost measurement independently.

    Key facts

    • Ontology cost result: 300 tools to 7, $0.60 to $0.02 per message (Dynamic Interfaces, reported to HAQQ, March 2026).
    • Tool-count research: RAG-MCP, which passes the model only the tool descriptions it retrieves, raised tool-selection accuracy from 13.62% to 43.13% and cut prompt tokens by more than 50% (Gan and Sun, arXiv:2505.03275, May 2025).
    • Legal RAG hallucinations: a preregistered Stanford RegLab and HAI study found that Lexis+ AI, Westlaw AI-Assisted Research and Ask Practical Law AI each hallucinated between 17% and 33% of the time, less often than GPT-4 (Magesh et al., Journal of Empirical Legal Studies 22:216, April 2025).
    • Harvey was valued at $15.5 billion after a $550 million round announced on 9 September 2026 (Harvey blog; TechCrunch, 9 Sep 2026).
    • Mexico 2026 reference values: general minimum wage MXN 315.04 a day; UMA MXN 117.31 a day, in force from 1 February 2026 (CONASAMI and INEGI figures, as reported Jan 2026).
    • Target corpus for HAQQ: UAE Federal Decree-Law No. 33 of 2021 on the regulation of labour relations has 74 articles, in force since 2 February 2022 (UNEP LEAP legislation database, read 20 Oct 2026).

    How did we come across this system?

    In March 2026 I joined a call with the CEO of Dynamic Interfaces to see a legal ontology they had built for Mexican labour law. They told us five Mexican government customers use it daily, and that court-appointed expert witnesses (peritos) query four federal statutes through it and get answers with article-level citations. The number that made me spend the next two weeks inside it was the cost: two cents per message.

    For a sense of scale, the per-seat legal AI market is priced in hundreds of dollars a month, and its leader, Harvey, was valued at $15.5 billion in September 2026. A two-cent message changes who can afford legal AI. This post is what I found when I connected to their MCP server, read the data model and tested it against the legal reasoning I would expect from a careful labour lawyer.

    Disclosure. HAQQ sells legal AI, and at the time of writing we were exploring an integration with Dynamic Interfaces. Their cost figures are their own measurements; we report them with that label.

    What does the Stanford study say about legal AI hallucinations?

    Magesh, Surani, Dahl, Suzgun, Manning and Ho, at Stanford's RegLab and the Stanford Institute for Human-Centered AI, ran what they describe as the first preregistered evaluation of AI legal research tools. Published in the Journal of Empirical Legal Studies in April 2025, it found that the RAG-based tools from LexisNexis and Thomson Reuters each hallucinated between 17% and 33% of the time. Retrieval reduced hallucinations compared with GPT-4, and the tools differed a lot: Lexis+ AI answered 65% of queries accurately, Westlaw AI-Assisted Research 42%.

    The study tested three products on US law in 2024. It does not show that every RAG system hallucinates at that rate, and it does not test ontologies. What it does show is that retrieval over text, on its own, left a measurable error rate in tools sold as reliable. That is the gap a structured model of the law tries to close. For court cases where fabricated citations reached a judge, see our hallucination audit.

    Why does RAG struggle with statutes?

    Most legal AI products retrieve passages: they chunk documents, embed them and fetch the chunks closest to the question. That works for many questions. On statute-heavy work it fails in three predictable ways.

    Versions over time

    A chunk of an article carries no date. Mexico's "Vacaciones Dignas" reform, published in the Diario Oficial de la Federación on 27 December 2022, amended Articles 76 and 78 of the Ley Federal del Trabajo and raised the first-year vacation entitlement from 6 to 12 days from 2023. A perito valuing a dismissal that spans the change needs both versions and the date each applied. Plain retrieval has no field for that.

    Hierarchy

    Law is layered: constitution, federal law, regulations, then titles, chapters, articles and fractions inside each law. Chunking flattens it. When one article applies "in the terms of" another, a retriever can return the first without the second.

    Cross-references

    Article 162 of the Ley Federal del Trabajo (seniority premium of 12 days' wages per year of service) takes its salary base from Articles 485 and 486, which cap it at twice the minimum wage. Getting the number right means following that chain. Similarity search returns fragments; a graph walks the links.

    What is a legal ontology?

    A legal ontology is a machine-readable model of a body of law: its entities (laws, articles, courts, precedents, computed values such as wage caps), the hierarchy between them, the dates each version applied, and typed links between provisions. A model answering a question queries that structure instead of searching loose text.

    In the Dynamic Interfaces system each cross-reference has a type: remite_a (refers to), complementa (complements), modifica (amends), excepciona (creates an exception), define_termino (defines a term), establece_formula (sets a formula) and establece_procedimiento (sets a procedure). The exception type matters most to me. Article 5 of the LFT sets general rights, and special work regimes carve out exceptions. A system that does not record exceptions will apply the general rule where the special one governs.

    How much does a legal ontology reduce AI costs?

    Per Dynamic Interfaces' measurement, from $0.60 to $0.02 per message. Two things produce the drop, and it helps to keep them apart.

    Fewer tool descriptions in every request

    The usual way to build an agent is to expose each database operation as a tool. Across 11 entity types that reaches about 300 tools, and every tool description is sent to the model with every request: at roughly 300 tokens each, about 90,000 tokens before the user has asked anything. The ontology replaces them with 7 legal operations: query_legal_knowledge, calculate_settlement, find_jurisprudencia, get_cross_references, get_wage_data, get_vacation_table and generate_dictamen. That is about 2,100 tokens of descriptions, a saving of roughly 87,900 tokens per request.

    This matches published research. In the RAG-MCP paper, showing the model only the relevant tools instead of all of them more than tripled tool-selection accuracy (13.62% to 43.13%) and cut prompt tokens by more than half.

    A cheaper model can do the job

    With 7 clear tools, the model's task is smaller: understand the question, pick one to three tools, and write up structured results. The ontology does the structural work. That let Dynamic Interfaces move from a frontier model to a cheaper open-weight one, which accounts for much of the remaining saving.

    Vyzkoušejte HAQQ AI zdarma

    Zažijte sepisování a rešerše s podporou AI

    What the saving means for a perito

    Take a perito laboral in Mexico City earning roughly MXN 15,000 to 30,000 a month (the range we were given), handling 50 cases a month at 20 messages each. At $0.60 a message, that is $600 a month, about MXN 10,800 at 18 pesos to the dollar, or 36% to 72% of income. At $0.02 it is $20, about 1.2% to 2.4%. The lower price opens a market that the higher one rules out.

    Which reference unit applies: UMA or minimum wage?

    Since the constitutional reform of January 2016, Mexico has two reference units: the UMA (Unidad de Medida y Actualización) and the minimum wage. In 2026 the general minimum wage is MXN 315.04 a day and the UMA MXN 117.31, a ratio of about 2.69. For the seniority-premium cap under Articles 162, 485 and 486, twice the minimum wage gives MXN 630.08 a day and twice the UMA gives MXN 234.62, 62.8% less.

    Calculators and commentators in Mexico do not all apply the same unit to this cap, so this is a choice a lawyer has to make and defend. A retrieval system leaves that choice to the model on every query. An ontology records which unit the firm applies to which concept, and the authority for it, so the choice is visible and the same every time.

    Can a legal ontology work in other jurisdictions?

    The building blocks recur everywhere: hierarchical legislation, subject tags, cross-reference graphs, versions over time and computed values. Civil-law systems with codified statutes (France, Brazil, Saudi Arabia, the UAE) map most directly. Hudson de Martim's SAT-Graph RAG paper applies a similar structural and temporal model to the Brazilian Constitution. Common-law systems need case law treated as a first-class entity beside statutes.

    What is HAQQ building with this?

    We are building a UAE labour-law ontology, starting with Federal Decree-Law No. 33 of 2021 (74 articles) and its implementing regulation. Saudi Arabia's Labor Law, issued by Royal Decree No. M/51 of 1426H, is about 245 articles. Corpora of that size can be modelled and checked by lawyers in weeks. Because the ontology hands the model structured data, the model synthesises in Arabic or English instead of extracting rules from Arabic text, which is the harder task. The ontology will feed HAQQ's legal research on UAE labour questions.

    Governments are moving the same way. The EU's European Legislation Identifier (ELI), agreed by the Council in 2012, gives legislation stable machine-readable identifiers, and New Zealand's Better Rules work drafts policy as plain language, rules and code together.

    How do you build a legal ontology?

    For one country's labour law, our working estimate is 4 to 8 weeks. These are the steps we follow:

    • Identify the 3 to 5 primary statutes and their official sources, and check how machine-readable each is.
    • Design the entity model. Start from a general template (Law, StructuralUnit, Article, CaseLaw, CrossReference, ComputedValue) and add what the jurisdiction needs.
    • Define the taxonomies: 15 to 25 subject tags, the cross-reference types and the computed-value types.
    • Parse the laws, keep the hierarchy and version dates, tag articles by subject (a model can draft tags; a lawyer approves them) and load them into a database.
    • Build the cross-reference graph: explicit references first, then references between laws, with every edge typed and reviewed.
    • Expose a small set of tools over MCP, for example search articles, get article, get cross-references, get case law, compute value, get timeline and compare jurisdictions.
    • Measure before and after: tool tokens per request, cost per message, and accuracy on a test set of questions with lawyer-approved answers.

    References

    • Magesh et al., Hallucination-Free? Assessing the Reliability of Leading AI Legal Research Tools, Journal of Empirical Legal Studies 22:216 to 242 (2025)
    • Gan and Sun, RAG-MCP: Mitigating Prompt Bloat in LLM Tool Selection via Retrieval-Augmented Generation, arXiv:2505.03275
    • de Martim, An Ontology-Driven Graph RAG for Legal Norms, arXiv:2505.00039
    • Harvey raises $550M at a $15.5B valuation (Harvey blog, 9 Sep 2026)
    • Harvey hits $15.5B valuation months after reaching $11B (TechCrunch, 9 Sep 2026)
    • Anthropic: donating the Model Context Protocol to the Agentic AI Foundation (9 Dec 2025)
    • UAE employment laws and regulations in the private sector (u.ae), incl. Federal Decree-Law No. 33 of 2021
    • Federal Decree-Law No. 33 of 2021 (UNEP LEAP legislation database)
    • Ley Federal del Trabajo (Cámara de Diputados)

    Related reading

    • where AI hallucinations have reached a court
    • why Arabic legal AI struggles with retrieval
    • our frontier-model legal benchmark, updated October 2026
    • legal engineering and the TIRO pattern

    Napsal(a)

    Stephane Boghossian
    Stephane Boghossian

    Vedoucí růstu

    Stephane vede růst v HAQQ a píše sekci AI a legal tech: srovnávací testy modelů, porovnání nástrojů a inženýrství za Legal AI, která obstojí v praxi.

    Všechny články tohoto autoraLinkedIn

    Související zdroje

    AI hallucination audit: where fake citations reached a courtArabic legal AILegal engineering: AI-powered legal workflowsHarvey AI review 2026

    Související články

    Proč obecná AI chybuje v kuvajtském a libanonském právu (a jak otestovat jakýkoli nástroj)
    Vysvětlení

    Proč obecná AI chybuje v kuvajtském a libanonském právu

    Proč obecná AI chybuje v kuvajtském a libanonském právu (a jak otestovat jakýkoli nástroj)

    Recenze Lexis+ AI 2026: nyní Lexis+ s Protégé, proti Westlaw CoCounsel
    Recenze

    Recenze Lexis+ AI 2026

    Recenze Lexis+ AI 2026: nyní Lexis+ s Protégé, proti Westlaw CoCounsel

    Znalostní grafy v právu: 5 způsobů, jak mapa důkazů činí Legal AI ověřitelnou
    Vysvětlení

    Znalostní grafy v právu

    Znalostní grafy v právu: 5 způsobů, jak mapa důkazů činí Legal AI ověřitelnou

    Často kladené otázky

    What is a legal ontology?

    A legal ontology is a machine-readable model of a body of law: its entities (laws, articles, precedents, computed values such as wage caps), the hierarchy between them, the dates each version applied, and typed links between provisions such as refers to, amends or creates an exception. An AI model queries that structure instead of searching loose text.

    How much can a legal ontology reduce legal AI costs?

    In the Mexican labour-law system we examined, cost per message fell from $0.60 to $0.02, a 97% drop, as measured by its builder Dynamic Interfaces. Replacing about 300 MCP tools with 7 cut roughly 88,000 tool-description tokens from every request, and the smaller tool set let them switch to a cheaper open-weight model.

    How is a legal ontology different from RAG?

    RAG retrieves text chunks that look similar to the question. An ontology stores the law's structure: hierarchy, version dates and typed cross-references. That lets a system follow a chain such as Article 162 of Mexico's Ley Federal del Trabajo to the salary cap in Articles 485 and 486, and apply the version of an article in force on a given date.

    How often do legal RAG tools hallucinate?

    A preregistered Stanford RegLab and HAI study (Magesh et al., Journal of Empirical Legal Studies, 2025) found that Lexis+ AI, Westlaw AI-Assisted Research and Ask Practical Law AI each hallucinated between 17% and 33% of the time on its test queries, less than GPT-4. Lexis+ AI answered 65% of queries accurately and Westlaw 42%.

    Why do fewer MCP tools make legal AI cheaper and more accurate?

    Every tool description is sent to the model on every request, so 300 tools at about 300 tokens each add about 90,000 tokens before the question. The RAG-MCP paper (arXiv:2505.03275) found that passing only relevant tools raised tool-selection accuracy from 13.62% to 43.13% and cut prompt tokens by more than half.

    How long does it take to build a legal ontology?

    Our working estimate for one country's labour law is 4 to 8 weeks: identify the statutes, design the entity model, parse and tag articles with lawyer review, build the typed cross-reference graph, expose a small set of MCP tools, and measure cost and accuracy on a lawyer-approved test set. UAE Federal Decree-Law No. 33 of 2021 has 74 articles.

    Co dál?

    Vyzkoušejte HAQQ AI zdarma

    Zažijte sepisování a rešerše s podporou AI

    Spočítejte si svou ROI

    Zjistěte, kolik času a peněz vaší kanceláři HAQQ ušetří

    Procházejte více než 600 právních promptů

    Prompty připravené k použití pro každý právní úkol

    Zpět na blog

    Předchozí článek

    Předpovědi Legal AI do roku 2030: Co předpovídá 72 AI agentů

    Další článek

    Varovné signály u dodavatelů Legal AI: kontrolní seznam o 45 bodech

    Na této stránce

    8 min čtení

    1. 01Key facts
    2. 02How did we come across this system?
    3. 03What does the Stanford study say about legal AI hallucinations?
    4. 04Why does RAG struggle with statutes?
    5. Versions over time
    6. Hierarchy
    7. Cross-references
    8. 05What is a legal ontology?
    9. 06How much does a legal ontology reduce AI costs?
    10. Fewer tool descriptions in every request
    11. A cheaper model can do the job
    12. What the saving means for a perito
    13. 07Which reference unit applies: UMA or minimum wage?
    14. 08Can a legal ontology work in other jurisdictions?
    15. 09What is HAQQ building with this?
    16. 10How do you build a legal ontology?
    17. 11References
    18. 12Related reading

    Sdílet tento článek

    Využijte to v praxi

    Položte HAQQ otázku, kterou ve vás tento článek vyvolal.

    HAQQ across all devices
    HAQQ Legal AI Platform Logo

    Vaše Legal AI dvojče a systém pro správu praxe pro sepisování, fakturaci a vítězství.

    Stáhněte zApp StoreZískejte naGoogle Play

    Dokumentace

    • Dokumentace otevře se v nové záložce
    • Začínáme otevře se v nové záložce
    • Newsroom otevře se v nové záložce
    • Aktualizace produktu otevře se v nové záložce
    • Stav otevře se v nové záložce
    • Důvěra otevře se v nové záložce
    • Zabezpečení
    • Časté dotazy otevře se v nové záložce
    • Komunita otevře se v nové záložce
    • Podpora otevře se v nové záložce

    Academy

    • Partner otevře se v nové záložce
    • Kurz otevře se v nové záložce
    • Prompt otevře se v nové záložce
    • Labs otevře se v nové záložce

    Web

    • eFirm
    • Legal AI Chat
    • Mobilní aplikace
    • Engine Justinian AI
    • HAQQ eBar
    • HAQQ eWallet
    • Ceník
    • Srovnejte nás
    • Řešení
    • Blog
    • Seznamte se s týmem
    • Připojte se k nám otevře se v nové záložce
    Otevřít aplikaci
    • Jazykové verzeenarfresitdeptrohics
    • Kontaktinfo@haqq.ai
    • Stavv provozu·podloženo zdroji
    • Podmínky služby
    • Zásady ochrany osobních údajů
    • Zásady cookies
    • Zpracování údajů
    • Lidé otevře se v nové záložce
    • Právníci otevře se v nové záložce
    • Zabezpečení otevře se v nové záložce
    © 2026 HAQQ Inc. Všechna práva vyhrazena.Produkt vyvinutý interně společností HAQQ. Web vytvořen moderními webovými nástroji.

    RAG vs Ontology: Same Query, Different Architecture

    RAG Approach

    Query: "Vacation days for 8 years of service, hired 2016"

    Art. 76 LFT (pre-2023)
    6 days min vacation...
    Art. 78 vacation premium
    ...minimum 6 working days
    Art. 81 payment timing
    Reform 2023 doubled...
    Result: "Workers with 8 years = 14 vacation days." (Retrieved pre-2023 table. Correct answer depends on date.)
    ⚠ Potentially incorrect (no temporal awareness)
    Ontology Approach

    Query: "Vacation days for 8 years of service, hired 2016"

    TablaVacacionesregimenpost_2023years=8 → 18dpremium=25%
    Result: "18 vacation days (post-2023 reform, Art. 76 LFT amended Dec 2022). Vacation premium: 25% of 18 days' salary (Art. 80 LFT)."
    ✓ Correct (temporal versioning built in)

    Interactive Ontology Explorer

    Click a law to explore its ontology hierarchy

    L

    Ley Federal del Trabajo

    Master employment statute (16 titles, 51 reforms)

    1,076 arts.
    T

    Titulo II (Relaciones Individuales)

    Individual labor relationships, contracts

    16 titles
    C

    Capitulo IV (Rescision)

    Termination of employment relationships

    ~120 ch.
    A

    Articulo 48 (Indemnizacion)

    Right to indemnification for wrongful dismissal

    atomic unit

    Cost Waterfall: $0.60 → $0.02

    Each step shows where the savings come from

    $0.60

    Starting Cost

    -$0.32

    Tool Desc. Tokens

    -$0.14

    Ontology Constraint

    -$0.12

    Model Downgrade

    $0.02

    Final Cost

    97%
    $0.58 saved per message
    300 tools → 7 tools • Frontier → Open-source

    Token Economics: Why Fewer Tools = Lower Cost

    Before: 300 Tool Descriptions in Context

    {"name":"get_article_by_number","description":"...","parameters":{...}}
    {"name":"get_article_by_topic","description":"...","parameters":{...}}
    {"name":"get_article_text","description":"...","parameters":{...}}
    {"name":"search_articles_keyword","description":"...","parameters":{...}}
    {"name":"get_article_reforms","description":"...","parameters":{...}}
    {"name":"get_article_at_date","description":"...","parameters":{...}}
    {"name":"get_cross_references_outbound","description":"...","parameters":{...}}
    {"name":"get_cross_references_inbound","description":"...","parameters":{...}}
    {"name":"get_articles_by_chapter","description":"...","parameters":{...}}
    ... +291 more tool definitions
    ↓

    After: 7 Ontology-Aware Tools

    query_legal_knowledge

    ~300 tokens

    calculate_settlement

    ~300 tokens

    find_jurisprudencia

    ~300 tokens

    get_cross_references

    ~300 tokens

    get_wage_data

    ~300 tokens

    get_vacation_table

    ~300 tokens

    generate_dictamen

    ~300 tokens

    90,000

    Tokens Before

    2,100

    Tokens After

    97.7%

    Reduction

    Claude Opus (frontier)

    $0.60

    $15/M input tokens

    →

    Open-source

    $0.02

    ~$0.50/M input tokens

    Cross-Reference Network: Wrongful Dismissal, $254,000 MXN

    Click "Trace Query" to illuminate the resolution path across 4 laws

    Art. 48LFTArt. 50LFTArt. 84Salary DefSalarioMinimoUMA + WagesLSS 27-28Social SecurityINFONAVIT 29HousingVacacionesPost-2023Tesis 53/2017Jurisprudencia
    LFT
    LSS
    INFONAVIT
    Computed
    Jurisprudencia

    Click above to see how the ontology resolves a real wrongful dismissal calculation

    Ontology Replication: Global Expansion

    Same pattern, jurisdiction-specific enums

    Live

    🇲🇽

    Mexico

    LFT + LSS + LSAR + INFONAVIT

    1,689

    Articles

    4

    Laws

    12

    X-Refs

    Phase 1

    🇦🇪

    UAE

    Federal Decree-Law No. 33/2021

    ~65

    Articles

    3

    Zones

    AR/EN

    Bilingual

    Phase 2

    🇸🇦

    Saudi Arabia

    Royal Decree M/51

    ~245

    Articles

    2024

    Amended

    AR/EN

    Bilingual

    Phase 3

    🇫🇷

    France

    Code du travail

    ~7,000

    Articles

    L+R

    Dual track

    API

    Legifrance

    Phase 3

    🇧🇷

    Brazil

    CLT (Consolidacao das Leis do Trabalho)

    ~922

    Articles

    Easiest

    Port

    PT

    Language

    Future

    🇺🇸 🇬🇧

    US + UK

    FLSA + ERA

    Complex

    Case Law

    Fed/State

    Dual

    +2

    Ref Types

    Pattern transfer: The entity model is universal. Only the enums change between jurisdictions.