Inspiration

A rental lease can contain dozens of clauses that have real financial consequences: rent, deposits, notice periods, renewal terms, penalties, and additional fees. Yet for most people, reviewing a lease means manually searching through pages of dense legal text and hoping they did not miss something important.

AI makes summarizing these documents easy. But there is a deeper problem: how do you know the AI is telling the truth?

An LLM can produce a confident answer that sounds correct while being unsupported by the document. For a lease, that is not a small mistake — a wrong interpretation can affect someone's money, obligations, or decisions.

That question became the foundation of Redline:

Don't just ask AI for an answer. Make it show the evidence.

What We Built

Redline is an AI-powered lease analysis tool that extracts the information people actually care about — such as rent, deposits, notice periods, and potential red flags — while keeping every important result tied to the original document.

The core of Redline is its evidence-first verification pipeline.

Instead of:

Extract → Show the answer

Redline follows:

Extract → Verify → Show the answer with evidence

Every extracted claim is required to include an exact quote from the lease. Redline then performs two independent checks:

  1. Does the cited quote actually exist in the document?
  2. Does the quote actually support the claim?

Only information that passes both checks is presented as verified. If a claim cannot be reliably supported, Redline marks it for human review rather than silently presenting an uncertain answer as fact.

Verified results include the relevant page, and when the text can be located precisely, the interface highlights the supporting passage so users can inspect the evidence themselves.

How We Built It

Redline is built as a lightweight Flask application and deployed on Google Cloud Run.

The document-processing pipeline first extracts text from PDFs using PyMuPDF. When a page has little or no usable text, Redline falls back to Tesseract OCR so scanned leases can still be analyzed.

The complete document text is then passed to Gemini with a structured extraction schema covering important lease fields and potential red flags. Every generated claim must be accompanied by a source quote.

A separate Gemini verification step then evaluates whether the cited evidence actually supports the generated claim. This separation is intentional: the verification stage does not simply trust the first model response.

The resulting workflow is:

Lease PDF → Text/OCR Extraction → Gemini Analysis → Evidence Verification → Confidence Assessment → Evidence-backed Results

For production deployment, Redline runs on Google Cloud Run with request-based autoscaling. The Gemini API credential is managed through Google Cloud rather than being embedded in the application source code.

We also added automated tests for parsing, OCR fallback, and quote matching, along with a synthetic evaluation suite for extraction and verification behavior.

Challenges

One of the most useful bugs we encountered involved document preprocessing.

Our initial clause-splitting logic was being used to determine what text the AI received. On some document layouts, it separated a label from its value — for example, turning a line such as Monthly Rent $1,250 into only $1,250. The model could then lose the context needed to interpret the value correctly.

We fixed this by making the AI read the full raw document text, while keeping clause splitting strictly for display and page-tracking purposes. We also added a regression test to ensure the issue does not return.

Another challenge was the trade-off between speed and verification. Redline intentionally makes two sequential Gemini calls: one for extraction and another for independent verification. This adds several seconds to an analysis, but it gives us a stronger reliability model than simply displaying the first AI response.

We chose to prioritize traceability over superficial speed.

What We Learned

Building Redline changed how we think about AI products.

The difficult part is not simply getting an LLM to produce an answer. The difficult part is designing a system that knows when an answer is supported, when it is uncertain, and when a human should take over.

This led us to treat verification, uncertainty, and evidence as first-class components of the AI workflow, rather than treating the model's first response as the final result.

Our current evaluation contains five synthetic leases designed to test extraction and verification behavior. It achieved 10/10 accuracy on the tested rent and deposit fields and a zero false-confidence rate within that evaluation set. We intentionally do not present those results as proof of production-level accuracy at scale; they are a focused test of the verification logic.

That distinction is important to us. The goal of Redline is not to make AI appear infallible.

The goal is to make AI more trustworthy by making its answers inspectable.

Built With

Share this project:

Updates