Design a Local Agentic RAG System over 10-K Filings and a SQLite Financial Database

Quick Overview

A take-home ML system design that asks for a locally runnable agentic RAG service over six 10-K filings and a SQLite financial database, with an HTTP chat endpoint and answers traceable to their sources. The follow-up discussion probes the retrieval algorithm, handling stale data and how to evaluate the system.

Design a Local Agentic RAG System over 10-K Filings and a SQLite Financial Database

Company: Fireworks

Role: Machine Learning Engineer

Category: ML System Design

Difficulty: medium

Interview Round: Technical Screen

The first round is an open-book take-home system design that has to run end to end, followed by a live discussion of what you built. You receive: - Six 10-K annual reports: Apple, Microsoft and Alphabet, each for fiscal years 2024 and 2025. - A local SQLite database with structured financial data. - A development set of 10 questions. - An API key for the company's hosted model inference API, with usage credits supplied by the recruiter. The environment is Python 3.11 or later, with uv for package and project management. You may use AI tools to help implement the system. Build an agentic RAG system that runs locally and: - runs on a reviewer's own computer; - supports interactive use; - exposes an HTTP API at `http://localhost:8000/api/chat`; - routes each question to the right data source, or to several of them; - combines the structured financial data with the 10-K text to produce grounded answers that trace back to the original material; - handles both simple lookups and multi-step reasoning. The submission must include `dev_answers.json` with your answers to the development set, a short report of 1-2 pages, and a README that states the exact commands, environment variables, and environment setup and initialization steps needed to run the system locally. After the take-home passes, an interviewer asks you to explain the RAG algorithm you used, what maintaining the system involves (including what happens if the database or the files go stale), and how you would evaluate it. Part 1 covers the build; Parts 2-4 cover the discussion. ### Constraints and Clarifications - Everything except calls to the hosted model API has to run on the reviewer's machine, so any search index or vector store must be local and buildable from the README steps. - The database schema, the development questions and the exact README instructions are not described here, so design for discovering the schema at runtime instead of hard-coding it. - Answers must be traceable: a reader should be able to find the table row or filing passage behind every figure. ### Clarifying Questions - What request and response format should `/api/chat` use: a single question, or a message history for multi-turn use? Should citations come back as structured fields next to the answer text? - How will `dev_answers.json` be scored: exact numeric match, a grader model, or manual review? Does each answer need its citations? - Which models does the provided key reach (chat with tool calling, embeddings), and how far do the credits go? - Do the database figures overlap with numbers printed in the 10-Ks, and if the two disagree, which one is authoritative? - The three companies may not share a fiscal calendar. Should "FY2025" be read as each company's own fiscal year, and how should cross-company comparisons say so? ### Part 1: Build the system Describe the architecture you would submit: how the filings are processed and indexed, how the database is queried, how the agent decides which source to use and when it is done, how answers carry their citations, and how a reviewer goes from a fresh clone to a running endpoint. ```hint Route before you retrieve A single revenue figure for one year belongs in the database, a question about risk factors belongs in the filings, and a year-over-year change explained by management's commentary needs both. Decide how the system tells these apart and how it records which source supported each claim. ``` ```hint Make the reviewer's first run uneventful The reviewer will follow the README literally on a machine that has never seen your code. List what must happen before the first request succeeds and what should fail loudly if a step was skipped. ``` #### What This Part Should Cover - Routing between SQL, the filings, or both, and how the agent loop plans, calls tools and stops. - Processing long filings: chunking along the filing's structure, metadata such as company, fiscal year and section, and the local index. - Grounding: how each number and claim in an answer links to a database row or a filing passage. - Local reproducibility: the endpoint, interactive mode, setup commands and environment variables. ### Part 2: Explain the RAG algorithm Walk the interviewer through the retrieval and generation algorithm your system uses, step by step, for a question that needs more than one lookup. ```hint Trace one hard question Pick a question that needs a figure from the database and an explanation from a filing. Say what happens at each step: which tools are called, what is retrieved and how it is ranked, how many model calls are made, and what ends the loop. ``` #### What This Part Should Cover - Retrieval choices (lexical, dense, hybrid, reranking, metadata filters) and why they suit financial filings. - The agent loop: tool definitions, question decomposition and stopping conditions. - How generated SQL is kept read-only and correct against the real schema. ### Part 3: Maintenance and stale data What does maintaining this system involve? What happens if the database or the 10-K files go stale? ```hint Separate the kinds of staleness A new fiscal year's filing arriving, a restated figure in the database, and an index built from an older copy of a file are different failures. Ask how the system would notice each one before a user does. ``` #### What This Part Should Cover - Detecting staleness: source versions, content hashes and as-of dates. - Re-indexing (incremental or full) and keeping the database and the document index consistent with each other. - What an answer does when data is stale or the sources conflict. - Ongoing upkeep: model or API changes, pinned dependencies, cost. ### Part 4: Evaluation How would you evaluate the system? ```hint Ten questions are a starting point The development set has 10 questions. Think about what you would add to it and how you would score a numeric answer, a cited explanation and a justified refusal differently. ``` #### What This Part Should Cover - Answer correctness for numeric and narrative answers. - Measuring routing and retrieval separately from generation. - Checking that citations support the claims they are attached to. - Regression testing as the system changes, plus latency and cost per question. ### What a Strong Answer Covers - Every component traced back to a stated requirement: local execution, the endpoint, routing, grounding and multi-step reasoning. - Careful handling of financial figures: units, fiscal years and which source wins. - Trade-offs argued for this system: an agent loop's flexibility against latency and API cost, retrieval quality against setup time on the reviewer's machine. - A README and report that let a reviewer reproduce `dev_answers.json`. ### Follow-up Questions - A user asks about a fiscal year that none of the sources cover. What does the system return, and how do you test that behavior? - How would the design change if the corpus grew from six filings to every 10-K filed by large US public companies over a decade? - How do you keep the model from getting a ratio or growth rate wrong when the inputs come from SQL? - If the database and a filing report different values for the same metric, how should the answer present that?

