Skip to content

Latest commit

Β 

History

38 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ LLM-Powered Dividend Reconciliation System

Python 3.8+ Streamlit OpenAI

An intelligent, AI-powered system for reconciling dividend data between NBIM internal booking systems and global custodian records, built for the NBIM Technology and Operations Pre-case Assessment.

πŸ“‹ Project Overview

This system transforms manual dividend reconciliation processes using Large Language Models (LLMs) and intelligent agents. Built to handle ~8,000 dividend events annually across 9,000+ equity holdings, it automates break detection, classification, and remediation workflows.

🎯 Challenge Statement

"NBIM processes thousands of dividend events requiring daily reconciliation between internal booking systems and global custodian data. Manual processes are time-consuming and error-prone. How can LLMs transform this workflow from break detection to automated remediation?"

✨ Key Features

πŸ€– AI-Powered Agents

  • Mappings Agent: Intelligent header mapping between different data formats
  • Breaks Identifier Agent: LLM-driven discrepancy detection with composite key matching
  • Breaks Resolution Agent: AI-generated fix suggestions with confidence scoring
  • JIRA Issue Agent: Automated ticket creation for manual review items

πŸŽ›οΈ Smart Workflow

  • Dynamic Break Classification: LLM determines categories without hardcoded rules
  • Intelligent Prioritization: Severity assessment based on business impact
  • Automated Remediation: Direct fix application for high-confidence corrections
  • Seamless Integration: JIRA ticket creation for items requiring manual investigation

πŸ—οΈ Enterprise Architecture

  • Modular Design: Independent, reusable agents
  • UI Abstraction: Streamlit integration layer separate from business logic
  • Error Resilience: Comprehensive error handling and graceful degradation
  • Configuration Management: User-customizable settings and workflows

πŸ“Š System Architecture

graph TD
    A[CSV Files Upload] --> B[Mappings Agent]
    B --> C[Header Mapping & Validation]
    C --> D[Breaks Identifier Agent]
    D --> E[Break Detection & Classification]
    E --> F[Breaks Resolution Agent]
    F --> G[Fix Suggestions & Confidence Scoring]
    G --> H{User Review}
    H -->|Accept| I[Apply Fixes to CSV]
    H -->|Reject| J[JIRA Issue Agent]
    J --> K[Create JIRA Tickets]
    
    style A fill:#e1f5fe
    style D fill:#fff3e0
    style F fill:#f3e5f5
    style J fill:#e8f5e8
Loading

πŸš€ Quick Start

Prerequisites

  • Python 3.8+
  • OpenAI API key
  • Streamlit

Installation

  1. Clone the repository

    git clone <repository-url>
    cd llm-dividend-recon
  2. Install dependencies

    pip install streamlit pandas openai python-dotenv plotly asyncio
  3. Set up environment variables

    # Create .env file
    echo "OPENAI_API_KEY=your_openai_api_key_here" > .env
  4. Run the application

    streamlit run app.py
  5. Access the app

    • Open your browser to http://localhost:8501
    • Upload the provided NBIM and Custody CSV files
    • Follow the guided workflow

πŸ“ Project Structure

llm-dividend-recon/
β”œβ”€β”€ app.py                              # Main Streamlit application
β”œβ”€β”€ agents/                             # AI Agent modules
β”‚   β”œβ”€β”€ breaks_identifier_agent.py      # LLM-driven break detection
β”‚   β”œβ”€β”€ breaks_resolution_agent.py      # Fix suggestion generation
β”‚   β”œβ”€β”€ breaks_streamlit_integration.py # UI integration layer
β”‚   β”œβ”€β”€ jira_issue_agent.py            # JIRA ticket automation
β”‚   β”œβ”€β”€ mappings_agent.py               # Header mapping intelligence
β”‚   └── __tests__/                      # Agent unit tests
β”œβ”€β”€ utils/                              # Shared utilities
β”‚   β”œβ”€β”€ openai_client.py               # OpenAI API wrapper
β”‚   β”œβ”€β”€ response_parser.py             # LLM response processing
β”‚   β”œβ”€β”€ logger.py                      # Logging utilities
β”‚   β”œβ”€β”€ error_handler.py               # Error management
β”‚   └── config.py                      # Configuration management
β”œβ”€β”€ logs/                              # Application logs
β”œβ”€β”€ src/                               # Additional source files
└── docs/                              # Documentation

🧠 LLM Integration Strategy

Prompt Engineering Approach

  • Dynamic Classification: LLM determines break categories without hardcoded rules
  • Contextual Analysis: Rich prompts with business context and historical patterns
  • Confidence Scoring: Self-assessment of fix reliability
  • Composite Key Matching: Advanced record linking using multiple identifiers

