RAG · grounded QA over SEC filings
Financial Filings RAG
Ask plain-English questions about a 10-K or 10-Q and get an answer generated only from the filing itself, with numbered citations to the passages used. If the filing doesn't support an answer, the system says so instead of guessing.
- 1,200 characters per chunk
- 200 characters of overlap
- top-6 passages retrieved per query
- $0 embedding cost (runs locally)
Why
Ask an LLM about one company’s latest filing and it will answer confidently from memory. In finance a wrong figure is worse than no figure. Retrieval-augmented generation fixes that by retrieving the relevant text first and making the model answer only from it.
- 01 ingest Fetch filing SEC EDGAR by ticker, or a local PDF/HTML
- 02 chunk Overlapping windows 1,200 chars, 200 overlap
- 03 embed Local embeddings all-MiniLM-L6-v2, no API cost
- 04 retrieve Vector search ChromaDB, top-6 passages
- 05 generate Grounded answer Claude cites [n] or refuses
Design decisions
- Overlapping character windows. Filings bury key numbers mid-paragraph. A 200-character overlap stops a figure and its label from landing in different chunks.
- Local embeddings.
sentence-transformersruns on a laptop, so indexing a 100-page filing costs nothing and keeps the documents on the machine. - Refusal is a feature. The prompt restricts the model to the retrieved passages and tells it to say when they don’t contain the answer. A cited “not stated in the filing” beats a plausible guess.
- Citations by construction. Every passage goes into the prompt with an index, and the answer must reference
[n]. A reader can check every claim in one click.
What I’d add next
The next step is to measure it, not just demo it: a small labelled question set per filing to track retrieval recall@k and answer faithfulness; hybrid BM25 + vector retrieval for exact line items like “diluted EPS”; and table-aware parsing, because many financial facts live in tables that character windows split badly.