Comprehensive Open-Source Solution for Leveraged Buyout Financial Modeling
The LBO Model Generator is a Python project that wraps a deterministic LBO spreadsheet-style engine (exportable Excel, validation, dashboards) with optional LLM-guided UX layered on separately. Outputs still require qualified professional review—it is aimed at speeding structured analysis, not replacing investment judgment.
Key Capabilities:
- ⚡ Automated Model Generation: Generate professional LBO models programmatically instead of assembling Excel entirely by hand
- ⚡ Deterministic Core: Financial engine, validation, and Excel export live in the installable
lbo_corepackage (pandas/numpy/openpyxl)—runs with or without any LLM features - 🎯 Professional Quality Output: Built-in assumption checks and industry-style Excel layouts
- 🤖 Optional AI Layer: Legacy guidance features plus a tool-grounded Streamlit Copilot (schemas + deterministic tools backed by
lbo_ai; requires API key configured for your provider—see warnings below) - 📊 Institutional-Style Formatting: Excel workbooks tuned for readability and standard LBO sections
- 🔄 Multiple Entry Points: Multi-page Streamlit dashboard (root
app.py/pages//streamlit_modules/); CLI viarun.pyorlbo-generate(pip install -e .); optional RESTapps/api; optional MCP bridgeapps/mcpfor agents
- Repository layout — where core, AI, APIs, and Streamlit live
- Architecture ADR — AI-era split and tool-grounded patterns
- Import conventions —
lbo_core/lbo_ai, PYTHONPATH vs editable install - Contributing and Security policy
Deal Screening & Evaluation
- Rapid initial assessment of potential acquisition targets
- Sensitivity analysis on key value drivers (revenue growth, margins, multiples)
- AI-assisted benchmarking guidance (not live market data; see limitations)
Single-Deal Modeling
- Evaluate entry, operations, and exit assumptions for one deal at a time
- Model debt paydown and returns across supported debt structures
- Test sensitivity and break-even thresholds
Operational Efficiency
- Standardize modeling processes across deal teams
- Accelerate model generation compared to manual Excel construction
- Streamline workflow with automated calculations
- Enable analysts to generate models more efficiently (models require professional review)
Pitch Book Development
- Generate professional Excel models for client presentations
- Rapid model generation for competitive situations
- Customizable formatting aligned with firm brand standards
- Export-ready outputs suitable for board presentations
Transaction Advisory
- Support both buy-side and sell-side engagements
- Early-stage valuation and structure analysis
- Debt restructuring and refinancing analysis
- Strategic planning and long-term financial projections
Code Quality Metrics
- ✅
lbo_core/lbo_aisplit — Deterministic modeling separated from schemas, providers, copilot tooling, and optional LLM calls (ADR) - ✅ Continuous integration — Pytest (+ coverage thresholds on core packages), Black, Flake8 (see .github/workflows/ci.yml)
- ✅ Type hints & structure — Typing improves along core paths; large legacy modules coexist with clearer package boundaries (see
docs/REPOSITORY_LAYOUT.md) - ✅ Error Handling — Custom exceptions and validation helpers surfaced to CLI/Streamlit
- ✅ Structured Logging — Logging helpers in the deterministic core path
⚠️ Test coverage — Improving; CI enforces coverage onlbo_coreandlbo_ai(see Testing & Validation); full-repo coverage targets remain a goal
Model Validation & Quality Assurance
- Real-time assumption validation with industry-appropriate checks
- Financial statement reconciliation (balance sheet balancing, cash flow validation)
- Cross-statement consistency verification
- Debt structure validation (leverage ratios, interest coverage)
- Excel output integrity checking
10 Integrated AI Capabilities (OpenAI-powered, guidance-oriented)
- Intelligent Model Validation - Validates assumptions for realism, consistency, and market appropriateness
- Automated Quality Review - Reviews generated Excel models for errors and inconsistencies
- Scenario Generation - Generates draft scenario ideas and what-if directions
- Natural Language Queries - Ask questions about your model in plain English ("Why is the IRR 15%?")
- Market Benchmarking - Provides LLM-based benchmark guidance (not live market feeds)
- Documentation Generation - Auto-generates model documentation and executive summaries
- Error Diagnosis - AI-powered debugging with root cause analysis and fix suggestions
- Optimization Recommendations - Suggests optimal debt/equity structures and deal improvements
- Prompt Enhancement - Enhances business descriptions with missing context
- Contextual Guidance - Real-time help explaining fields, suggesting values, warning about mistakes
Important Notes:
- AI features require OpenAI API key and send data to OpenAI servers
- All AI recommendations require validation by qualified finance professionals
- Do NOT use AI features with confidential deal information subject to NDAs
- AI features are optional - tool functions fully without AI
Industry-Standard Formatting
- Professional cover page and executive summary
- Color-coded cells (blue=inputs, black=calculations, green=outputs)
- Interactive formulas that recalculate with input changes
- Protected formula cells to prevent accidental modification
- Navigation hyperlinks between sheets
- Dynamic sensitivity charts and visualizations
Comprehensive Financial Statements
- Income Statement (5-year projection)
- Balance Sheet with working capital detail
- Cash Flow Statement (operating, investing, financing)
- Multi-instrument Debt Schedule with cash flow sweep
- Returns Analysis (IRR, MOIC) with sensitivity tables
- Sources & Uses of Funds
Multiple Debt Structures
- Senior + Subordinated debt combinations
- Bullet, amortizing, and cash flow sweep schedules
- Interest rate optimization
- Debt capacity analysis
Modern, User-Friendly Interface
- Multi-page navigation (Dashboard, Assumptions, Analysis, Copilot, Help)
- Copilot calls deterministic tools (e.g. quick LBO run, assumption validation via Pydantic-shaped payloads)—inspect tool trace / citations in the UI rather than trusting prose alone
- Real-time model calculation and visualization
- Interactive sensitivity analysis with tornado charts
- Enhanced visualizations:
- Equity waterfall charts
- Returns attribution analysis
- Financial statement trend analysis
- Excel and PDF export capabilities
- Configuration import/export (JSON)
Key Benefits:
- No Excel expertise required - intuitive point-and-click interface
- Instant feedback on assumption reasonableness
- Browser-based access for quick review and iteration
Automation & Integration Ready
- JSON-based configuration files for batch processing
- Template generation for standardized inputs
- Interactive mode for guided model creation
- AI-powered parameter recommendations from business descriptions
- Integration-ready for workflow automation
Use Cases:
- Automated model generation from CRM systems
- Batch processing of multiple deal scenarios
- Integration with internal financial systems
- Scheduled reporting and monitoring
Python packages (pip install -e .)
- Import
lbo_corefor deterministic modeling and Excel pipelines - Import
lbo_aifor schemas (pydantic), copilot/agent helpers, providers, redaction helpers, and legacy validator interfaces - Top-level shim modules under
src/preserve older dotted import paths (docs/development/IMPORTS.md)
Optional HTTP & agents
apps/api: minimal FastAPI service for synchronous copilot-style completion (extras:pip install '.[api]'; OpenAI-compatible env vars documented in repo)apps/mcp: MCP server exposing deterministic tool calls for external agent clients (pip install '.[mcp]')
| Area | Purpose |
|---|---|
src/lbo_core/ |
Deterministic modeling, validation, Excel export—no mandatory LLM dependency inside this tree |
src/lbo_ai/ |
Pydantic schemas, copilot orchestration/tool dispatch, provider routing (OpenAI-compatible), telemetry hooks, legacy AI validators/recommenders |
src/ façade *.py |
Thin backward-compatible imports (for example lbo_engine.py re-exporting lbo_core); prefer lbo_core / lbo_ai in new code |
Root Streamlit (app.py, pages/, streamlit_modules/) |
Primary analyst UI; configuration bootstraps src/ onto sys.path when Streamlit loads pages standalone |
apps/api, apps/mcp |
Optional services (FastAPI HTTP, MCP stdio) layering on lbo_ai tool dispatch backed by lbo_core |
tests/, docs/ |
Pytest suites, guides, ADRs, archived audit notes |
For a fuller map see docs/REPOSITORY_LAYOUT.md.
Technology stack
- Language: Python 3.8+ (CI runs 3.8–3.12)
- Core: pandas, numpy
- Excel: openpyxl
- Web: Streamlit, Plotly
- Schema / tool I/O: pydantic v2
- Optional HTTP: FastAPI / uvicorn (extras
[api]) - Optional agents: mcp (extras
[mcp]) - LLM clients: OpenAI-compatible SDK (provider/base URL configurable for copilot features)
Deterministic lbo_core results are authoritative for modeled returns and statements. lbo_ai adds structured tool calls, adapters, optional guidance validators, and the Streamlit Copilot flow—explicitly biased toward invoking lbo_core for quantitative outputs rather than free-form IRR/MOIC claims.
Black and Flake8 scope matches .github/workflows/ci.yml; optional pre-commit mirrors the same flake8 blacklist. Contributions should run make lint / make format locally when possible (CONTRIBUTING.md).
CRITICAL: Read this section before enabling AI features.
AI / copilot features transmit prompts, context, and structured tool payloads over HTTPS to whichever OpenAI-compatible endpoint you configure (project env vars). The default settings target OpenAI's public API unless you change base URL / keys. Assume all outbound model traffic is sensitive until you classify it for your environment.
Representative payloads can include:
- Company names and financial data- Deal structures and pricing information
- Proprietary assumptions and scenarios
- Business descriptions and industry information
Do NOT use AI features with:
- Confidential deal information subject to NDAs
- Material non-public information (MNPI)
- Proprietary firm methodologies or trade secrets
- Client data without explicit consent and legal review
- Information that violates data privacy regulations (GDPR, CCPA, etc.)
Legal Implications:
- May violate most non-disclosure agreements (NDAs)
- Potential insider trading implications if MNPI is shared
- Regulatory compliance issues (SEC, FINRA, etc.)
- Intellectual property theft risk
- Data residency and sovereignty concerns
AI recommendations are not a substitute for professional judgment:
- AI recommendations are based on LLM training data and may not reflect current market conditions
- AI can generate plausible but incorrect financial assumptions
- AI may misunderstand financial concepts or context
- AI-generated scenarios may not follow industry conventions or firm standards
- All AI-generated content requires validation by qualified finance professionals
Recommended Use:
- Educational purposes and learning
- Preliminary analysis and exploration
- Initial assumption generation (to be reviewed)
- Non-confidential deal analysis
Professional Validation Required: Always validate AI recommendations with:
- Qualified CPAs or CFAs
- Industry experts familiar with your sector
- Your firm's standard methodologies
- Independent market research and benchmarking
The tool functions fully without AI features. Simply do not set the OPENAI_API_KEY environment variable, and all AI functionality will be disabled.
Industries:
- Validated for: Software/SaaS, Healthcare, Manufacturing, Business Services
- Other industries may require assumption adjustments and validation
- Industry-specific validation rules are limited
Deal Size:
- Tested for $10M-$500M enterprise value
- Larger deals (>$500M) may require validation
- Very large deals (>$1B) have not been extensively tested
Debt Structures:
- Supports up to 3 debt tranches (senior + subordinated combinations)
- Complex structures have limited support:
- PIK (Payment-in-Kind) debt: Not fully supported
- Mezzanine debt with warrants: Limited support
- Asset-based lending (ABL): Basic support only
- Revolving credit facilities: Basic support only
Projection Period:
- Standard 5-year projection period
- Longer projection periods may require validation
Accuracy & Validation:
- AI recommendations should be reviewed by finance professionals
- Not a substitute for human judgment or expert analysis
- AI-generated scenarios require manual validation before use
- No guarantee of accuracy or market appropriateness
Data Sources:
- Market benchmarking uses LLM training data (not real-time market data)
- No integration with Bloomberg, Pitchbook, or S&P Capital IQ
- Industry standards may be outdated or general approximations
Capabilities:
- AI features are experimental and continuously improving
- Some features may produce unexpected results
- AI recommendations may not align with firm-specific methodologies
Testing & Validation:
- No formal validation by external CPAs or investment banks
- Users responsible for model verification and formula validation
- Test coverage is incomplete (see Testing & Validation)
Compliance:
- Not certified for regulatory filings (SEC, FINRA, etc.)
- Not audited for SOX compliance
- Consult legal counsel before regulatory use
- Not validated for use in investor communications or disclosures
Support:
- Community support only (via GitHub Issues)
- No SLA or guaranteed response times
- No professional support or consulting services
- No warranty or guarantee of fitness for purpose
Performance:
- Benchmarks not yet established
- Performance varies with model complexity
- Large models may experience slower calculation times
- Memory usage increases with model complexity
Formatting:
- Excel output follows general investment banking conventions
- Not validated against specific investment bank templates
- Formatting may differ from firm-specific standards
Validation:
- Excel formulas have not been externally audited
- Users should validate critical calculations independently
- Some edge cases may not be handled correctly
Deployment:
- Single-user desktop application design
- Not designed for high-concurrency environments
- Web dashboard runs on single server/instance
- No built-in user authentication or access controls
Data Storage:
- No built-in database or persistence layer
- Models must be exported to Excel for storage
- Configuration stored in JSON files
Scalability:
- Designed for typical LBO modeling workflows
- May struggle with extremely complex multi-asset portfolios
- Batch processing capabilities are limited
Test Coverage:
- CI enforcement: Pull requests run pytest on Python 3.8–3.12 with
pytest-cov, enforcing a minimum aggregate coverage threshold onlbo_coreandlbo_ai(see.github/workflows/ci.yml— currently--cov-fail-underfor those subtrees). - Scope: Automated tests emphasize deterministic engine behavior, AI schema/tool routing, redaction helpers, and select integration paths; broader UI and Excel edge-case coverage continues to expand.
- What this is not: Full actuarial sign-off—users remain responsible for formula review (see caveats elsewhere in this README).
Formula Validation:
- Core financial calculations tested with sample data
- Status: Limited validation, not externally audited
- Recommendation: Validate all formulas against known LBO models before use
Integration Tests:
- Streamlit-heavy flows rely more on manual and targeted scripts than exhaustive browser automation today
- Excel export exercised through generation paths rather than standalone formula audit harnesses
Financial Accuracy:
- Formulas based on standard LBO modeling practices
- Validation Methodology: Internal testing with sample scenarios
- External Validation: None - users responsible for verification
- Recommendation: Have qualified CPAs/CFAs review formulas for your use case
Edge Cases:
- Very high leverage ratios (>8x) may produce unexpected results
- Negative cash flow scenarios need additional testing
- Rapid growth scenarios (>50% YoY) may have calculation issues
- Multi-currency scenarios not fully supported
Performance:
- Large models (>$1B EV) may be slow
- Complex debt structures with multiple tranches may have calculation delays
- Excel export for very large models may be slow
Documentation:
- Some advanced features lack comprehensive documentation
- API documentation is incomplete
- Example use cases are limited
How Formulas Were Verified:
- Based on standard LBO modeling textbooks and industry best practices
- Internal testing with known scenarios
- Cross-validation against simplified manual calculations
- No external third-party validation
Test Cases:
- Sample company scenarios across different industries
- Various debt structures (senior, subordinated, combinations)
- Different growth and margin profiles
- Exit multiple and timing scenarios
Recommendations for Users:
- Test with your specific deal structures before production use
- Validate outputs against manually calculated reference models
- Have qualified professionals review critical calculations
- Report any discrepancies or errors via GitHub Issues
Model Generation:
- Standard LBO (~$100M EV, 5-year projection): ~2-5 seconds
- Complex LBO (multiple debt tranches): ~5-10 seconds
- Large models (>$500M EV): ~10-20 seconds
Excel Export:
- Standard model: ~3-8 seconds
- Complex model with multiple sheets: ~10-15 seconds
- Large models: ~15-30 seconds
Memory Usage:
- Typical model: ~50-100 MB
- Large models: ~100-200 MB
- Peak usage during Excel export: ~200-300 MB
AI Features (when enabled):
- Single AI recommendation: +2-5 seconds
- Scenario generation: +5-10 seconds
- Model validation: +3-7 seconds
- Note: API response times vary with OpenAI service availability
Maximum Deal Size:
- Tested up to $500M enterprise value
- Larger deals may work but not extensively tested
Maximum Projection Period:
- Standard: 5 years
- Longer periods possible but not validated
Maximum Debt Tranches:
- Tested with up to 3 tranches
- More tranches may work but complexity increases
Concurrent Users:
- Single-user design
- Web dashboard supports one active session per instance
- Multiple users require separate instances
Comprehensive benchmarks pending. Performance characteristics based on limited testing. Your performance may vary based on:
- Hardware specifications
- Model complexity
- Network conditions (for AI features)
- Python version and installed packages
Clone the repo (upstream name LBO-Model-Generator) or your fork, enter the directory, install dependencies:
cd LBO-Model-Generator
# Runtime dependencies only
pip install -r requirements.txt
# Recommended for developers / reliable imports (`lbo_core`, `lbo_ai`)
pip install -e .
# Optional: OpenAI-compatible API key (AI + Copilot)
export OPENAI_API_KEY='your-api-key-here'Imports and PYTHONPATH nuances are spelled out in docs/development/IMPORTS.md.
# Launch interactive web dashboard
streamlit run app.pyDashboard features include:
- Interactive assumption configuration
- Real-time validation and feedback
- Sensitivity and break-even tooling
- Visualizations (waterfall-style equity path, attribution, tornado views where enabled)
- Excel and PDF export
- Legacy AI panels plus the Copilot page (tool-grounded, with trace/citations)—requires API configuration
See Streamlit Dashboard Guide for detailed instructions.
After pip install -e ., the packaged entry point lbo-generate exposes the generator CLI (lbo-generate --help). You can alternatively invoke the repository helper run.py (same flags as before):
# Equivalent examples — pick one invocation style:
lbo-generate --template
lbo-generate --input examples/lbo_input_template.json --output output/my_model.xlsx
python run.py --interactive
python run.py --ai-description "SaaS software company with $10M revenue" --ai-industry "Software"Extras are declared in pyproject.toml:
pip install '.[api]'
pip install '.[mcp]'apps/api is a small FastAPI shim for synchronous completions; apps/mcp exposes deterministic tools via the MCP protocol. Use uvicorn (or equivalent) for real deployments, not informal python apps/api/main.py invocations alone.
# Run interactive test with minimal input - AI fills in the rest
python3 interactive_test.pyThis tool allows you to:
- Provide minimal company information (or none)
- Let AI generate missing details based on industry context
- Test the LBO model generator with zero upfront configuration
- Get AI-powered recommendations for deal structuring
See Interactive Test Guide for detailed instructions.
Minimum Requirements:
- Python 3.8 or higher (tested on 3.8-3.12)
- 4GB RAM (8GB recommended for large models)
- Standard Python scientific computing stack
Core Dependencies:
- pandas>=2.0.0 (data manipulation)
- numpy>=1.24.0 (numerical calculations)
- openpyxl>=3.1.0 (Excel export)
Libraries most users touch:
- pydantic (included in
requirements.txt) — validates tool payloads and schemas inlbo_ai - streamlit, plotly, reportlab (dashboard + charts + PDF export)
- openai (compatible clients for legacy guidance streams and copilot adapters)
Optional extras (CLI pip install '.[extra]'):
- api → FastAPI, Uvicorn
- mcp → official
mcpPython package for MCP stdio bridging
See requirements.txt for complete dependency list.
- Standard Python application - runs on any server/workstation with Python 3.8+
- No external service dependencies when AI features are disabled
- Data remains within your infrastructure (unless AI features enabled)
- Users responsible for security and compliance configuration
- No built-in authentication or access controls
- Python application can be containerized with Docker (Dockerfile not provided)
- Stateless design suitable for containerization
- Integration with cloud storage possible for model persistence
- API gateway integration possible for secure access
- Note: This is a single-user desktop application by design. Horizontal scaling may not provide benefits for typical LBO modeling workflows.
- Web dashboard on an internal workstation or server (Streamlit)
- CLI on analyst machines (
run.py,lbo-generate) - Models exported to Excel for archiving (no first-class database persistence)
- Optional AI through OpenAI-compatible HTTP endpoints (configure provider + routing env vars—see codebase env docs before production)
- Optional sidecars
apps/api,apps/mcpcall the same deterministic stack as Streamlit—not a redesigned backend product
User Guides:
- Streamlit Dashboard Guide - Complete web interface documentation
- Quick Start Guide - Getting started in minutes
- Interactive Test Guide - Zero-configuration testing
- API Key Setup - AI features configuration
Technical Documentation:
- Repository layout — authoritative map of
lbo_core,lbo_ai, apps, Streamlit - Import conventions —
PYTHONPATHvs editable installs - Architecture ADR — design decisions
- LBO Generator Guide — core functionality reference
- AI Integration Guide — AI features deep dive
- AI Validator Guide — validation capabilities
- Project Structure — supplemental layout notes (may overlap layout doc)
Application Use Cases:
- Use Cases & Applications - Industry-specific examples
- PEP-8 Compliance Report 2025 - Code quality metrics
- Code Quality Standards - Development guidelines
License: Apache License 2.0
Compliance Considerations:
- Open-source license enables internal use without restrictions
- No external data transmission when AI features are disabled
- AI / copilot features send traffic to whichever LLM API you configure - See AI Features Warning
- Full auditability of calculations and logic (open source code)
- Not certified for regulatory filings - Users responsible for compliance verification
- Not validated by external auditors - Users must validate formulas for regulatory use
- Consult legal counsel before using for regulatory filings or compliance-critical applications
Current Version: 1.0.0
Status: ✅ Functional for Educational, Research, and Professional Use
What Works Well:
- Core LBO projections, returns summaries, debt schedules (
lbo_core) - Excel export with workbook formatting tuned for readability
- Sensitivity analysis and select break-even tooling in Streamlit
- Multi-page dashboard + CLI (
run.py/lbo-generate) workflows - Tool-grounded Copilot pathway (deterministic
lbo_aitools + schemas) beside legacy conversational AI helpers—when APIs are explicitly configured
Needs Further Development:
- Comprehensive test coverage (see Testing & Validation)
- Third-party validation of financial formulas by CPAs/CFAs
- Security audit and penetration testing
- Performance benchmarks and optimization
- Regulatory compliance documentation
- Production deployment documentation
Production Use Considerations: Before using for actual investment decisions:
- Validate all formulas against known LBO models
- Review by qualified CPAs/CFAs for your specific use case
- Test with your specific deal structures and industry
- Conduct security review if handling confidential data
- Consult legal counsel regarding compliance requirements
Roadmap:
- Additional industry templates
- Enhanced visualization capabilities
- Advanced debt structure modeling (PIK, warrants)
- Integration with market data providers
- Multi-currency support
- Monte Carlo simulation capabilities
- Comprehensive test suite expansion
Built following investment banking best practices, the LBO Model Generator combines standard financial modeling approaches with modern software engineering. The tool is designed to assist private equity professionals, investment banks, and financial advisors with LBO model generation and analysis. Users are responsible for validating outputs and ensuring compliance with their specific requirements.
Key Differentiators:
- Industry Expertise: Built following investment banking best practices
- Open Source: Full code transparency and auditability
- Tool-Grounded Agents: Deterministic MCP tools plus Streamlit Copilot traceability—not “chat-only IRR” for headline metrics without tool calls
- Professional Output: Excel models with institutional-standard formatting
- Extensible Layers: Separate
lbo_coremodeling +lbo_aitooling surfaces (HTTP/MCP extras) versus a legacy monolithic script pile
If you use this tool in your research or work, please consider citing:
@software{lbo_model_generator,
title = {LBO Model Generator},
author = {Sage Hart},
year = {2025},
license = {Apache-2.0},
url = {https://github.com/SafetyMP/LBO-Model-Generator}
}Contributing: Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Issues & Support: Report issues or request features via GitHub Issues.
Repository: https://github.com/SafetyMP/LBO-Model-Generator
Open-source LBO modeling • deterministic lbo_core engine • optional lbo_ai + Copilot adapters • users validate all outputs