---
title: "O que acontece antes de uma IA jurídica responder à sua questão"
url: https://www.haqq.ai/pt/blog/legal-ai-orchestration-layer
locale: pt
type: blog
description: "Muitas IA jurídicas enviam o pedido direto a um modelo generalista. O que o sistema faz antes dessa chamada molda a resposta. A arquitetura, e quatro testes para qualquer demonstração."
category: "ai-legal-tech"
keywords: "legal AI orchestration layer, legal AI architecture, is legal AI a ChatGPT wrapper, how legal AI works, AI orchestration legal software, legal AI evaluation, how to evaluate legal AI vendors, legal AI demo questions, legal AI due diligence, ChatGPT wrapper legal, legal AI engine vs wrapper, context window legal AI, lost in the middle, model independence legal AI, legal AI control layer"
published: 2026-08-06
updated: 2026-11-10
english_version: https://www.haqq.ai/blog/legal-ai-orchestration-layer
source: src/data/blogPosts.ts
generator: scripts/generate-page-markdown.ts
---

# O que acontece antes de uma IA jurídica responder à sua questão

Muitas IA jurídicas enviam o pedido direto a um modelo generalista. O que o sistema faz antes dessa chamada molda a resposta. A arquitetura, e quatro testes para qualquer demonstração.

> **Note:** In short: many legal AI products send your question to a general-purpose model inside a prompt template, and the interface cannot show you which kind of product you have. The work a system does before that model call (intent, jurisdiction, facts as data, scope) shapes the answer. Four demo tests, about ten minutes, tell you what you are buying.

## Key facts

- Language models use long inputs unevenly: accuracy is highest when the relevant information sits at the start or end of the context and drops when it sits in the middle (Liu et al., Lost in the Middle, TACL vol. 12, 2024).
- All 18 models in Chroma's Context Rot study got less reliable as input length grew, even on deliberately simple tasks (Chroma technical report, 14 Jul 2025).
- Three leading legal research tools each hallucinated on 17% to 33% of test queries in a preregistered Stanford study (Magesh et al., Journal of Empirical Legal Studies, 2025).
- In our June 2026 run, 24% of 3,000 graded answers from 10 frontier models cited or applied law that did not say what the model claimed (HAQQ benchmark, 5 Jun 2026).
- Damien Charlotin's database listed 2,202 court and tribunal decisions involving AI-fabricated citations or content as of 19 October 2026.

> **Note:** Disclosure: HAQQ sells legal AI, built on its own engine (Justinian), and ran the June 2026 benchmark above. The four tests at the end work on us as well as on anyone else.

Every lawyer evaluating legal AI eventually asks the same question, usually about eight minutes into a demo: *how is this different from using ChatGPT?*

Vendors tend to answer with training data, a proprietary corpus or a fine-tune. Those claims are hard to check and often sit away from where the difference lives. The answer we give is architectural, and it comes down to where the thinking happens.

## Is most legal AI a ChatGPT wrapper?

A large share of legal AI products work like this. You type a question. The product wraps it in a prompt template (instructions to act as a helpful legal assistant, perhaps a few examples) and forwards it to a general-purpose model. The model answers, and the product formats the answer.

That can be useful. It also means the product's quality is mostly the model's quality, and your opposing counsel can buy the same model on a consumer subscription.

For a buyer, the hard part is that **you cannot tell from the interface**. A wrapper and a purpose-built engine both show a text box, a streaming response and some citations underneath. The difference sits upstream, out of sight, which is why vendors are rarely pressed on it.

## What should happen before the model is called?

When a question reaches HAQQ, it first goes through a step we own, whose job is to work out what the request is and to configure everything that follows.

That step settles what a competent associate would establish before starting work, and it records the result as structured data:

- **The question underneath the words.** What someone types at 11pm between two calls, restated precisely and completely. This runs natively in Arabic and French as well as English, with no translation step added afterwards.
- **The kind of legal work.** Drafting, research, review, comparison or a procedural question. Each needs a different shape of answer, and deciding that up front beats hoping a general model infers it.
- **The jurisdiction**, and separately the language the governing law is written in. The two often differ, and treating them as one is a quiet, common source of error.
- **The facts, as objects.** Parties, dates, obligations, amounts, governing law and document type, pulled out of the prose before anything expensive reads it.
- **What the question needs.** Which specialised capabilities to load, how much reasoning depth it warrants, and whether it is in scope at all.

