All projects
Deduct AI preview
PrototypeVimarsh 5G Nationals · 3rd place

Deduct AI

An AI assistant for law enforcement that retrieves case evidence and suggests applicable legal sections from a crime scenario.

LLaMA-13BLangChainChroma DBFastAPIPyTorchYOLOOpenCVAWSFlutter
Problem

Field officers need fast, defensible suggestions for which legal sections apply to a scenario, plus a way to surface relevant evidence, without waiting on a slow manual legal search.

Solution

A retrieval-augmented assistant that indexes legal text in a vector store and pairs it with a computer-vision pipeline for evidence detection, exposed through a lightweight field-team app.

Contribution

Built the query-retrieval system over the legal-text vector store, trained the YOLO-based evidence detector on hand-labelled data, and deployed the inference endpoints.

AI Functionality

Retrieval-augmented generation over a legal-text vector store, with an LLaMA-13B model producing section suggestions grounded in retrieved passages.

Key Learning

Grounding a generative model in a retrieval layer made its suggestions far more reliable than prompting alone, and cheap enough to run on a modest AWS box.

Case Study

Deduct AI was built for the Vimarsh 5G Hackathon, a national initiative run by the Department of Telecommunications and IIT Madras, focused on applying emerging tech to public-sector problems.

Constraints
  • Had to run on modest, low-cost cloud infrastructure (AWS T2-micro) rather than GPU-backed inference servers.
  • Needed a field-usable client, not just a research notebook.
  • Legal suggestions needed to be traceable back to source text, not free-floating generative claims.
Proposed Solution

Split the problem in two: a retrieval-augmented language pipeline for legal-section suggestions grounded in an indexed corpus, and a separate computer-vision pipeline for evidence detection, unified behind one FastAPI service and a Flutter client.

Frontend Flow

The Flutter app collects a short scenario description and optional evidence photos, then submits both to the API and renders section suggestions and detected objects in a simple field-friendly layout.

Backend Flow

FastAPI receives the request, forwards text to the LangChain retrieval pipeline and images to the YOLO endpoint, then merges both results into a single response.

AI Workflow

The scenario text is embedded and matched against a Chroma-indexed corpus of legal text. The top passages are passed as context to LLaMA-13B, which produces a suggestion grounded in that retrieved text rather than relying on parametric memory alone. Evidence photos are handled separately by a YOLO model trained on hand-labelled data with LabelImg.

Technology Decisions
  • Chose retrieval-augmented generation over fine-tuning so the legal corpus could be updated without retraining the model.
  • Kept vision and language pipelines independent so either could be swapped without touching the other.
  • Used FastAPI for the gateway to get async I/O and simple request validation with minimal ceremony.
Challenges
  • Keeping inference latency reasonable on a T2-micro instance meant being deliberate about model size and batching.
  • Hand-labelling enough evidence photos for a usable detector was the slowest part of the project.
Trade-offs
  • A 13B parameter model is smaller and cheaper to host than larger alternatives, at some cost to suggestion nuance, which is a fair trade since the retrieval grounding does most of the heavy lifting anyway.
  • Optimized for a working field prototype over a fully productionized, horizontally-scaled service.
Outcome

The prototype placed 3rd at the Vimarsh 5G national finals, judged by the Department of Telecommunications and IIT Madras.

Lessons
  • Grounding generation in retrieval is a much bigger reliability lever than prompt tweaking alone.
  • Separating concerns between the vision and language pipelines made the system far easier to debug under deadline pressure.
Future Improvements
  • Add an evaluation harness to measure suggestion quality against a labelled set of scenarios.
  • Explore swapping the fixed retrieval step for a lightweight agent that can decide when to search versus answer directly.
System Architecture
Client

Flutter Field App

Server

FastAPI Gateway

scenario + photos
Server

FastAPI Gateway

AI

LangChain Retrieval Layer

text query
AI

LangChain Retrieval Layer

Data

Chroma Vector Store

similarity search
Data

Chroma Vector Store

AI

LLaMA-13B

retrieved context
AI

LLaMA-13B

Server

FastAPI Gateway

grounded suggestion
Server

FastAPI Gateway

AI

YOLO Evidence Detector

evidence photo
AI

YOLO Evidence Detector

Server

FastAPI Gateway

detected objects
Server

FastAPI Gateway

Server

AWS Deployment

Flutter Field App: Companion app used by the field team to submit a scenario and photos.

FastAPI Gateway: Single entry point that routes requests to the retrieval and vision pipelines.

LangChain Retrieval Layer: Embeds the query and retrieves relevant passages from the legal-text store.

Chroma Vector Store: Indexed embeddings of statutory text used for grounded retrieval.

LLaMA-13B: Generates section suggestions grounded in retrieved passages.

YOLO Evidence Detector: Object-detection model trained on hand-labelled evidence photos.

AWS Deployment: Hosts inference endpoints for both pipelines.