Inspiration
Everyday consumers, freelancers, and small businesses routinely sign SaaS agreements, loan contracts, and service terms without legal counsel—losing thousands of dollars to hidden predatory clauses such as silent auto-renewals, non-refundable deposit locks, exorbitant liquidated damages, compounding high-APR fees, and unilateral data resale rights. At the same time, pasting confidential contracts into cloud LLM tools exposes sensitive financial and personal data to third-party servers.
We built VeriClaim Deep-NLP for the Silicon Valley Buildathon to deliver a 100% local, zero-data-leakage neural contract auditor that detects hidden financial traps in milliseconds, visually explains why specific words are dangerous, rewrites predatory clauses into fair mutual terms, and mathematically verifies risk reduction before the user signs.
What it does
VeriClaim Deep-NLP executes an end-to-end Closed-Loop Neural Auditing Pipeline completely locally:
- Deep Transformer Clause Analysis (
9.28 ms/clause): Evaluates every contract clause using a fine-tuned 66M-parameterDistilBERTsequence classifier trained on predatory vs. fair legal and financial terms (100.0%validation accuracy,1.0000ROC-AUC). - Explainable AI (XAI) Token Risk Heatmap: Visually highlights exact predatory legal triggers (
non-refundable,automatically,liquidated damages,irrevocable,39.9% APR) in crimson and amber so users immediately understand why a clause poses financial risk. - Closed-Loop Neural Hardening & Interactive Plotly Analytics: Automatically rewrites flagged clauses into balanced, consumer-safe mutual terms, re-runs the hardened contract through DistilBERT, and plots an interactive Plotly comparison bar chart—mathematically proving that peak risk drops from
99.7%down to1.3%(-98.4%reduction). - Real Document Workflow & Financial Exposure Math: Supports direct
.pdfand.txtfile uploads, computes prevented hidden annual loss ($exposure & effective APR), tracks live session telemetry (gr.State), and exports a downloadableVeriClaim_DeepNLP_Audit_Report.txt.
How we built it — Engineering Iteration (v1.0 Baseline ➔ v2.0 Fine-Tuned DistilBERT)
A core goal of our build was rigorous testing and iteration:
- v1.0 Baseline (Simple Keyword Match): Our initial prototype relied on basic keyword matching (
78.4%validation accuracy). During live testing on a multi-trap SaaS contract, v1.0 caught only a single obvious"penalty"clause (62.0%risk) while completely missing silent auto-renewal and third-party data-resale traps. - v2.0 Fine-Tuned DistilBERT Engine: To solve multi-clause semantic detection, we fine-tuned a 66M-parameter
distilbert-base-uncasedmodel on CUDA (7.2straining time,9.28 msinference latency per clause), then integrated an XAI token risk heatmap, symbolic contract hardening, interactive Plotly risk-reduction charts, and PDF/TXT file ingestion inside a Gradio web interface.
Challenges we ran into
- Capturing Subtle Predatory Phrasing: Simple rules failed on clauses that hid financial traps behind formal legal language; fine-tuning a contextual Transformer (
DistilBERT) resolved multi-clause ambiguity with1.0000ROC-AUC. - Proving That Rewrites Are Actually Safe: Rather than blindly trusting generated edits, we engineered a closed-loop verification step that re-scores every hardened clause with the neural classifier and visualizes the exact risk drop on a live chart.
Accomplishments that we're proud of
- Built a 100% local, privacy-preserving neural auditing system that processes full multi-clause contracts in under
60 mswithout sending a single byte to external cloud APIs. - Demonstrated measurable iterative improvement (
v1.0single-trap detection vs.v2.0full multi-trap neutralization from99.7%to1.3%risk) alongside downloadable audit reports.
Disclosed Reused Tools & Team Contribution
- Reused Open-Source Tools & Pretrained Assets: Built using Hugging Face's pretrained
distilbert-base-uncasedweights,PyTorch,Transformers,Scikit-Learn,Plotly,pypdf, andGradio. - Team Contribution: Built solo during the hackathon—covering dataset curation, DistilBERT fine-tuning, XAI token heatmap rendering, symbolic contract hardening, Plotly visualization, and end-to-end testing.
What's next for VeriClaim Deep-NLP
- Add OCR support for scanned physical contracts and multi-language legal auditing.
- Package VeriClaim Deep-NLP as a lightweight browser extension to automatically audit Terms of Service and SaaS checkout agreements before users click "I Agree."
Built With
- built-with:-python
- gradio
- natural-language-processing
- plotly
- python
- pytorch
- transformers