The LLM Feature Works Locally but Fails in Production
The interviewer asksYour AI feature works perfectly in your tests, but in production about 5% of requests return broken results. How do you debug it?
AI Product EngineerForward Deployed EngineerCoreBuild roundRepresentative7 min
On this page
The 30-second version
- Get examples: logged request, raw response, and what "broken" means.
- Compare production inputs with test inputs: length, language, special characters.
- Check the boring causes: timeouts, token limits truncating output, rate limits, malformed output.
- Reproduce with the exact logged request, several times.
- Fix: input limits, output validation with retry, and add the cases to tests.
What it's really testing
- Debugging LLM integrations
- Production vs test differences
- Defensive fixes
How to structure your answer
- Examples.
- Compare inputs.
- Boring causes.
- Reproduce.
- Fix.
The interview, played out
- InterviewerYour AI feature works in tests, but 5% of production requests return broken results. How do you debug it?
- CandidateWhat does broken look like? And can I see the logged requests and raw responses for some failures?
- Revealed when askedBroken means the output JSON can't be parsed. Failing requests have much longer inputs than test cases.
- Strong moveLooks for what differs between failing and passing inputs.
- CandidateLong inputs suggest the output is being cut off: the model hits the maximum output tokens mid-JSON, or the whole request is near the context limit. I'd check the finish reason on those responses.
- Revealed when askedThey stop because of the output token limit.
- CandidateFix: raise the output limit where needed, ask for more compact output, validate the JSON and retry once with a stricter instruction, and add long inputs to our tests.
The strong answer, distilled
- Examples: parse failures on long inputs.
- Compare: production inputs far longer than tests.
- Boring cause: output token limit truncates JSON.
- Confirm: finish reason on failing responses.
- Fix: higher limits, compact output, validation with retry, long-input tests.
This is one strong answer, not the only one.
How it's scored
| Dimension | Weak (2) | Passable (3) | Strong (5) |
|---|---|---|---|
| Evidence | Guess | Logs | Failing vs passing comparison |
| Cause | Model randomness | Formatting | Truncation confirmed |
| Fix | Retry everything | Raise limit | Limits, validation, tests |
Round scorecard: FDE: technical and build round, filled in for the mock candidate
| Dimension | Weak | Passable | Strong | The mock candidate |
|---|---|---|---|---|
| Clarifying | Starts coding immediately. | Asks a few questions. | Pins down the goal, inputs and what done means first. | Strong. Asked what "broken" looks like. |
| Approach | Unworkable or over-built. | Workable. | The simplest approach that works, stated before building. | Strong. Compared production inputs with test inputs. |
| Testing | Tries one happy-path input. | Tries a few inputs. | Tests varied and bad inputs, and checks outputs systematically. | Strong. Reproduced failures with logged requests. |
| Trade-offs | None mentioned. | Some. | Says what was cut, why, and what comes next. | Strong. Fixed with validation and limits. |
How the answer changes by role
| Role | What to emphasise |
|---|---|
| AI Product Engineer | Logging and fixes |
| Forward Deployed EngineerForward Deployed Engineer. An engineer embedded with customers who scopes, builds and ships AI solutions into production. Read the full explanation | Debugging on customer data |
Common mistakes
- Blaming randomness
- Not logging raw responses
- Tests that don't match production inputs
More follow-ups to practise
- "Failures are random, not tied to length." Hint: repeat runs; temperature; structured output.
- "The provider is rate-limiting." Hint: backoff and queueing.
Go deeper
- Module: Building with AI tools
- Framework: Build Round Framework
- Framework: Opening Any Interview Answer
- Lesson: Debugging LLM integrations
- Also tests: Production monitoring and error analysis
Sources
Representative question: written to match build rounds for AI product roles, not a specific reported interview.