Interview Prep14 min read

Machine Learning Engineer Cost Optimization Interview: Fix the Floor

Eighteen always-on GPUs drive 72% of the compute bill. Walk a mid-level Machine Learning Engineer cost optimization interview, cost model to chargeback.

IT
InterviewStack TeamData
|

Finance says the recommendation service costs 35% more than last quarter, product says do not touch quality, and you have 30 minutes to produce a plan. The tempting first move is to reach for quantization or spot instances. The scenario's own numbers point somewhere else: of roughly $43,300 a month in GPU compute, about $31,100 pays for the 18 instances that never scale down, and the 5-hour scale-out above that floor, the obvious spot candidate, is about $12,200. A mid-level Machine Learning Engineer answer that finds the floor first has a plan; one that starts with discounts has a list.

What follows is a simulated mock interview built on one AI interview blueprint. The mistakes are illustrative composites with coaching, not a transcript of a real candidate or any company's actual questions, and the dollar figures are our arithmetic on the scenario's inputs, assuming the fleet sits at 18 instances outside the 5-hour peak window and at 52 inside it, with no ramp in between.

Key Findings

  • The interview is scored out of 100 points across 4 dimensions; Technical Proficiency is only 20 of them, while Interviewer Objectives Alignment and Level-Specific Expectations carry 30 each.
  • The 30 minutes run in 3 phases: cost model setup (minutes 0 to 8), optimization and trade-offs (8 to 22), and measurement, rollout and ownership (22 to 30).
  • The middle phase is the longest at 14 minutes, 47% of the interview, and holds 6 of the blueprint's 15 checklist items.
  • The scenario's fleet runs 602 GPU instance-hours a day, about $43,300 a month at $2.40 an hour over a 30-day month.
  • The 18-instance floor is about $31,100 of that (72%); the 5-hour scale-out to 52 instances is about $12,200 (28%).
  • Logs arrive at 950 GB a day, about 28.5 TB a month, while the 180 GB index and 7 GB model artifact cost about $4 a month to store.
  • The interviewer has 6 prepared follow-ups; this walkthrough dramatizes 4 of them.

Eighteen Always-On GPUs Are Most of the Bill

The interview question

You are on the ML Platform team supporting a recommendation model used across several surfaces in a large consumer app. The current serving setup:

current_serving_setup:
  model_type: two-tower retrieval model
  deployment: online inference service in one cloud region
  traffic:
    average_qps: 1800
    peak_qps: 5400
    p95_peak_window_hours_per_day: 5
  latency_requirement:
    p95_ms: 120
  current_infra:
    instance_type: gpu.small
    instance_cost_per_hour: 2.40
    instances_at_baseline: 18
    instances_at_peak: 52
    autoscaling_target_gpu_utilization: 45%
  request_pattern:
    average_batch_size: 1
    feature_payload_kb: 14
    response_payload_kb: 6
  model_behavior:
    average_inference_time_ms_per_request: 18
    gpu_memory_used_per_instance_gb: 9
    system_memory_used_per_instance_gb: 22
  storage:
    model_artifact_gb: 7
    embedding_index_gb: 180
    logs_per_day_gb: 950
  cloud_pricing:
    object_storage_standard_per_gb_month: 0.023
    object_storage_infrequent_per_gb_month: 0.0125
    cross_zone_egress_per_gb: 0.01
    internet_egress_per_gb: 0.05

Finance escalated that this service's monthly cost rose by about 35% over the last quarter. Product says online metrics are stable and does not want noticeable quality loss. Your team is expected to propose a cost-reduction plan for the next quarter.

Using the scenario above, walk me through how you would analyze the cost of this recommendation service and propose a concrete plan to reduce spend while keeping performance acceptable.

The interviewer's objectives ask for four things in order: translate traffic into cost-per-request and monthly spend, find the main drivers across compute, memory, storage and network, cut cost without hurting quality or user experience, and make sound calls on autoscaling, capacity mix and cost attribution across tenants. Notice what is left out. Latency debugging, profiling and concurrency mechanics are explicitly off the table, so a deep dive into kernels or thread pools earns nothing here.

What Earns Points in a Machine Learning Engineer Cost Optimization Interview?

Bar chart of the four rubric dimensions by point weight, out of 100 points

The four scoring dimensions and their point weights, out of 100.

Sixty points go to whether you hit the interviewer's objectives and work at the mid-level bar. That bar is specific: correct back-of-the-envelope math with stated assumptions, practical changes rather than a re-architecture, a clear view of the trade-off between cost, headroom and quality, and the habit of asking for missing metrics before finalizing. The checklist does not ask whether you know reserved capacity is cheaper than on-demand; it asks for reserved instances on the stable baseline and cautious spot for non-critical overflow, which means knowing which pool is which.

Four Follow-Ups That Test Whether You Priced It First

Turn 1: Put Numbers on Buckets

Interviewer: "How would you estimate the current monthly cost and break it down into the biggest buckets before recommending changes?"

COMMON MISTAKE
A tempting opening, voiced here by a composite candidate we'll call Lucia, is a list of fixes in the first minute: quantize the model, move to spot, compress the index. With no price on any bucket, nothing can be ranked, and the round loses the checklist item that asks you to estimate compute from the baseline and peak instance counts plus duration assumptions.
STRONGER MOVE
Price compute first and say the assumptions: 18 instances for 19 hours plus 52 for the 5-hour peak is 602 instance-hours a day, about $43,300 a month at $2.40 an hour. Then size the rest: logs add about 28.5 TB a month, the index and model artifact (187 GB) cost about $4 a month to store, and network depends on which hops cross a zone, so ask. Close by naming what you lack: the hourly traffic curve, real utilization, and log retention.

Turn 2: Spiky Traffic, Two Pools

Interviewer: "If traffic is highly spiky and most of the day runs far below peak, how would that change your scaling or capacity strategy?"

COMMON MISTAKE
Lucia moves the peak scale-out to spot and calls the plan done, but the 5-hour scale-out above the floor is only about $12,200 of the $43,300; the 18-instance floor that runs all 24 hours is about $31,100. Attacking the smaller bucket first misses the checklist item to prioritize high-impact ideas instead of presenting an unranked list.
STRONGER MOVE
Split the fleet in two. For the always-on pool, ask whether a 45% utilization target leaves more latency headroom than the 120 ms p95 needs, since every instance cut from the floor saves about $1,730 a month, and check whether micro-batching lets each GPU serve more requests within the 120 ms budget, then put what remains on reserved capacity. For the peak pool, keep on-demand scale-out with warm capacity ahead of the ramp, and allow spot only for overflow that survives an interruption.

Turn 3: Recall Versus Savings

Interviewer: "Suppose the retrieval quality drops slightly when you compress the embedding index or move part of it to a different tier. How would you decide whether that tradeoff is acceptable?"

COMMON MISTAKE
Lucia either accepts any recall drop because it saves money or refuses compression outright, and argues storage savings when the 180 GB index costs about $4 a month to store. Both versions miss the level expectation to weigh cost against latency headroom, utilization and model quality.
STRONGER MOVE
Say where the money is: a smaller index matters mainly if it lowers memory enough to change the instance shape or the replica count. Measure recall against the full index offline, agree an online quality guardrail with product before the test (our LLM evaluation and observability walkthrough is the companion round on that side of the tradeoff), and ship behind an experiment with a rollback threshold set in advance.

Turn 4: Who Pays for What

Interviewer: "If finance wants costs attributed by product surface or tenant, how would you design a practical chargeback or allocation approach for this service?"

COMMON MISTAKE
Lucia proposes per-request GPU-time tracing through every surface, a platform rebuild before finance sees a number. That misses the level expectation for practical changes a mid-level engineer can help implement with platform support, not company-wide reinvention.
STRONGER MOVE
Tag requests by surface at the gateway and allocate in layers: variable compute by request volume, peak capacity by each surface's share of peak-window traffic, the shared floor and storage pro rata. Report cost per 1,000 requests per surface (about $0.009 in GPU compute today at average traffic) as a showback first, and check that savings are real rather than shifted to another team's bill.

Why Does the Arithmetic Get Harder With Someone Watching?

Every fix above looks obvious once it is written down. Live, you are multiplying 52 by 5 by $2.40 while deciding which bucket to attack, and the interviewer can change the ground mid-answer: which dashboards would show the fleet is overprovisioned rather than constrained by latency or memory, or whether leadership should lean on reserved, spot or on-demand capacity. Those two follow-ups were not dramatized here, and in a live round you would not know which one is coming. The only way to make the cost model automatic is to build it out loud, several times, against someone who pushes back.

What Does the Blueprint Check Off While You Price the Fleet?

Timeline of the 30-minute interview split into three phases

The 30-minute interview paced into its three phases.

This is the blueprint a strong candidate hits, and the same one the AI mock interview tracks you against in real time, checking off items as you cover them.

Blueprinta strong 30-minute interview, phase by phase
1
Problem framing and cost model setup 0-8
  • ✓States key constraints: maintain acceptable latency and no noticeable quality loss.
  • ✓Breaks cost into at least compute, storage/logging, and egress/network categories.
  • ✓Uses baseline and peak instance counts plus duration assumptions to estimate compute spend.
  • ✓Calls out that utilization target of 45% may indicate room for right-sizing or scaling policy changes.
  • ✓Identifies missing data that would matter, such as hourly traffic distribution, actual utilization, and log retention policy.
