Niklas Berg
View profile
Legal-clause RAG with citation
Built a clause-search system for contract drafting. Pinpoint citation back to source paragraph; hybrid BM25 + dense retrieval.
Lawyers found relevant precedent in 3 min vs 25 min.
0
Problem
Drafting attorneys needed to find precedent clauses across 12 years of past deals. Search was full-text only — too noisy, missed semantically similar wording.
Users
Internal — 40-lawyer corporate practice
Key flow
- 1Lawyer enters clause type or natural-language description
- 2System returns ranked precedents with side-by-side comparison
- 3Lawyer copies clause into draft, source is recorded
What I built
- Hybrid BM25 + dense retrieval over 8k contracts split into clauses
- Pinpoint citation — answer links back to exact paragraph and document
- Confidence-weighted ranking with deal-type and jurisdiction filters
- Audit log — every search and result archived for compliance
Limits
- Confidential matters are tagged and never returned to other practice groups
- No drafting — surfaces precedent but doesn't generate clauses
AI tools used
- LangChain
- Together AI
@niklas.berg
