FinePrint: AI Legal Risk Detector

About The Project

You've seen the notification: "We updated our Terms of Service" or "This is our privacy policy". And when you open it to have a glance, you realize that the average ToS is 5,000+ words. At 250 words/minute, that's 20+ minutes to read. In this fast-moving world, nobody has time to read thousands of words or large number of pages. Hence, we ignore it or just agree to it with a 5-second read.

What we don't realize is that with a simple click of "agree" to the terms of companies or organizations, we are essentially selling our own private data around the world. According to a 2024 study, 68% of Terms of Service contain clauses allowing companies to sell or share your personal data with third parties without explicit consent. Meanwhile, data breaches expose millions of records annually—often because of overly broad data access clauses buried in fine print.

But again, the question is: who has the time to read a document of 500 pages? Nobody. And every application and organization has privacy policies which may have hundreds of risks. Do we stop using them?

That's where FinePrint steps in. It is an AI-powered application that allows you to paste any legal document and it will address this problem. It can read those 500+ pages of legal documents and contracts and surface all the risks involved and how critical they are. It provides users with different defense strategies to avoid getting your data breached. It also features the ability to compare the legal documents of more than two organizations or applications and provides results on which is the safest to use.

Inspiration

The idea of creating FinePrint came from one of the applications that I use in my daily life. It used to change its privacy policies frequently, and whenever I try to read them, they had millions of words and hundreds of pages. Do you think many companies deliberately make their policies and terms of use quite lengthy? Well, that's what I thought. Hence, it brought me to create this application that could help not only me but many people facing the same problem.

My Learnings

During the process and after the creation of my application, I have learned quite a few things:

  • People don't read legal documents — Not because they're lazy, but because they're designed to be unreadable. This is intentional. Most people don't realize how much data they're giving away with an "Accept" button. Any chatbot/AI can tell how critical the problem is, but FinePrint gives away the solution along with it.

  • Model selection matters — Different LLMs have different strengths (speed vs. quality). Llama 70B is more efficient but slower; Qwen is faster but less detailed. Getting the model to output valid JSON consistently requires careful prompt design. When one model fails (cold start, rate limit, timeout), having a backup strategy keeps your app alive.

  • Backend API design and Frontend-backend communication — How to structure /api/analyze endpoint, handle errors gracefully, return consistent JSON responses. Fetching API, error handling, timeouts, AbortController for cancellations.

Building of FinePrint

I chose a full-stack web approach: a Flask backend handling AI analysis, and a React frontend to provide a beautiful and responsive interface. This separation let me iterate on the UI independently while experimenting with different LLM models on the backend.

The heart of FinePrint is a 3-model fallback chain using Hugging Face's Router API:

  • Llama 3.3-70B for nuanced legal analysis (most capable)
  • Qwen 2.5-72B as backup (nearly as good, faster)
  • Qwen 2.5-7B as final fallback (smaller, but still functional)

The API accepts raw document text and returns structured JSON: a risk score (0–100), a TL;DR summary, and an array of red flags with severity levels and defense strategies. To handle LLM output unreliability, I implemented three-tier JSON parsing: parse directly, strip markdown fences, then use regex extraction as a last resort.

I built the UI in React with Vite and Tailwind CSS because I wanted fast development cycles and a modern dark-theme aesthetic. Legal documents are intimidating; the UI needed to feel approachable and interesting to users.

FinePrint analyzes documents in under 30 seconds with high reliability, even under load. The combination of smart fallbacks, honest error communication, and thoughtful UX makes legal document analysis accessible to anyone—no law degree required.

Challenges while Building

  • Hugging Face Serverless Endpoints — Hugging Face serverless endpoints return 503 errors during model warm-up. Free tier has rate limits, which made it frustrating to wait while the model warms up. To tackle this issue, I built a 3-model fallback chain with exponential backoff retry logic. If Llama times out, automatically try Qwen 72B, then Qwen 7B.

  • Testing with Diverse Legal Documents — It was hard to test with diverse legal documents. I couldn't just use dummy data—legal language is complex and specific. I manually tested with real ToS from major companies (Amazon, TikTok, etc.), found patterns, and built test cases around them.

  • Communicating Uncertainty — How do you tell users "This is risky" without claiming false certainty? One wrong score can mislead someone into signing a bad contract. I created a heuristic-based confidence score (capped at 97%, never 100%) that combines flag count, severity, and document length. Users can now trust the results based on the uncertainty.

  • Improving User Experience — Plain text like "this is highly risk" or "this is risky but quite low" made the UI feel boring. Therefore, I worked on improving the UI by using color-coded risk levels (red/amber/green) for quick scanning.

Conclusion

When you read about this application and how it works, you might think: why couldn't any other AI/LLM do the same work instead of relying on one specific application for it? That's where prompt engineering comes into play. Every time—whether explaining the AI to get detailed results, comparing two legal documents, or showing the critical levels of a ToS or privacy policy—is way too time-consuming.

FinePrint can be used in these instances where a user can get the risks involved, understand how critical the risk is, and determine which company to choose from while comparing their policies and terms. FinePrint gives consumers the power to understand what they're signing—and that changes everything.


Built With

Share this project:

Updates

Submission history