Your RAG service is over budget on inference spend and its p95 latency is too high, but nobody can say which step is responsible. How would you use tracing to attribute cost and latency, and then decide where to cut?

technical-conceptual · Senior level · data-ml

What the interviewer is really asking

Probes whether the candidate can turn traces into a cost/latency optimization tool — attributing spend and time to specific pipeline steps and reasoning about the right lever — rather than guessing.

What to say

What to avoid

Example answers

Strong: I'd put token and cost counters on each span and break p95 down per step. On a service I ran, the traces showed generation tokens were 70% of spend because we stuffed twelve chunks into context; cutting to the top four most relevant and adding a retrieval cache dropped cost about 40% and trimmed the latency tail, and I verified both on the same traces with no measurable quality drop on our eval set.

Weak: It's too expensive, so I'd switch to a smaller, cheaper model and hope latency improves too.

Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.