legal conflict detector

Explore how encoder models detect legal document conflicts with open-source precision

Legal document review is a quadratic problem at its core, comparing two documents with 133 clauses each means 17,689 potential pairwise checks.

3 min readMachine Learning
Explore how encoder models detect legal document conflicts with open-source precision
How to make a Legora-style legal conflict detector tool using only NLI and encoder models [P]

The most practical AI breakthroughs often come from people who refuse to accept that a problem has no workable solution. Tabs, a legal engineer at Isaacus, built an open-source legal conflict detector that uses encoder models and natural language inference to find deviations and gaps between document pairs, and it runs in under 20 seconds. This is a genuinely useful intervention in a domain where generative models have been oversold. We've seen similar patterns in other technical fields, from Explore how DiffusionEngine unifies diffusion research in one extensible PyTorch framework to One TypeScript Library That Unifies Financial Validation Across Platforms, open-source tools that solve specific, high-value problems without promising to reinvent everything. What Tabs did matters because it directly addresses a real bottleneck in legal workflows.

The core insight is about architectural honesty. Comparing two legal documents clause-by-clause is a quadratic problem: 133 clauses against 133 clauses means 17,689 comparisons. Using a large generative model like Opus or Astra for each pair is prohibitively slow and expensive. Uploading entire documents to Claude or GPT doesn't work either, decoder architectures lack the fixed attention needed for thorough one-shot analysis, and they hallucinate. Tabs' pipeline sidesteps all of this by pushing the heavy lifting onto encoder models. It enriches documents into hierarchical trees, embeds clauses as vectors, filters out non-provisions, shortlists the three most relevant pairs per clause, and scores them with a reranker and classifier. The result is a conflict detector that produces deviations (same topic, high conflict score) and gaps (topic in one document but not the other) without generative hallucination. When they tested it on Bob Iger's 2011 and 2022 Disney employment agreements, it found meaningful disparities, including a missing intellectual property clause in the older contract. That's not a toy demo; that's a working tool for real due diligence.

The practical takeaway is direct: if you are doing legal document review at scale, you should look at this pipeline today. The code is MIT-licensed, the guide is thorough, and the architecture lets you swap in your own models. The optional LLM summarization step is safely gated behind the encoder stack, so it cannot fabricate conflicts. This design pattern, using small, fast models for the deterministic bulk work and reserving generative models for controlled output, is one we expect to see more of. The question worth watching is how many other quadratic-review workflows, from contract compliance to regulatory filings, can be rethought the same way.

From Machine Learning

Hey r/learnmachinelearning! I’m Tabs, a legal engineer at Isaacus. Still getting better at machine learning things but here we go.

I built an open-source legal conflict detector that finds deviations and gaps between pairs of legal documents using only encoder models and natural language inference.

Read the original at Machine Learning