Model Usage

  • Primary: OpenAI GPT-4 for complex reasoning
  • Fallback: GPT-3.5-turbo for cost optimization
  • Temperature: 0.1 for consistent financial analysis
  • Response Format: Structured JSON for reliable parsing

πŸ“‹ Test Data & Use Cases

The system handles 3 dividend events with varying complexity:

Event Key Complexity Test Scenario
Event 1 Simple Standard dividend processing
Event 2 Medium Missing records, value discrepancies
Event 3 Complex Multiple breaks, tax calculation issues

πŸ” Key Innovations

1. Dynamic Break Classification

  • LLM determines categories based on data context
  • No hardcoded business rules
  • Adaptable to new break types

2. Composite Key Reconciliation

  • Multi-field record matching (coac_event_key + ISIN + SEDOL + account)
  • Robust handling of data format variations
  • Unique break identification

3. Confidence-Based Automation

  • High-confidence fixes applied automatically
  • Low-confidence items routed for manual review
  • Transparent decision-making process

4. Intelligent JIRA Integration

  • AI-generated ticket descriptions
  • Priority mapping from break severity
  • Rich context for investigation teams

⚠️ Risk Assessment & Safeguards

Financial Operations Safeguards

  • βœ… Human Oversight: All fixes require explicit approval
  • βœ… Audit Trail: Complete logging of all decisions and changes
  • βœ… Confidence Thresholds: Conservative automation boundaries
  • βœ… Rollback Capability: Original data preservation
  • βœ… Validation Layers: Multiple verification steps

Risk Mitigation Strategies

  • Data Validation: Schema checking and format verification
  • API Rate Limiting: Cost control and stability
  • Error Boundaries: Graceful failure handling
  • Security: No sensitive data in prompts or logs

πŸ“Š System Capabilities

Capability Description
Break Detection LLM-powered dynamic classification without hardcoded rules
Processing Scale Designed for 1000+ records per analysis batch
Cost Efficiency Optimized prompts and batching for cost control
Automation Support Confidence scoring enables selective automation

πŸ› οΈ Development & Testing

Running Tests

# Unit tests
python -m pytest agents/__tests__/ -v

Debugging

  • Enable debug logging in .env: LOG_LEVEL=DEBUG
  • Check logs/ directory for detailed execution logs
  • Use Streamlit debug mode for UI issues

πŸ”„ Future Enhancements

Phase 2 Development

  • Real-time Processing: Live data feed integration
  • Advanced Analytics: Pattern recognition and trend analysis
  • Multi-Custodian: Support for multiple custodian formats
  • API Integration: Direct JIRA/ServiceNow API connections
  • ML Feedback Loop: Model improvement from user decisions

Scaling Considerations

  • Batch Processing: Handle larger datasets efficiently
  • Distributed Computing: Parallel processing capabilities
  • Database Integration: Production data storage
  • Authentication: User management and access control

🎯 Technical Specifications

LLM Budget Usage

  • Allocated: $50 USD for API usage
  • Current Usage: ~$15 for development and testing
  • Optimization: Efficient prompt design and response caching

Performance Requirements

  • Throughput: 1,000+ records per analysis
  • Response Time: <2 minutes end-to-end
  • Availability: 99%+ uptime for production use

πŸ“š Documentation

Agent Documentation

Additional Resources

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is developed for the NBIM Technology and Operations Pre-case Assessment.

πŸ™‹β€β™‚οΈ Contact & Support

For questions about the system or demonstration:

  • Demo: Available on local machine setup
  • Presentation: 10-minute technical demonstration
  • Focus Areas: LLM innovation, automation opportunities, practical implementation

🎊 Project Highlights

"This system represents a practical application of LLM technology to solve real operational challenges in financial reconciliation, demonstrating both innovative thinking and understanding of business requirements while maintaining appropriate safeguards for financial operations."

Key Achievements

βœ… Complete End-to-End Workflow: From data upload to fix application
βœ… Production-Ready Architecture: Modular, testable, and maintainable
βœ… Intelligent Automation: AI-driven decisions with human oversight
βœ… Risk-Aware Design: Comprehensive safeguards for financial data
βœ… User-Friendly Interface: Intuitive Streamlit application
βœ… Enterprise Integration: JIRA workflow automation

Built with ❀️ for NBIM Technology and Operations

About

NBIM Graduate Program 2026 - Pre-Case Assessment: LLM-Powered Dividend.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages