LLM Mechanics, AI-Native Architecture, Engineering Workflows, and Risk Controls

Medium · Machine Learning · Software Engineer · Technical Screen

Prompt

During a staff-level backend software engineering technical screen, a 20-to-25-minute block is dedicated to an open architectural discussion on practical AI literacy and engineering judgment. No live coding or mathematical derivations are required: pitch your explanations to experienced backend peers using concrete operational stories from production systems you designed, operated, or evaluated. You may draw from both classical machine-learning pipelines and modern LLM-backed features provided you distinguish them clearly, and prioritize technical depth on high-signal points over a rushed checklist.

Before diving in, consider clarifying how much weight the interviewer wants on pretraining versus live production behavior, whether product examples should come from consumer tools or enterprise/financial software, and whether risk discussion should emphasize end users, business operations, or developers using AI assistants. Then address all four parts below:

1. Demystifying Large Language Models

Walk a seasoned backend engineer whose background is purely deterministic software through how a large language model works: - What core objective the base network optimizes during pretraining, plus the post-training alignment stages required to produce an instruction-following assistant. - How text generation executes at serving time, including tokenization, context-window ceilings, sequential decoding, and sampling parameters. - Production behaviors that catch deterministic-systems engineers off guard — and why they happen. - Where LLMs diverge operationally and architecturally from classical task-specific ML models.

2. AI-Native Products vs. Traditional Software Adding AI

Draw a rigorous architectural line between an AI-native product and an established deterministic application that embeds AI capabilities: - Define the distinction more sharply than simply counting model calls, and illustrate each side with a concrete product example. - Contrast the resulting backend trade-offs across release verification, outage degradation, authoritative systems of record, and unit cost. - Identify scenarios where augmenting a conventional deterministic workflow with targeted AI assistance beats building AI-native from scratch.

3. Practical AI Workflows in Daily Engineering

Describe how AI tools fit into your day-to-day software engineering practice: - Walk through concrete engineering workflows where AI speeds up delivery, pairing each workflow with the exact verification check you run before trusting the output in production. - State the data-governance and confidentiality boundaries you enforce around proprietary source code, credentials, and customer records. - Share candid examples of tasks where AI tools hallucinate, mislead, or slow down experienced engineers.

4. Failure Modes and Proportional Safeguards

Identify the primary risks introduced by AI systems — across customers using AI-powered features, organizations operating them, and engineering teams relying on AI coding assistants: - Pair every risk you raise with a concrete engineering or operational safeguard you would implement in a backend system you own. - Explain how you calibrate the strictness of those controls to match the blast radius and stakes of each use case.

Scope & Expectations

  • Connect training objectives and token-by-token inference mechanics directly to serving latency, unit economics, and non-deterministic production edge cases, contrasting LLMs against classical supervised ML.
  • Differentiate AI-native and AI-augmented architectures through failure behavior, source-of-truth ownership, offline/online evaluation gates, and cost structure.
  • Demonstrate disciplined engineering habits: concrete verification gates per daily workflow, strict PII/secret boundaries, and realistic awareness of tool limitations.
  • Map end-user, business, and developer-tooling hazards to actionable architectural guardrails scaled proportionally to domain risk.

