An advanced Retrieval-Augmented Generation (RAG) system that answers questions about Apple and Tesla SEC 10-K annual filings using state-of-the-art NLP techniques.
This pipeline implements 6 advanced RAG techniques:
- Parent-Child Chunking (Dense X) -- Small child chunks (512 chars) for precise retrieval, large parent chunks (2048 chars) for rich context
- RAG Fusion -- Generates multiple query variations and fuses results with Reciprocal Rank Fusion
- Stepback Prompting -- Generates abstract queries for broader context retrieval
- Semantic Routing -- Classifies queries (financial metrics, risk factors, comparisons, etc.) to optimize retrieval strategy
- Cross-Encoder Reranking -- BGE reranker for precise relevance scoring after initial retrieval
- Adaptive Generation -- Adjusts response strategy (high/medium/low confidence) based on retrieval quality
| Component | Technology |
|---|---|
| LLM | Google Gemini 2.0 Flash |
| Embeddings | BAAI/bge-base-en-v1.5 |
| Reranker | BAAI/bge-reranker-base |
| Vector DB | ChromaDB |
- Apple 10-K filings: 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025
- Tesla 10-K filings: 2020, 2021, 2023, 2024, 2025
- 2,016 pages and 1,735 table documents indexed
- "What was Apple's revenue in 2023 compared to 2020?"
- "What are Tesla's main risk factors?"
- "Compare Apple and Tesla's profit margins"
- "How has Apple's R&D spending changed over the years?"