QWED-Legal
The Paralegal for AI-Powered Contract Review 🏛️When lawyers used ChatGPT and cited 6 fake court cases (Mata v. Avianca), QWED-Legal would have caught them before the $5,000 fine.
What is QWED-Legal?
QWED-Legal is a deterministic verification layer for AI-generated legal document analysis. It catches:- Date calculation errors (30 business days miscalculated)
- Contradictory clauses (Clause A says X, Clause B says Not X)
- Liability miscalculations (200% of 15M)
- Hallucinated citations (fake case names, invalid reporters)
The 6 Guards of Legal Verification
| Guard | Engine | Use Case |
|---|---|---|
| DeadlineGuard | python-dateutil + holidays | Business days, leap years, jurisdiction holidays |
| LiabilityGuard | Decimal + SymPy | Cap %, tiered liability, indemnity limits |
| ClauseGuard | Z3 SMT Solver | Contradiction detection, termination conflicts |
| CitationGuard | Regex + Bluebook | Case citations, reporter validation |
| JurisdictionGuard | Rule-based logic | Choice of law, forum selection, CISG |
| StatuteOfLimitationsGuard | Date calculations | Claim periods by jurisdiction |
Quick Example
Verify a Deadline Calculation
Verify a Legal Citation
Architecture
High-Level Flow
Guard Selection Flow
Audit Log: Real Hallucinations Caught
| Contract Input | LLM Claim | QWED Verdict |
|---|---|---|
| ”Net 30 Business Days from Dec 20” | Jan 19 | 🛑 BLOCKED (Actual: Feb 2) |
| “Liability Cap: 2x Fees ($50k)“ | $200,000 | 🛑 BLOCKED (Actual: $100,000) |
| “Seller may terminate with 30 days notice” + “Neither party may terminate before 90 days" | "Clauses are consistent” | 🛑 BLOCKED (Conflict detected) |
| “Smith v. Jones, 999 FAKE 123” | Valid citation | 🛑 BLOCKED (Unknown reporter) |
Why Not Just Trust the LLM?
LLMs are probabilistic. They can:- Hallucinate case citations (Mata v. Avianca scandal)
- Miscalculate business days (ignore holidays, weekends)
- Miss contradictory clauses (termination notice vs minimum term)
- Get percentage math wrong (200% of 15M)
| LLM Output | QWED Verification | Engine |
|---|---|---|
| ”Deadline is Feb 14” | Calculate business days | python-dateutil |
| ”Liability cap is $15M” | Decimal math | SymPy |
| ”Clauses are consistent” | Z3 satisfiability | Z3 SMT |
| ”Citation is valid” | Bluebook regex | Pattern matching |
Jurisdiction Support
DeadlineGuard supports jurisdiction-specific holidays:Next Steps
- The 6 Guards - Deep dive into each verification guard
- Examples - Real-world contract verification scenarios
- Troubleshooting - Common issues and solutions