2
Optimization proposal and tradeoff discussion 8-22
  • ✓Prioritizes high-impact ideas first instead of presenting an unranked list.
  • ✓Discusses one or more compute actions such as raising autoscaling utilization targets, reducing baseline floor, request batching if feasible, using a smaller instance shape, or separating peak and steady-state pools.
  • ✓Discusses one or more capacity purchase actions such as reserved instances for stable baseline and cautious spot usage for non-critical overflow.
  • ✓Discusses one or more storage or logging actions such as reducing logging volume, shorter hot retention, compression, or tiering older logs and artifacts.
  • ✓Mentions model or index efficiency options like quantization, compression, distillation, or pruning, while acknowledging validation against retrieval quality and latency.
  • ✓Evaluates operational risks such as cold starts, spot interruptions, memory pressure, and quality regressions.
3
Measurement, rollout, and ownership 22-30
  • ✓Defines success metrics such as cost per 1k requests, monthly spend, utilization, p95 latency, and online quality guardrails.
  • ✓Proposes a phased rollout or experiment plan with low-risk changes first and clear rollback criteria.
  • ✓Explains how to validate savings versus merely shifting costs elsewhere.
  • ✓Suggests a workable allocation model for shared platform costs, such as request-volume-based or resource-usage-weighted chargeback by tenant or surface.

Price This Service Out Loud in a Mock Round

The fastest way to find out whether you price first or list fixes first is to sit the round. Start the Machine Learning Engineer cost optimization mock interview: same scenario shape, same three phases, follow-ups you have not rehearsed, and feedback scored on the same four dimensions at the end.

Want a warm-up first? Work through single questions in the performance and cost optimization question bank, or browse the preparation guides for the companies you are targeting.

FAQ

Q. What does a Machine Learning Engineer cost optimization interview test?

It tests whether you can turn traffic, infrastructure and pricing numbers into a cost model, find the biggest cost drivers and propose reductions that keep latency and model quality intact. In this 30-minute blueprint you frame the problem and build the cost model (minutes 0 to 8), propose and trade off optimizations (8 to 22), then plan measurement, rollout and cost ownership (22 to 30). Technical Proficiency is 20 of the 100 points; Interviewer Objectives Alignment and Level-Specific Expectations are worth 30 each.

Q. How do you estimate the monthly cost of an ML inference service in an interview?

Multiply instance counts by the hours they run, then by the hourly price. In this scenario, 18 instances for 19 off-peak hours plus 52 instances for the 5-hour peak is 602 instance-hours a day; at $2.40 an hour over a 30-day month that is about $43,300 in compute. Then size storage and logging (950 GB of logs a day is about 28.5 TB a month) and network, state your assumptions out loud, and name the data you would ask for, such as the hourly traffic curve and the log retention policy.

Q. Should ML inference run on spot instances?

Only the part that can tolerate being interrupted. Spot capacity can be reclaimed by the provider at short notice, so a latency-bound online service should keep its steady-state floor on reserved or on-demand capacity and use spot, if at all, for overflow that has a fallback. In this scenario reserved capacity fits the floor, which runs all 24 hours, better than spot fits the 5-hour peak.

Q. What signals show that an ML service is overprovisioned?

Look at the utilization distribution by hour rather than the average, p95 latency against the budget (120 ms here) at current load, GPU memory used against what the instance shape offers (9 GB used in this scenario), and request queueing. Plot cost per 1,000 requests next to them. If p95 stays far under budget while utilization sits near a 45% autoscaling target, the fleet is sized for headroom it does not use.

Q. How do you allocate shared ML platform costs across product surfaces?

Tag every request with its surface or tenant at the gateway, then allocate in layers: variable compute by request volume or GPU time, peak capacity by each surface's share of peak-window traffic, and the shared floor and storage pro rata. Publish cost per 1,000 requests per surface monthly as a showback before turning it into a chargeback.

Q. How can I practice a cost optimization interview like this one?

Run it live. The AI mock interview for this role, level and topic asks its own follow-ups and tracks you against the same three-phase blueprint in real time. The question bank works as a warm-up for single questions on cost per request, autoscaling and capacity purchasing.

Size the Floor Before You Shop for Discounts

Spot, quantization and log tiering are all real levers, and the interviewer wants to hear them, ranked. The ranking comes from a few lines of arithmetic in the 8-minute framing phase: price the floor, price the peak, price the logs, then spend the remaining 22 minutes where the money is.

Topics

Machine Learning Engineercost optimizationML inferenceautoscalingFinOpsmock interviewmid-level

Ready to practice?

Put what you've learned into practice with AI mock interviews and structured preparation guides.