Step-by-step walkthrough

  1. Frame the 25-minute conversation and clarify scope

    This phone-screen conversation evaluates two things: whether you understand modern AI mechanics well enough to integrate a model safely into backend production systems, and whether you exercise sober engineering judgment about where not to trust it. With four open prompts sharing 20 to 25 minutes, budget roughly five minutes per prompt. Lead with one crisp claim, anchor it in a concrete system or number, and pause so the interviewer can steer deeper into experience on your resume.

    Open by briefly answering the three clarifying questions so your scope is explicit: - Training vs. deployed behavior: Spend one minute on training and four on deployed behavior, because what the model was optimized to do during training directly explains why it hallucinates, drifts, or falls for prompt injection in production. - Choice of product examples: Pair one pure consumer example with one workflow close to financial software (like bookkeeping ledgers, expense categorization, and tax preparation, where core calculations must remain deterministic and auditable). - Whose risk to emphasize: Touch end users, the business shipping the product, and engineers using AI coding tools, spending the bulk of your time on architectural controls a backend team directly owns.

  2. Part 1a: Pretraining objective and alignment pipeline

    A large language model (LLM) is a deep neural network — almost always built on the transformer architecture (a sequence model that weighs relationships between all words in an input at once) — trained to predict the next token of text. A token is a common chunk of characters, roughly four characters or three-quarters of an English word on average ("bookkeeping" might split into "book" and "keeping").

    During initial training across trillions of words of web pages, books, and source code, the objective is straightforward: given every token seen so far, assign as much probability as possible to whichever token actually came next. Compressing that much text forces the network to learn grammar, world facts, coding idioms, and multi-step patterns, because all of those help predict the next word piece.

    A raw pretrained model is only a document completer: if you send it a question, it might reply with three more exam questions because exam sheets on the internet list questions in a row. Turning it into a helpful assistant takes post-training stages:

    Stage                       What happens in plain English                      Behavior unlocked
    --------------------------  -------------------------------------------------  --------------------------------------
    1. Pretraining              Predict the next token across web, books, & code   Broad world & code knowledge, raw text
    2. Supervised fine-tuning   Imitate curated (user prompt, ideal reply) pairs   Follows instructions and chat turns
       (SFT)
    3. Preference tuning        Compare two candidate replies ("A beats B") from   Helpful tone, policy refusals, cleaner
       (RLHF / DPO)             human or AI graders to nudge probabilities         formatting
    4. Verifiable-task RL       Reward chains of steps that pass unit tests,       Stronger multi-step reasoning and
       & tool training          math verifiers, or structured API schemas          reliable tool / function calling
    

    Here RLHF (Reinforcement Learning from Human Feedback) and DPO (Direct Preference Optimization) are post-training methods that shift the model toward answers humans prefer over plausible-sounding bad ones. Keep one core sentence front and center: an LLM is trained to generate probable, human-preferred text — not verified truth.

  3. Part 1b: Explain inference mechanics, surprises, and classic ML vs. LLMs

    When your backend calls an LLM at serving time, three things happen in sequence:

    [System prompt + chat history + retrieved docs]
            |
            v
    1. Tokenize  -->  Pack everything into one integer token array inside the context window
            |
            v
    2. Prefill   -->  Process all input tokens in parallel on GPUs; save per-layer attention
                      vectors in the KV cache so they are never recomputed
            |
            v
    3. Decode    -->  Loop 1 token at a time: produce vocabulary scores (logits) -> convert
                      to probabilities -> sample 1 token -> append -> repeat until stop token
    

    Define the four serving terms every backend integrator pays for: - Context window: The hard ceiling on input tokens plus generated output tokens in a single call (from thousands to over a million tokens depending on the model); anything truncated outside it is invisible to the model. - KV cache (key-value cache): GPU memory storing intermediate attention vectors from earlier tokens in the request; its size grows linearly with prompt length, making huge prompts memory-heavy and expensive. - Decode bottleneck: Input tokens run in parallel during prefill, whereas output tokens are generated strictly one after another, so total latency is dominated by output length, and API providers charge 3x–5x more per output token than per input token. - Temperature and top-p sampling: Before picking the next token, temperature rescales how spread out the candidate probabilities are, while top-p (nucleus sampling) restricts choices to the smallest top slice of tokens whose probabilities sum to p:

    Prompt: "Your March software expense rose because of two new..."
    Candidate next token   Temp = 1.0 (creative)   Temp = 0.2 (focused)   Temp = 0 (greedy top-1)
    --------------------   ---------------------   --------------------   -----------------------
    "subscriptions"                66%                     96%                     100%
    "vendors"                      24%                      4%                       0%
    "invoices"                     10%                     <1%                       0%
    

    Anchor serving cost with quick mental math: suppose an API charges $3 per million input tokens and $15 per million output tokens. One request with 2,000 input tokens ($0.006) and 500 output tokens ($0.0075) costs $0.0135. At 1,000,000 requests per day, that single endpoint costs $13,500 per day (~$4.9M/year), making prompt size and max-output caps first-class architecture decisions.

    Highlight the behaviors that surprise engineers used to deterministic services: - Non-determinism even at temperature 0: GPU floating-point addition is not associative, so dynamic request batching on the provider's servers can flip a near-tie between two tokens. - Confident fabrication (hallucination): Nothing inside token sampling checks a database; a made-up tax statute or library flag has the same smooth grammar as a real one. - No boundary between code and data: System instructions and untrusted user documents sit in the exact same token array, enabling prompt injection (malicious text inside an email or invoice tricking the model into ignoring developer instructions). - Weak exact arithmetic and silent model drift: Because the model predicts sub-word tokens rather than running an ALU, multi-digit sums fail; meanwhile, calling an unpinned alias can change behavior overnight when a vendor updates weights.

    Finally, contrast an LLM with classic task-specific ML (such as a gradient-boosted fraud or churn classifier): a classic model trains on structured historical rows with ground-truth labels to emit one calibrated score in sub-millisecond CPU time, evaluated cleanly by ROC AUC (how reliably the model ranks true positives above negatives). An LLM handles open-ended text and new tasks via in-context learning (steering behavior via instructions and examples in the prompt without retraining), at 100x–1,000x higher latency and cost. Use classic ML for high-QPS structured predictions with labels; use LLMs for unstructured language synthesis, classification with scarce labels, and natural-language interfaces.

  4. Part 2: Architectural boundary between AI-native and AI-augmented software

    Move past vague labels about how frequently a model is called by applying the unplug-the-model litmus test: if model inference goes offline completely, does a viable core product still function? In an AI-native application, the model is the core value loop — disable inference and no usable product remains. In a conventional application with AI features, deterministic code and databases own the system of record, and AI accelerates or assists specific steps.

    • AI-native example — an automated meeting scribe: Records audio, transcribes speakers, and synthesizes decisions and action items. With the model unreachable, the product cannot perform its job.
    • Conventional + AI example — small-business bookkeeping software: Double-entry ledgers, bank reconciliations, and tax totals are 100% deterministic code. An LLM suggests expense categories ("Office Supplies") on newly imported card charges and drafts plain-English answers to "Why did my software spend jump in March?" backed by SQL numbers. Switch the model off and users still categorize manually and file accurate returns.

    That distinction reshapes day-to-day backend engineering:

    Dimension          AI-native application                         Conventional app + AI feature
    -----------------  --------------------------------------------  ----------------------------------------------
    Release testing    Graded evaluation suites ("evals") gate       Deterministic unit/integration tests guard the
                       every prompt or model bump                    core; evals + fallback tests guard the AI step
    Outage handling    Model outage = site outage; requires          Circuit breaker + short timeout degrades
                       multi-provider failover and retries           cleanly to manual UI behind a feature flag
    System of truth    User edits and thumbs-up/down logs are the    Relational ledger stays authoritative; AI
                       core asset refining prompts/models            outputs are unconfirmed drafts until accepted
    Unit economics     Token/GPU spend is primary COGS (Cost of      Marginal add-on cost; easy to rate-limit,
                       Goods Sold, direct per-request serving cost)  cache, or bundle into paid tiers
    Operations         Continuous drift, latency, and rubric grading Track acceptance rate, human edit/revert rate
    

    Adding AI onto a conventional architecture is the better engineering choice whenever users already rely on an established workflow, regulatory or financial accuracy requires an exact audit trail, errors carry high dollar cost, and human-in-the-loop confirmation fits naturally into the UI.

  5. Part 3: Share concrete daily AI workflows, verification habits, and limits

    Strong engineering judgment shows up in the validation checks wrapped around AI assistance rather than in a catalog of IDE plugin names. Frame your daily usage as specific workflows paired with non-negotiable verification gates:

    Engineering workflow                        Verification habit before trusting it
    ------------------------------------------  ---------------------------------------------------------------
    Orient in an unfamiliar service ("trace     Open every cited file and line number; confirm actual runtime
    where webhook retries are scheduled")       flow with ripgrep, tests, or a debugger breakpoint
    Generate edge-case unit test scaffolding    Temporarily break the production branch under test to watch the
                                                new test fail first; read every assertion line by line
    Mechanical refactors and boilerplate        Keep diffs small; enforce static types, linter, full test suite,
    migrations                                  and self-review every changed line before opening a PR
    Draft exploratory SQL or data scripts       Validate against a slice with a hand-checked total; inspect
                                                JOIN keys so one-to-many joins do not silently multiply rows
    Triage a redacted stack trace or error      Treat suggestions as ranked hypotheses; reproduce the failure
                                                locally or in staging before writing a fix
    

    Pair those workflows with strict data hygiene and honest boundaries: - Data boundaries: Only use company-approved enterprise endpoints with contractual zero-retention / zero-training guarantees. Never paste secrets, API keys, customer PII (Personally Identifiable Information, such as names, SSNs, or bank numbers), or raw production payloads; strip and anonymize logs first. - Where I stop trusting AI tools: Invented flags or methods in niche library versions; subtle lock-ordering, race-condition, or distributed-consensus bugs; unmeasured performance claims ("this index makes it O(1)" — verify with EXPLAIN and benchmarks); and security-critical auth, permission checks, or cryptography where subtle bugs still pass happy-path tests. - Measure speedups rather than assuming them: Self-reported productivity feelings can be deceptive — for instance, in METR's 2025 randomized trial of experienced open-source maintainers working in their own codebases, tasks with AI tools took ~19% longer even though participants guessed they were ~20% faster. Track real PR cycle time and escaped bug rates.

  6. Part 4: Map AI dangers to concrete engineering controls

    Organize AI failure modes along two operational axes: blast-radius target and detection latency. Crashes and latency spikes page on-call within minutes; silent financial errors or cross-tenant data leaks can fester unnoticed for months unless you design explicit guardrails:

    Risk                                   Who is harmed     Visibility   Concrete control in a system I own
    -------------------------------------  ----------------  ----------   -------------------------------------------------
    Fluent wrong financial/tax advice      End users, brand  Slow/silent  Retrieval-augmented grounding (cite authoritative
                                                                          docs); compute all numbers in deterministic code;
                                                                          abstain when confidence/sources are missing
    Cross-tenant or PII data leakage       Users, business   Slow/silent  Enforce user ACLs inside the retrieval query
                                                                          before the prompt is built; scrub PII from logs
    Prompt injection & over-broad tools    Business, users   Fast on      Treat model output as untrusted user input;
    (e.g., agent tricked into moving $)                      exploit      read-only/least-privilege tools; human approval
                                                                          required before any state-changing write
    Token cost spikes & provider outages   Business          Immediate    Hard max-token caps, per-tenant budgets, strict
                                                                          timeouts, circuit breaker to non-AI workflow
    Silent quality drift on vendor update  Users, business   Slow         Pin immutable model snapshot IDs; gate upgrades
                                                                          with offline evals and a canary rollout (1%->100%)
    User over-trust (automation bias)      End users         Slow         Display inline citations, highlight uncertainty,
                                                                          require explicit user review on high-impact fields
    AI-generated code bugs, vulnerable     Business          Slow         Identical code-review bar, SAST/secret scanners,
    snippets, or hallucinated package names                               locked dependency allow-lists
    

    Here automation bias is the human tendency to stop checking an automated suggestion once it looks polished, and a canary rollout exposes a change to a tiny slice of live traffic (such as 1%–5%) while monitoring error and rollback metrics before full release.

    Close by showing proportional governance backed by a concrete monitoring calculation: - Scale controls to stakes: Internal note-drafting needs basic logging and edit-ability; customer-facing explanations need cited retrieval, kill switches, and continuous sampling; anything that files taxes, moves money, or changes credit/eligibility must be suggest-only, where deterministic rules and explicit user confirmation execute the action. - Size ongoing quality audits quantitatively: Suppose a customer-facing explanation feature serves 100,000 answers a day with a 2% error rate — that is 2,000 wrong answers every day, far too many to inspect manually. Instead, have domain graders score a random sample of 400 answers per week: when the true error rate is 2% (8 expected errors out of 400), the 95% margin of error is roughly ±1.4 percentage points, and an alert threshold of 13 or more bad answers in 400 triggers false alarms in only ~6% of healthy weeks while catching a regressions where errors double to 4% in ~81% of weeks.

Intuition & how it works

Calling a conventional backend service is like using a pocket calculator: identical inputs pass through explicit if/else rules and database transactions to produce the exact same verifiable output every time. Integrating a large language model (LLM) — a neural network trained to predict the next token (a common word piece of roughly four characters) — is closer to hiring a fast, well-read improvisation partner who continues text one piece at a time based on what sounds most probable and human-preferred: great at summarizing messy language, bad at exact arithmetic, and just as fluent when fabricating a fact as when stating a true one.

Treating an LLM call like a normal deterministic RPC falls short right away in production. Assuming temperature = 0 guarantees repeatability ignores GPU batching ties and vendor weight updates; letting the model add up dollar columns invites arithmetic hallucinations; concatenating untrusted user emails with system prompts opens the door to prompt injection (malicious input text overriding developer instructions); and launching without graded test cases leaves no way to spot silent accuracy regressions.

Walk through a concrete three-step request in a conventional bookkeeping app answering "Why did my software spend jump in March?": - Deterministic data step: Backend SQL enforces the signed-in user's tenant permissions and computes the exact ledger delta in code ($1,200 in February -> $1,950 in March, +$750 across two new vendor bills) — the LLM never touches raw math or other tenants' rows. - Bounded model step: The service sends those authorized summary rows (2,000 input tokens at $3/1M = $0.006) to a pinned model snapshot with a 500-token output cap ($15/1M = $0.0075, total $0.0135) to draft a cited two-sentence explanation. - Graceful fallback step: If the model times out, hits a rate cap, or fails citation validation, a circuit breaker drops the prose summary and renders the exact $750 ledger breakdown table so the core workflow never breaks.

Key points

  • Connect the training objective to production quirks. Pretraining optimizes next-token prediction, followed by supervised fine-tuning (SFT) on instruction pairs and preference tuning such as RLHF (Reinforcement Learning from Human Feedback) or DPO (Direct Preference Optimization) to match human preferences — explaining why outputs optimize for plausibility rather than ground-truth accuracy.
  • Price and architect around inference mechanics. Know the context window (max input + output tokens), parallel prefill populating the KV cache (saved attention state whose GPU memory scales with prompt length), sequential token-by-token decode (why long outputs dominate latency and cost), and temperature / top-p sampling, backed by quick unit economics ($0.0135/call = $13,500/day at 1M calls/day).
  • Use classic ML and LLMs for different jobs. Classic task-specific models (like gradient-boosted fraud classifiers evaluated by ROC AUC, the probability a random positive ranks above a random negative) deliver calibrated, sub-millisecond, cheap predictions when structured labels exist; LLMs shine on unstructured text and zero/few-shot in-context learning (adapting via prompt examples without retraining).
  • Use the unplug-the-model litmus test to separate AI-native from AI-augmented systems. When disabling model inference leaves zero usable product (a meeting summarizer), model evals, multi-model failover, and token COGS (Cost of Goods Sold, direct per-request serving cost) are the architecture; when a deterministic ledger remains intact (bookkeeping + AI categorization), keep the database authoritative and isolate AI behind feature flags and human confirmation.
  • Pair every daily AI coding workflow with a verification gate and strict data hygiene. Verify cited files in the IDE, prove AI-drafted tests fail on broken code, benchmark performance claims, never send secrets or PII (Personally Identifiable Information) to unapproved tools, and measure real cycle time instead of trusting perceived speedups.
  • Match each AI risk with an architectural control scaled to the stakes. Prioritize slow, invisible harms (silent wrong financial guidance, cross-tenant retrieval leaks, automation bias where users rubber-stamp polished errors) using permission-scoped retrieval, code-computed numbers, least-privilege tools, pinned model versions, and statistically sized human audits (e.g., grading 400 random answers/week).

Common mistakes

  • Describing an LLM as a "fact database" or claiming it "reasons like a human." Both mental models fail to predict why the model invents nonexistent APIs or changes its answer when prompt examples are reordered.
  • Claiming temperature = 0 guarantees 100% deterministic outputs. Floating-point non-associativity across dynamically batched GPU requests and unpinned provider updates can still flip near-tied tokens.
  • Defining AI-native vaguely as "uses lots of AI" instead of examining failure modes and sources of truth. Interviewers want to hear how testing, graceful degradation, data ownership, and unit cost diverge between the two designs.
  • Listing AI brand names instead of concrete engineering workflows and verification habits. Naming five coding assistants without mentioning test mutation, query-plan checks, or secret redaction signals careless reliance.
  • Treating prompt injection as solvable by writing sterner system-prompt warnings. Because instructions and untrusted data share one token stream, reliable defense requires architectural boundaries: permission checks in code, allow-listed read-only tools, and explicit user confirmation before side effects.
  • Reciting abstract societal AI worries without concrete backend mitigations. Acknowledge broad issues in one sentence, then focus on controls your service actually implements and monitors.

Follow-up questions

  • What launch gates would you enforce before embedding an LLM capability inside a strictly deterministic backend service? Require a clear task spec and offline evaluation dataset with an accuracy bar signed off by domain experts, while keeping every arithmetic calculation, ledger write, and permission check inside deterministic code rather than the model. Wrap the LLM call behind a feature flag, strict timeout, token budget, and kill switch so any model timeout or error falls back cleanly to the existing deterministic UI. Complete a security and privacy review covering prompt injection, PII redaction in logs, and vendor zero-training terms, then roll out gradually via an A/B test that tracks user task completion, edit/revert rates, and latency guardrails.
  • What criteria decide between consuming a managed vendor model API and self-hosting open-weight models on your own GPUs? Evaluate five concrete factors: quality on your own domain eval set, data-governance rules (residency and retention), unit cost at realistic GPU utilization, tail-latency SLAs, and whether your team wants an on-call GPU serving burden. For example, a $10/hour GPU server generating 2,000 tokens/second at 50% average utilization produces 3.6M tokens/hour, or roughly $2.78 per million tokens before engineering and idle-capacity overhead. In practice, start behind a thin internal model-gateway interface using a hosted API to validate product value fast, and self-host only when steady high volume, strict data-isolation rules, or custom fine-tuning justify operating GPUs.
  • How do you measure whether a shipped AI capability delivers genuine user value instead of superficial click engagement? Raw click or generation counts only measure curiosity or prominent button placement, not real value. Run a controlled A/B experiment comparing end-to-end task completion rate, time-to-complete, downstream support tickets, and — critically — how often users edit, undo, or revert accepted AI suggestions within the next week. If 30% of users click "Accept" on suggested expense categories but 40% of those accepted categories get manually changed later at tax time, the feature is creating cleanup work rather than helping.
  • How would you explain to a product partner why identical prompts yield different outputs over time, and how can you tighten consistency? Explain that four mechanisms cause day-to-day variation: random token sampling when temperature is above zero, GPU batching tie-breaks on close probabilities even at temperature zero, silent provider weight updates behind unpinned model aliases, and subtle prompt changes such as dynamic dates or newly retrieved documents. To maximize consistency, pin an immutable model snapshot ID, set temperature to zero, normalize and log the exact prompt payload, ground responses in fixed authoritative documents, constrain output schemas, and cache verified responses for identical deterministic queries.

Follow-up questions

Similar questions

More Intuit interview questions

All 34 Intuit questions →