← Questions

Transformers and the challenges of deploying LLMs

0
MicrosoftAI/ML designLast asked Dec 2025

An AI/ML design interview question asked in Microsoft's technical phone screen, last asked Dec 2025. It tests llm, transformers and deployment.

A two-part conversation for a machine learning engineer: first how the Transformer works, then how you would ship a feature built on a large language model, for example an internal assistant or a customer support bot.

Requirements

  • Functional: explain the Transformer's building blocks and why it replaced recurrent networks; then propose an architecture for an LLM-powered feature, with concrete mitigations for its real-world problems and a plan to evaluate it before and after launch.
  • Non-functional: interactive latency, a cost per request the product can carry, answer quality, safety, and privacy of user and company data.

Clarifying questions

  • What is the feature, who are the users, and how bad is a wrong answer?
  • Can data leave our environment, or must the model be hosted in-house?
  • What latency and cost per request are acceptable?
  • Is there labelled data or a set of known good answers to evaluate against?

What a strong answer covers

  • Part 1, the architecture:
    • What recurrent networks struggled with: sequential computation that is hard to parallelize, and long-range dependencies.
    • Token embeddings plus positional information (sinusoidal, learned, or rotary).
    • Self-attention: queries, keys and values as projections of the input, scaled dot-product scores, softmax, a weighted sum of values; causal masking for decoders.
    • Multi-head attention and why several heads help; the feed-forward block, residual connections and layer norm.
    • Full self-attention costs O(L^2) time and memory in sequence length L, and what that means for long contexts.
  • Part 2, deployment:
    • The main problems: latency, cost, hallucination, safety and prompt injection, privacy, evaluation.
    • An architecture: a gateway with auth and rate limits, retrieval for grounding, the model behind it (hosted API or self-hosted with batching and KV caching), input and output filters, caching, fallbacks to a smaller model.
    • Mitigations per problem: grounding and citations against hallucination, streaming and smaller models for latency, routing and caching for cost, redaction and access control for privacy.
    • Offline evaluation on a fixed test set with human or model-graded rubrics; online monitoring of quality signals, refusals, latency, cost and user feedback.

Follow-ups

  • How would you cut the attention cost for a 100k-token context?
  • The model is accurate but too slow. What do you try, in order?
  • How do you detect a quality regression after a model or prompt change?

Where it's asked

What it tests

llm · transformers · deployment

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing