Inspiration

In the high-stakes world of corporate finance, a single "find and replace" error in a 200-page credit agreement can lead to millions of dollars in legal fees or missed interest payments. During the massive industry-wide transition from LIBOR to SOFR, deal teams were forced to manually verify thousands of amendments. We were inspired by the concept of CI/CD in software engineering: Why can't we have a "build pipeline" for debt? Why can't we block an amendment from "merging" into a conformed agreement if it fails a suite of stakeholder tests?

What it does

LoanBuild Gate is an evidence-based safety gate for debt transitions. It pulls live credit agreements and amendments from SEC EDGAR and runs them through a multi-stage verification pipeline:

  • LLM-Assisted Extraction: It identifies complex legal clauses like "Benchmark Replacement Settings" and "Conforming Changes."
  • Deterministic Verification: It refuses to trust the LLM blindly. Every extraction must be confirmed by a secondary, rule-based engine that finds exact "provenance anchors" in the text.
  • Rule Pack Testing: It runs stakeholder-specific tests (Lender, Borrower, Trading Desk) to ensure the SOFR transition is compliant.
  • Safety Halt: The system intentionally blocks the synthesis of a conformed document if the "patch coverage" is incomplete—preventing the system from ever "guessing" at a legal document.

How we built it

We built LoanBuild Gate with a focus on "bank-grade" precision and auditability:

  • Backend: FastAPI and Python orchestrate the extraction and testing logic.
  • AI Layer: OpenAI's gpt-4o-mini acts as our "Candidate Scout," identifying the needle in the haystack of 200,000+ characters of legal text.
  • Deterministic Engine: A custom Python engine verifies the LLM's work, ensuring every claim links back to a specific line number.
  • Frontend: A React-based dashboard provides a high-fidelity "Key Terms Comparison" and a "Build Summary" similar to a GitHub Actions report.
  • Data Pipeline: Real-time integration with the SEC EDGAR system to fetch authentic public filings.

Challenges we ran into

The biggest challenge was LLM hallucination in legal contexts. Initial tests showed that LLMs often "hallucinate" conforming changes that aren't actually present or get section numbers slightly wrong. We resolved this by shifting the LLM's role: instead of being the "Judge," the LLM became the "Witness." Its suggestions are now strictly verified by our deterministic engine. If the anchor isn't there, the test fails—no matter how confident the LLM is.

Accomplishments that we're proud of

  • The "Safety Gate" Philosophy: We are proud of building a generator that refuses to generate. Most AI apps try to force an answer; LoanBuild Gate is designed to say "BUILD BLOCKED" when it isn't 100% sure, which is the only acceptable behavior for institutional finance.
  • Real-Time Provenance: Every "PASS" on our dashboard is a clickable link. Clicking a verified term takes the user directly to the exact text in the SEC filing.
  • Stakeholder Personas: Implementing different rule packs that allow a Borrower and a Lender to view the same amendment through their own "verification lens."

What we learned

We learned that in highly regulated industries, traceability is more important than creativity. We shifted our architectural focus from "Generative AI" to "Verifiable AI." This move away from "LLM vibes" toward a hybrid deterministic model proved much more defensible for legal use cases.

What's next for LoanBuild Gate

  • Multi-Document Graphs: Linking entire families of credit documents (Baselines, Incremental Amendments, Security Agreements) into a single dependency graph.
  • Agentic Remediation: Allowing users to suggest "fixes" for blocked patches that the agent can then verify and apply.
  • On-Prem Deployment: Optimizing the stack for local LLMs (like Llama 3) to handle private, non-public credit agreements within a bank's firewall.

Built With

  • api
  • beautifulsoup4
  • edgar
  • fastapi
  • git
  • github
  • gpt-4o-mini
  • mermaid.js
  • openai
  • pdfplumber
  • python
  • react
  • sec
  • uv
  • uvicorn
  • vite
Share this project:

Updates