Inspiration

Financial institutions lose billions annually to unexpected loan defaults. The problem? Covenant monitoring for syndicated loans is still done manually in spreadsheets. Loan agents at banks discover compliance issues weeks after they occurβ€”too late to prevent losses.

We built LoanGuard AI to answer one question: What if AI could predict loan problems before they happen?


Target Users & Loan Types

Who is this for:

  • Loan Agents at commercial banks managing syndicated loan portfolios
  • Credit Risk Officers monitoring covenant compliance
  • ESG Compliance Teams tracking sustainability-linked loans

What type of loans:

  • Syndicated Corporate Loans (not personal/consumer loans)
  • Facility amounts: $15M - $600M per loan
  • Loan types: Revolving Credit, Term Loans, NAV Facilities
  • Examples: Colgate-Palmolive ($50M), Airbnb ($118M), Autodesk ($106M)

Note: ML models trained on Lending Club data (720K loans) as proxy for syndicated loan breach prediction.


What it does

LoanGuard AI is a comprehensive AI-powered syndicated loan monitoring platform with 14 production pages, 4 ML models, 127 API endpoints, and real-time BigQuery integration (29 tables).


πŸ€– Machine Learning Models (4 Production Models)

Model Algorithm Training Data Performance
Breach Predictor LightGBM 720,966 Lending Club loans AUC: 0.7299
LGD Estimator Two-Stage LightGBM 148,000 loans MAE: 6.45%
Prepayment Risk XGBoost 200,000 loans + FRED rates AUC: 0.7809
ESG Risk Scorer XGBoost 11,000 companies Accuracy: 97.05%

Explainability: Every prediction includes SHAP waterfall charts showing exactly WHY the model made that prediction.


🎯 5-Agent AI Risk Committee

Powered by Gemini 2.5 Flash - Five specialized AI agents debate loan decisions:

  1. CreditRiskAssessor - Initial credit risk assessment using PD/LGD models
  2. ESGRiskAgent - ESG financial risk overlay per EBA 2026 guidelines
  3. MarketContextAgent - Sector and macroeconomic context analysis
  4. DevilsAdvocateAgent - Challenges approval decisions, identifies hidden risks
  5. SynthesizerAgent - Final consensus decision with audit trail

Features: Debate mode, PDF export, EU AI Act compliance badge


πŸ“ž Voice Alerts (ElevenLabs)

  • AI voice calls for urgent breach notifications
  • Natural-sounding voice generated by ElevenLabs
  • Real-time call initiation from the application
  • Test: /covenants β†’ By Loan β†’ RED loan β†’ "Call Risk Committee"

πŸ“„ Document Intelligence (Affinda AI)

  • Upload credit agreements (PDF, DOCX, TXT - max 50MB)
  • AI extracts covenants automatically
  • Creates new loan records in BigQuery
  • Fallback regex parser for edge cases

🌱 ESG & Sustainability

Carbon Tracking (Climatiq API): Real emissions calculator with DISER, DEFRA factors SLL Monitoring: SLL loans with KPI tracking, SPT achievement probability Greenwashing Detection: Google Search API with 4 verdict levels (VERIFIED, QUESTIONABLE, UNVERIFIED, CONTRADICTED)


πŸ“Š Portfolio Risk Analytics

Monte Carlo VaR: Single-factor Gaussian copula model with configurable simulations (1K-25K), VaR at 95%/99% confidence, CVaR

Stress Testing (12 Scenarios):

  • IFRS 9 Economic (4): Mild/Moderate/Severe Recession, 2008-Level Crisis
  • NGFS v5 Climate (4): Net Zero, Disorderly, Hot House, Current Policies
  • NGFS Short-Term (4): Disasters & Policy, Highway to Paris, Sudden Wake-Up, Diverging Realities

πŸ“§ Email & Export

  • SendGrid: Portfolio summary email
  • PDF Reports: Loan-level and portfolio-level
  • PPTX Export: Risk Committee presentation

🏦 Specialized Modules

Fund Finance: NAV facilities, LTV monitoring, ILPA July 2024 compliance Transition Loans: 5 TLP principles, carbon lock-in, DNSH screening Social Loans: 4 SLP components, 6 social categories


πŸ“± Complete Page List (14 Pages)

# Page Route Tabs/Features
1 Dashboard / 7 KPI cards, risk analytics, portfolio concentration
2 Loans /loans Loan list, search, filter, SLL badges
3 Loan Detail /loans/{id} 9 tabs: Overview, Covenants, ML, LGD, Prepayment, Velocity, Cure, Stress, ESG
4 Analytics /analytics 7 tabs: Overview, Advanced, Distribution, Sector, Macro, Climate, AI Committee
5 Upload /upload Affinda AI + fallback parser
6 Covenants /covenants 2 tabs: Portfolio Overview, By Loan
7 ESG /esg 3 tabs: Portfolio, By Loan, Carbon Tracking
8 SLL /sll 4 tabs: Portfolio, KPIs, SPTs, Margins
9 Fund Finance /fund-finance 3 tabs: NAV, Details, ILPA
10 Transition /transition-loans 4 tabs: Portfolio, TLP, Carbon Lock-in, DNSH
11 Social /social-loans 3 tabs: Portfolio, SLP Validation, Categories
12 Greenwashing /greenwashing Claim verification with 4 verdicts
13 Chat /chat AI assistant with suggestions
14 Alerts /alerts Alert list, acknowledge, mark all read

How we built it

Frontend: Next.js 15, React 19, Tailwind CSS, shadcn/ui β†’ Vercel Backend: Python 3.10, FastAPI, 127 endpoints β†’ Cloud Run Database: Google BigQuery (29 tables) ML Models: LightGBM, XGBoost with SHAP explainers


APIs Integrated (7)

API Purpose
Gemini 2.5 Flash 5-agent Risk Committee
Affinda AI Document parsing
ElevenLabs Voice alerts
Climatiq Carbon calculations
FRED Macroeconomic data
SendGrid Email notifications
Google Custom Search Greenwashing detection

Challenges we ran into

  1. Training on 720K real loans required careful preprocessing
  2. SHAP optimization for <2 second response times
  3. Multi-agent coordination for constructive debate
  4. Voice UX different from text interfaces

Accomplishments that we're proud of

  1. Multi-Agent AI Debate: First loan assessment system with adversarial AI review using 5 specialized agents
  2. Explainable ML: SHAP waterfall charts for every prediction - full transparency
  3. Real-Time Voice Alerts: ElevenLabs AI calls Risk Committee for urgent breaches
  4. Greenwashing Detection: Cross-references ESG claims with real news sources
  5. Production-Ready: Fully deployed on Vercel + Cloud Run with real BigQuery data
  6. 127 API Endpoints: Comprehensive REST API for all loan management operations
  7. 12 Stress Test Scenarios: IFRS 9, NGFS v5 Climate, and NGFS Short-Term scenarios

What we learned

  • Explainability matters as much as accuracy
  • Multi-agent systems need orchestration
  • Real deployment teaches more than local development

What's next for LoanGuard AI

  • Multi-agent memory across sessions
  • Core banking system integration APIs
  • Mobile app for real-time alerts

Built With

  • affinda
  • bigquery
  • climatiq
  • fastapi
  • fred-api
  • gemini-2.0
  • google-cloud-run
  • lightgbm
  • next.js
  • python
  • react
  • shap
  • tailwind-css
  • xgboost
Share this project:

Updates