Design a text-to-SQL assistant
PremiumLLM systemEasy
- Text to SQL
- Schema retrieval
- SQL validation
Quick answer
This LLM system interview question asks you to design a text-to-SQL assistant. Aim for a design that uses language models to serve users well, then explain retrieval, prompting, serving, evaluation and trade-offs. Interviewers want to see how you control quality, cost and latency, and how you evaluate the results.
The problem
Design a Text-to-SQL assistant for a company data warehouse. An analyst asks a question in plain English; the assistant finds the right tables, writes SQL, runs it safely and shows the result with the query. The hard parts are picking tables out of 2,000, getting joins and metrics right, and making sure no query can change or leak data.
Analysts must be able to trust the number, so the assistant always shows the SQL and the tables it used.
What must a text-to-SQL assistant do?
- Question to SQL: Turn a question into one SQL query, run it, and show a table or chart together with the SQL.
- Show the sources: List the tables and certified metric definitions used.
How well must it do it?
- Safety: Only single SELECT statements run, under a read-only role with the asking user's row-level permissions.
- Accuracy: At least 85% execution accuracy on a 500-question golden set before launch.
What scale should you design for?
Use these numbers in your estimates.
The scale numbers unlock with this questionUnlock
Key concepts
- Text to SQL
- Schema retrieval
- SQL validation
- Execution accuracy
- Row level security
- Few shot prompting
How you’ll practise
- Problem framing
- Data and retrieval
- Prompting and orchestration
- Evaluation and safety
- Serving, cost and latency
- Wrap-up
Lala, personalized to you, gives a hint when you ask and reviews your design when you are ready.
What do interviewers look for?
In any LLM system design round.
- Defines the user task and what a good answer is
- Explains how relevant context reaches the model
- Plans evaluation before and after launch
- Controls cost and latency with caching and routing
- Covers safety, privacy and abuse
- Handles failures and fallbacks gracefully
Questions people ask about this interview question
- Which design type is this question?
- It is an LLM system question. You design a text-to-SQL assistant and explain your choices the way you would in an interview.
- Is this question asked at entry level?
- It is marked Easy, so it suits engineers who are new to LLM system interviews. It is also a good warm-up before harder questions.
- What should I cover first?
- Start with the user task, what a good answer looks like and how it will be measured. Agree on scope with the interviewer before you design anything.
- Can I practise it for free?
- It is a premium question. Sign up and unlock it once for 10 credits; it then stays unlocked. When you finish, Lala, your personalized AI mentor, can review your design for 30 credits.
Related questions
Updated · Written by the SevyDevy team