Overview: A take-home ML system design that asks for a locally runnable agentic RAG service over six 10-K filings and a SQLite financial database, with an HTTP chat endpoint and answers traceable to their sources. The follow-up discussion probes the retrieval algorithm, handling stale data and how to evaluate the system.

Read the full Fireworks Machine Learning Engineer interview experience this question came from

Fireworks logo
Fireworks
Nov 15, 2026
mediumMachine Learning EngineerTechnical ScreenML System Design
0
0

The first round is an open-book take-home system design that has to run end to end, followed by a live discussion of what you built.

You receive:

  • Six 10-K annual reports: Apple, Microsoft and Alphabet, each for fiscal years 2024 and 2025.
  • A local SQLite database with structured financial data.
  • A development set of 10 questions.
  • An API key for the company's hosted model inference API, with usage credits supplied by the recruiter.

The environment is Python 3.11 or later, with uv for package and project management. You may use AI tools to help implement the system.

Build an agentic RAG system that runs locally and:

  • runs on a reviewer's own computer;
  • supports interactive use;
  • exposes an HTTP API at http://localhost:8000/api/chat ;
  • routes each question to the right data source, or to several of them;
  • combines the structured financial data with the 10-K text to produce grounded answers that trace back to the original material;
  • handles both simple lookups and multi-step reasoning.

The submission must include dev_answers.json with your answers to the development set, a short report of 1-2 pages, and a README that states the exact commands, environment variables, and environment setup and initialization steps needed to run the system locally.

After the take-home passes, an interviewer asks you to explain the RAG algorithm you used, what maintaining the system involves (including what happens if the database or the files go stale), and how you would evaluate it. Part 1 covers the build; Parts 2-4 cover the discussion.

Constraints and Clarifications

  • Everything except calls to the hosted model API has to run on the reviewer's machine, so any search index or vector store must be local and buildable from the README steps.
  • The database schema, the development questions and the exact README instructions are not described here, so design for discovering the schema at runtime instead of hard-coding it.
  • Answers must be traceable: a reader should be able to find the table row or filing passage behind every figure.

Clarifying Questions Guidance

  • What request and response format should /api/chat use: a single question, or a message history for multi-turn use? Should citations come back as structured fields next to the answer text?
  • How will dev_answers.json be scored: exact numeric match, a grader model, or manual review? Does each answer need its citations?
  • Which models does the provided key reach (chat with tool calling, embeddings), and how far do the credits go?
  • Do the database figures overlap with numbers printed in the 10-Ks, and if the two disagree, which one is authoritative?
  • The three companies may not share a fiscal calendar. Should "FY2025" be read as each company's own fiscal year, and how should cross-company comparisons say so?

Part 1: Build the system

Describe the architecture you would submit: how the filings are processed and indexed, how the database is queried, how the agent decides which source to use and when it is done, how answers carry their citations, and how a reviewer goes from a fresh clone to a running endpoint.

What This Part Should Cover Guidance

  • Routing between SQL, the filings, or both, and how the agent loop plans, calls tools and stops.
  • Processing long filings: chunking along the filing's structure, metadata such as company, fiscal year and section, and the local index.
  • Grounding: how each number and claim in an answer links to a database row or a filing passage.
  • Local reproducibility: the endpoint, interactive mode, setup commands and environment variables.

Part 2: Explain the RAG algorithm

Walk the interviewer through the retrieval and generation algorithm your system uses, step by step, for a question that needs more than one lookup.

What This Part Should Cover Guidance

  • Retrieval choices (lexical, dense, hybrid, reranking, metadata filters) and why they suit financial filings.
  • The agent loop: tool definitions, question decomposition and stopping conditions.
  • How generated SQL is kept read-only and correct against the real schema.

Part 3: Maintenance and stale data

What does maintaining this system involve? What happens if the database or the 10-K files go stale?

What This Part Should Cover Guidance

  • Detecting staleness: source versions, content hashes and as-of dates.
  • Re-indexing (incremental or full) and keeping the database and the document index consistent with each other.
  • What an answer does when data is stale or the sources conflict.
  • Ongoing upkeep: model or API changes, pinned dependencies, cost.

Part 4: Evaluation

How would you evaluate the system?

What This Part Should Cover Guidance

  • Answer correctness for numeric and narrative answers.
  • Measuring routing and retrieval separately from generation.
  • Checking that citations support the claims they are attached to.
  • Regression testing as the system changes, plus latency and cost per question.

What a Strong Answer Covers Guidance

  • Every component traced back to a stated requirement: local execution, the endpoint, routing, grounding and multi-step reasoning.
  • Careful handling of financial figures: units, fiscal years and which source wins.
  • Trade-offs argued for this system: an agent loop's flexibility against latency and API cost, retrieval quality against setup time on the reviewer's machine.
  • A README and report that let a reviewer reproduce dev_answers.json .

Follow-up Questions Guidance

  • A user asks about a fiscal year that none of the sources cover. What does the system return, and how do you test that behavior?
  • How would the design change if the corpus grew from six filings to every 10-K filed by large US public companies over a decade?
  • How do you keep the model from getting a ratio or growth rate wrong when the inputs come from SQL?
  • If the database and a filing report different values for the same metric, how should the answer present that?