Inspiration

Sensitive contracts shouldn’t leave the company network, yet most AI tools are cloud‑based and opaque Legal teams need answers they can trust, with exact source citations We wanted an offline, transparent system that’s easy to adapt to specific contract types Fine‑tuning should be lightweight (LoRA) and demonstrably improve domain accuracy Build something practical: fast setup, clear UI, and production‑ready code

What it does

Analyzes contracts entirely on‑device using GPT‑OSS models (via Ollama) Returns answers with exact source quotes and document references Supports multiple documents and cross‑document reasoning Offers optional LoRA fine‑tuning for domain‑specific improvements Simple web UI: ingest → ask → see cited answers → fine‑tune → compare Privacy‑first: no data leaves your machine by default

How we built it

Backend: NestJS API (ingest, retrieval, synthesis, fine‑tuning orchestration) Frontend: Next.js app for upload, queries, results, and FT controls Retrieval: chunking, embeddings, and vector search; contexts fed to the model Models: GPT‑OSS via Ollama (local inference); dev with smaller models for speed Fine‑tuning: LoRA adapters; togglable at query time to compare improvements Architecture: offline‑first, CORS‑enabled API, clean monorepo with shared packages

Challenges we ran into

Hitting good latency/quality tradeoffs with fully local inference Aligning citations precisely to quoted spans without over‑truncation Prompt stability across model sizes and different contract formats Designing a UI that’s simple for demos but flexible for experts Creating a fine‑tuning demo that shows clear, measurable gains

Accomplishments that we're proud of

End‑to‑end offline analysis flow with transparent, clickable citations Clean UX for ingesting documents and comparing FT vs. baseline answers Modular retrieval stack and prompt templates for legal scenarios LoRA fine‑tuning path that improves precision on target clauses Well‑documented monorepo with quickstart and demo scripts

What we learned

Strong retrieval beats just scaling model size for contract Q&A Local inference is viable for privacy‑critical legal workflows Transparent citations materially increase user trust and adoption Even small LoRA adapters can yield meaningful domain improvements Clear guardrails and evaluation are key to productionizing LLM features

What's next for Proof Sense Agent

Full fine‑tuning on larger legal datasets and rigorous evaluation Better citation alignment, confidence scoring, and de‑duplication PDF ingestion with OCR and layout‑aware chunking Structured outputs (risk summaries, clause diffs, compliance reports) Enterprise deployment profiles (SSO, audit logs, policies) Hardware acceleration, quantization presets, and streaming responses

Built With

  • gpt?oss
  • groq
  • nestjs
  • next.js
  • ollama
  • rag
Share this project:

Updates