The general-purpose model runs after all of that, and it starts prepared: the relevant capabilities loaded, the facts extracted, the jurisdiction identified and the scope decided.

> The model runs last, on work that has already been sorted.

### What is that layer called?

At HAQQ it is [Justinian®](https://www.haqq.ai/justinian), our proprietary reasoning and orchestration engine. It sits between the user, organizational data and the underlying AI models, applying context, jurisdiction, retrieval, permissions, controls and model selection before an answer is produced.

The short version: the model is the intelligence. Justinian® is the system that decides how that intelligence is used.

Each of those six words answers a question a supervising partner would ask before letting anyone start work:

- **Context.** What does the firm already know about this client, this matter and this kind of document?
- **Jurisdiction.** Which law governs, and in which language is it written?
- **Retrieval.** Which sources should the answer be built on?
- **Permissions.** Who is asking, and what are they allowed to see?
- **Controls.** What rules does the firm apply to this type of work?
- **Model selection.** Which model suits this task?

The most important AI decision may be what happens before the model is called. Those six are that decision, made on every request.

## Why does that produce better answers?

Two mechanisms, and the second one surprised us more.

### Attention is a budget

A model's context window is finite, and everything in it competes for attention. The research above shows what happens as context grows: retrieval gets worse in the middle of long inputs (Liu et al.) and reliability falls with length even on easy tasks (Chroma). Loading every capability a system has into every request spends that budget before the lawyer's document arrives. Loading only the relevant ones leaves room for the contract, the statute and the facts.

### Structured facts spare the model a parsing job

This is the larger effect. Handed a paragraph of prose, a model spends part of its effort working out what the paragraph contains. Handed structured facts (*these parties, this governing law, this obligation, this date*), it can spend that effort on the legal question.

That is the effect we design for: the same general-purpose model doing better legal work because of what it was handed. We have not published a controlled comparison of the same model inside and outside our engine, so treat this as our design rationale, supported by the context research above.

## Why does this layer matter more as models improve?

Foundation models are becoming more capable. That makes the control layer around them more important, not less.

The reason is simple. Every firm can buy access to the same models, and so can opposing counsel. If the model were the whole product, every firm's AI would be about as good as every other firm's, and none of it would reflect how your firm works.

Generic AI knows a lot. It does not know your institution by default. It has not read your precedents, it does not know which positions your partners take on a limitation clause, and it has no idea that the counterparty in today's NDA was on the other side of a dispute last spring. That knowledge belongs to the firm, and it is the part that makes an answer usable without a rewrite.

Your competitive advantage should not disappear because every firm bought access to the same model. The better the models become, the more valuable the layer that governs how institutions use them. A stronger model handed the right context, sources and task produces better work. Handed a bare question, it produces a more fluent version of the same generic answer.

High-stakes AI needs more than intelligence. It needs context, controls and accountability. In legal work the accountability part has a name on it: the lawyer who signs.

## What happens when the leading model changes?

It will. Model leadership, cost, policy and availability keep changing, and the model that leads this quarter may not lead the next.

So ask a vendor two questions. Which model answers my question today? And what would I have to rebuild if that changed tomorrow?

If everything the product knows about your firm lives in prompts written for one provider's model, a model change is a migration. If it lives in a layer the vendor owns, a model change is an upgrade. In HAQQ the underlying model is interchangeable by design, and we benefit as the underlying models improve.

> Your AI provider should be replaceable. Your institutional intelligence should not.

Your AI infrastructure should not need to be rebuilt every time the leading model changes.

## What decides whether legal AI works on real documents?

Two components that rarely appear in a sales deck, and both decide whether the product works on a normal Tuesday.

**Document intake.** Much legal work arrives as a photograph of a stamped page, a scan of a fax or a PDF that was printed and re-scanned crooked. We treat reading those as a core engineering problem. If a clause number is misread on the way in, no downstream reasoning recovers it, and the system will reason carefully about the wrong number.

**Memory as structure.** The engine keeps the relationships between your matters over time and draws on them when a question calls for it. Pasting your last twenty messages back into the prompt is a different thing. Structured memory is what lets the system know that the counterparty in the NDA you are reviewing today is the same company from a dispute two months ago.

## What does good architecture not fix?

We would rather say this than have you find it out.

**It does not eliminate error.** Any system built on a language model can produce a wrong answer, and the figures in the key facts above apply to every tier of the market. Good architecture makes errors rarer and easier to catch: claims generated against retrieved sources, citations you can open, and explicit flags where the law is unsettled. Our [hallucination audit](https://www.haqq.ai/blog/ai-legal-hallucination-audit) tracks what happens when nobody checks.

**It does not guarantee a correct answer.** No responsible AI provider should make that claim. What the layer gives you is grounding, citations you can open, controls and a clear point for human review, so that a wrong answer is easier to catch before it leaves the building.

**It does not remove the lawyer.** Everything here assumes a professional reviews the output and signs it. That assumption shaped the architecture from the start.

**It does not make coverage universal.** Quality varies by jurisdiction, by how well the source law is digitised and by how much of it is public. If a vendor quotes a single global coverage number, ask what it counts. We would rather answer that question about your jurisdiction than give you one figure.

## How do you test a legal AI vendor in a demo?

You do not need anyone's architecture diagram. Four tests, about ten minutes, and they work on every vendor in the category, us included. For a longer checklist, see [45 red flags in a legal AI vendor evaluation](https://www.haqq.ai/blog/45-red-flags-legal-ai-vendor-evaluation).

### 1. Ask it something outside law

A general model in a legal prompt will usually answer a medical or financial question, because underneath it is a general model. A system that establishes intent before generating should decline and say why.

### 2. Ask the same question in two languages

Write the same legal question once in English and once in Arabic or French, each in your own words. If the substance of the answer changes, language is being handled after the reasoning.

### 3. Give it a bad scan

Photograph a document at an angle, in poor light, and upload it. In our experience this is the most predictive test in the demo, because it is the most common real input and the least demoed one.

### 4. Ask what it does not know

Push it toward an unsettled or thinly sourced area of law. A system tuned to always produce an answer will produce one. A system built for professional work will tell you the ground is uncertain and show you why.

If a vendor is comfortable with all four, the architecture is probably real. If the demo steers around them, that tells you something too. You can run the same four against [HAQQ's legal AI chat](https://www.haqq.ai/legal-ai-chat).

## Key takeaways

- The meaningful difference between legal AI products is architectural and invisible from the interface. Ask where the reasoning happens.
- Structured work before the model call improves quality as well as cost: a model handed extracted facts spends its attention on law.
- Unglamorous components decide real-world performance. Document intake predicts whether a tool works on a Tuesday better than a benchmark score does.
- Four demo tests (off-topic, two languages, a bad scan, unsettled law) show what kind of system you are being sold.
- The model is becoming a commodity. Control is not. What a firm keeps when the model changes is the layer that holds its context, permissions and controls.

- [Liu et al., Lost in the Middle: How Language Models Use Long Contexts (TACL 2024)](https://aclanthology.org/2024.tacl-1.9/)
- [Chroma: Context Rot, how increasing input tokens impacts LLM performance (Jul 2025)](https://research.trychroma.com/context-rot)
- [Magesh et al., Hallucination-Free? Assessing the Reliability of Leading AI Legal Research Tools (JELS 2025)](https://nlp.stanford.edu/~manning/papers/Magesh-Hallucination%E2%80%90Free-2025.pdf)

- [45 red flags when evaluating a legal AI vendor](https://www.haqq.ai/blog/45-red-flags-legal-ai-vendor-evaluation)
- [Context engineering for legal AI](https://www.haqq.ai/blog/context-engineering-ai-legal-guide)
- [Human in the loop legal AI](https://www.haqq.ai/blog/human-in-the-loop-legal-ai)
- [The AI hallucination audit](https://www.haqq.ai/blog/ai-legal-hallucination-audit)

## Perguntas frequentes

### O que é uma camada de orquestração de IA no software jurídico?

O termo tem dois significados. Na maioria do software jurídico significa encaminhamento de fluxos de trabalho: enviar um assunto à pessoa certa para aprovação. O significado técnico mais restrito é a camada que decide o que acontece antes de um modelo de IA ser chamado: a intenção, a jurisdição, os factos e o âmbito do pedido. Quando um fornecedor fala em orquestração, pergunte a qual dos dois se refere, porque só o segundo altera a qualidade da resposta.

### A HAQQ é um wrapper do ChatGPT?

Na HAQQ, a geração final é feita por um modelo generalista. Antes de esse modelo ser chamado, o motor da HAQQ, Justinian, determina o que é o pedido: a intenção, a jurisdição, a língua da lei aplicável, os factos como dados estruturados e o âmbito. Num wrapper, a pergunta vai para o modelo envolvida num modelo de prompt, com pouco ou nenhum trabalho prévio.

### Como sei se um produto de IA jurídica é um wrapper?

Faça quatro testes numa demonstração. Pergunte algo fora do direito: um modelo generalista envolvido normalmente responde a uma pergunta médica ou financeira. Faça a mesma pergunta jurídica em duas línguas, por palavras suas: se a substância mudar, a língua é tratada depois do raciocínio. Carregue uma digitalização torta e mal iluminada. Depois puxe a conversa para uma área do direito não consolidada, onde um sistema profissional deve dizer que o terreno é incerto.

### Porque é que fazer trabalho antes da chamada ao modelo melhora a resposta?

A janela de contexto de um modelo é finita, e a investigação mostra que a fiabilidade diminui à medida que a entrada cresce: Liu et al. (TACL 2024) concluíram que a exatidão cai quando a informação relevante está no meio de um contexto longo, e o estudo Context Rot da Chroma, de julho de 2025, concluiu que todos os 18 modelos testados se degradaram com entradas mais longas. Carregar apenas o que uma pergunta precisa, e passar os factos como dados estruturados, deixa mais atenção para a questão jurídica.

### Uma melhor arquitetura impede a IA jurídica de alucinar?

Não. Qualquer sistema construído sobre um modelo de linguagem pode produzir uma resposta errada. Um estudo pré-registado de Stanford concluiu que as principais ferramentas de pesquisa jurídica alucinaram em 17% a 33% das consultas de teste, e a execução da HAQQ de junho de 2026 concluiu que 24% de 3.000 respostas de modelos de fronteira citavam direito que não sustentava a afirmação. Uma boa arquitetura torna os erros mais raros e mais fáceis de detetar, através de fontes recuperadas, citações que se podem abrir e sinalizações explícitas de incerteza.

### Porque é que a qualidade da digitalização de documentos importa para a IA jurídica?

Muito trabalho jurídico chega como uma página carimbada fotografada, uma digitalização enviada por fax ou um PDF digitalizado de novo e torto. Se um número de cláusula ou uma data for mal lido na entrada, nada a jusante o recupera: o sistema raciocina cuidadosamente sobre o número errado e apresenta o resultado com confiança. É por isso que uma má digitalização é um dos testes mais úteis a fazer em qualquer demonstração de IA jurídica.

### Porque é que a independência do modelo importa na IA jurídica?

Porque a liderança, o custo, as políticas e a disponibilidade dos modelos estão sempre a mudar. Uma sociedade deve poder melhorar a camada do modelo sem reconstruir a sua camada de inteligência institucional. Na HAQQ, o Justinian® detém a camada de raciocínio, contexto, orquestração e controlo em torno do modelo, e o modelo subjacente é intercambiável por conceção.

---

Canonical page: https://www.haqq.ai/pt/blog/legal-ai-orchestration-layer
Whole-site context for agents: https://www.haqq.ai/llms.txt · https://www.haqq.ai/agents.md

Generated at build time from the site's own content data. Do not edit by hand.
