Tanay Venkata

Back to Builds

Dec 15, 2025 · RAG

401(k) Plan Advisor

A reader for 401(k) paperwork that knows 'can I buy stocks' and 'self-directed brokerage window' are the same question.

Overview

A RAG pipeline that answers natural language questions about 401(k) plans. It classifies queries into plan rules (searches PDF documents), fund data (SQL translation), or hybrid approaches. Built using ChromaDB for vector storage and lightweight local LLMs via LM Studio.

The Problem

401(k) plans are complex. Between the Summary Plan Description, fee disclosures, and fund prospectuses, understanding your options requires reading hundreds of pages of dense legal and financial text. Most people don’t, and end up making suboptimal decisions about one of their largest financial assets.

HR teams field retirement questions repeatedly. Finding answers requires cross-referencing plan documents, IRS guidelines, and company policies. It’s a high-friction, repetitive task that consumes valuable time.

The Solution

A system that routes intelligently between document retrieval (text) and calculation (math) to provide verified answers.

The key insight: Start with classification. Does this user need a policy lookup, a calculation, or both? By handling this routing automatically, we deliver complete answers, not just search results.

A multi-step RAG pipeline that:

All answers include verbatim excerpts with page references, so HR can verify before forwarding to employees.

Architecture

The system handles three types of questions:

Type What it answers How it works
Plan Rules Vesting, contributions, withdrawals, eligibility Searches plan documents (PDFs)
Fund Data Fees, returns, fund comparisons Queries structured fund data (SQL)
Combined “I’m 30, which target-date fund should I pick?” Uses both, merges the answer

Key Decisions

Routing over retrieval

Most RAG systems retrieve first, then answer. This system classifies first, then decides what to retrieve. That small change made hybrid questions (policy + math) actually work.

Two-tier classification

Instead of calling the LLM for every query, the classifier first checks against 70+ keyword patterns. This handles ~80% of questions instantly. The LLM only kicks in for ambiguous cases.

Domain term injection

Before searching the vector database, the system adds relevant 401(k) vocabulary to the query. This bridges the gap between how users ask questions (“Can I buy stocks directly?”) and how plan documents are written (“self-directed brokerage window”).

Show the math

For calculation questions, the system shows its work. “Based on your age (52) and the 2024 catch-up limit ($7,500), your maximum contribution is…” Transparency builds trust.

Conservative citations

When in doubt, show more context. A wrong answer that looks confident is worse than a verbose answer that lets the human verify.

Graceful fallbacks

If SQL generation fails, the system falls back to RAG search. If classification is uncertain, it defaults to RAG. The user always gets an answer.

Results

Back to Builds