SMARTFinRAG is a comprehensive, modular live-demo system specifically designed for financial domains that addresses critical challenges in Retrieval-Augmented Generation (RAG) systems. Our framework enables customizable RAG evaluation, real-time component swapping, and document-centric assessment to promote trustworthy, document-grounded financial question answering research.
https://smartfinrag-a9cawsutx5f4pl4j8wnox7.streamlit.app/
- Customizable Parameter Configuration: Adjust both RAG and LLM parameters to dynamically configure the generation process
- Modular Component Architecture: Selectively enable/disable components in the RAG pipeline for ablation studies and bottleneck identification
- Document-Based Evaluation: Utilize a document-centric evaluation paradigm with LLM-as-a-Judge to generate and assess QA pairs
- Comprehensive Metrics Suite: Measure both retrieval quality (hit rate, MRR, precision, recall, NDCG) and response quality (faithfulness, relevancy)
- Finance-Specific Processing: Tailored for financial document understanding with domain-specific components
- Multi-Dataset Support: Unified QA schema covering multiple financial datasets
- SEC Filings Support: Compatible with the "Generative AI rewritten SEC filings" dataset (Lehner, 2024)
- Timeliness Evaluation: Just-in-time document ingestion to assess model performance on recent financial information
- QueryPreprocessor: Named Entity Recognition and query enhancement capabilities
- RetrieverFactory: Configure BM25, vector-based, and hybrid retrieval approaches
- Document Processing Pipeline: Support for PDF, TXT, DOCX with chunking optimization
- Extensible Evaluation System: Automated metrics calculation and result exportation
- Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Create a
.envfile in the root directory and add your API keys:
OPENAI_API_KEY=your_openai_api_key_here
HUGGINGFACE_API_KEY=your_hf_api_key_here
OPENROUTER_API_KEY=your_openrouter_api_key_here
- Start the application:
streamlit run app.py- Upload financial documents using the sidebar
- Click "Process Documents" to index the uploaded files
- Configure RAG components through the interface
- Start asking questions in the chat interface
- View evaluation metrics and experiment with different configurations
- Upload relevant financial documents (PDF, TXT, DOCX)
- For optimal performance, use well-structured financial documents
- The system supports both batch processing and real-time document indexing
- Documents are stored securely in the local environment
SMARTFinRAG implements a modular architecture with the following key components:

- Document Processing: Ingestion, parsing, and chunking of financial documents
- Retrieval System: Configurable retrieval mechanisms with multiple strategies
- Generation Module: LLM-based response synthesis with context integration
- Evaluation Framework: Automatic assessment of retrieval and generation quality
- Web Interface: Interactive UI for real-time experimentation and visualization
- Never upload documents containing sensitive personal information
- API keys should be kept secure and never shared
- Document storage is local to the application