← Google Interview Insights

Google·Software Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Conceptual LLM interview at Google for a software engineering role, covering Transformer architecture, fine-tuning strategies, and inference-time steering. No coding, just reasoning through trade-offs, which honestly felt harder in some ways.

Questions Asked (10)

Q1

Walk through how a decoder-only Transformer converts input tokens into a next-token prediction. Cover the query/key/value projections, how attention weights are formed, why multiple heads are used, how position is encoded, what the feed-forward sublayers do, and why attention cost scales quadratically with sequence length.

System DesignTechnical Trade-offs
Author's notes

This is a lot to hold in your head at once.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start with a high-level overview of the decoder-only Transformer architecture, then dive into the key components: token embeddings, positional encoding, self-attention with Q/K/V projections, multi-head attention, feed-forward networks, and the final output projection. Conclude by explaining the quadratic scaling of attention with sequence length and its implications.

Pro tip: Emphasize the causal masking in self-attention that ensures each position can only attend to previous positions, which is crucial for autoregressive next-token prediction. Also, connect the quadratic cost to practical trade-offs like context window limits and the need for efficient attention variants.

1. Input Representation

Explain how input tokens are embedded into vectors and combined with positional encodings to inject sequence order information.

2. Self-Attention Mechanism

Describe how query, key, and value projections are computed, how attention weights are formed via scaled dot-product and softmax, and how multiple heads capture diverse relationships.

3. Feed-Forward Sublayers

Discuss the role of position-wise feed-forward networks in transforming representations and introducing non-linearity.

4. Output Generation

Explain how the final hidden states are projected to vocabulary logits and converted to probabilities for next-token prediction.

5. Complexity Analysis

Analyze why self-attention scales quadratically with sequence length and mention its impact on training and inference.

Key Points to Mention

  • Causal masking in self-attention to prevent attending to future tokens
  • Scaled dot-product attention formula: softmax(QK^T / sqrt(d_k))V
  • Multi-head attention allows the model to jointly attend to information from different representation subspaces
  • Positional encodings (e.g., learned or sinusoidal) to provide sequence order
  • Feed-forward networks are applied position-wise and typically consist of two linear layers with a ReLU activation
  • Quadratic complexity O(n^2) in sequence length due to pairwise attention computations

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

What does 'post-training' mean, and why is a raw pretrained base model usually not useful as a product assistant straight out of the box?

Technical Trade-offsAdaptability & Ambiguity
Author's notes

Framed it around the pretraining objective: predicting next tokens over web text doesn't teach the model to follow instructions or refuse harmful requests.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Define post-training as the stage after pretraining where the model is aligned to follow instructions, be helpful, and avoid harmful outputs. Then explain why a raw base model, which only predicts the next token from web text, lacks instruction-following, safety, and conversational abilities, making it unsuitable as a product assistant. Emphasize the trade-offs and the need for additional training to meet product requirements.

Pro tip: Mention that post-training is not just about fine-tuning but also involves alignment techniques like RLHF and safety filters, and that even after post-training, continuous evaluation and iteration are needed to handle edge cases in production.

1. Define post-training

Explain that post-training encompasses techniques like supervised fine-tuning, reinforcement learning from human feedback (RLHF), and safety tuning applied after pretraining to align the model with human instructions and values.

2. Describe raw pretrained model behavior

Clarify that a raw base model is trained solely on next-token prediction over large text corpora, so it may generate completions but does not inherently follow instructions, stay on topic, or refuse harmful requests.

3. Highlight missing capabilities for product use

List key gaps: lack of instruction-following, inconsistent helpfulness, potential to produce biased or toxic content, and inability to maintain conversational context or adhere to safety guidelines.

4. Connect to product requirements

Explain that a product assistant must be reliable, safe, and user-friendly, which requires post-training to shape behavior, reduce hallucinations, and align with company policies and user expectations.

5. Conclude with trade-offs and iteration

Acknowledge that post-training adds complexity and cost but is essential; also note that even post-trained models need ongoing evaluation and refinement to handle diverse real-world inputs.

Key Points to Mention

  • Pretraining vs. post-training: pretraining learns general language patterns, post-training aligns to specific tasks and human values.
  • Instruction following: base models may not follow prompts as commands; they simply continue text.
  • Safety and alignment: post-training includes techniques like RLHF to reduce harmful, biased, or toxic outputs.
  • Helpfulness and conversational ability: post-training teaches the model to be helpful, concise, and context-aware.
  • Product constraints: a product assistant must meet reliability, safety, and brand voice standards, which base models fail.
  • Continuous improvement: post-training is not a one-time fix; ongoing evaluation and fine-tuning are needed for production.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Compare supervised fine-tuning with preference-based optimization methods like RLHF and DPO. What problem does each solve and how do they differ mechanically?

Technical Trade-offsSystem Design
Author's notes

Knew SFT well.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the core objective of each method: SFT teaches a model to imitate high-quality demonstrations, while RLHF and DPO optimize a model to align with human preferences beyond mere imitation. Then contrast their mechanics: SFT uses supervised next-token prediction on curated data, RLHF trains a reward model and uses reinforcement learning to maximize it, and DPO directly optimizes the policy on preference pairs without a separate reward model. Conclude by discussing trade-offs in complexity, stability, and data efficiency.

Pro tip: Emphasize that DPO is not just 'RLHF without RL'—it implicitly learns a reward function from preferences, which changes the optimization landscape and often requires careful hyperparameter tuning to avoid overfitting to the preference dataset.

1. Define SFT and its problem

Explain that SFT solves the problem of teaching a base model to follow instructions and produce coherent, task-specific outputs by maximizing the likelihood of human-written demonstrations.

2. Introduce preference-based methods

Describe how RLHF and DPO address the limitation that SFT cannot capture nuanced human preferences (e.g., helpfulness, harmlessness) because it only imitates positive examples without learning from comparisons.

3. Contrast mechanics of RLHF and DPO

Detail RLHF: train a reward model on human preference pairs, then use an RL algorithm (e.g., PPO) to maximize reward while staying close to the SFT policy. Detail DPO: directly optimize the policy on preference pairs using a closed-form loss that implicitly represents the reward, eliminating the need for a separate reward model and RL loop.

4. Discuss trade-offs and practical considerations

Compare computational cost, stability, and data efficiency: RLHF is more complex and unstable but can leverage online sampling; DPO is simpler and more stable but may be prone to overfitting and lacks exploration.

5. Summarize when to use each

Conclude that SFT is a prerequisite for both, RLHF is preferred when you have abundant compute and need fine-grained control, while DPO is attractive for its simplicity and strong performance in many alignment tasks.

Key Points to Mention

  • SFT maximizes likelihood of demonstrations; it's a form of imitation learning.
  • RLHF involves training a reward model on human preferences and then using reinforcement learning (e.g., PPO) to optimize the policy.
  • DPO directly optimizes the policy on preference pairs using a loss derived from the Bradley-Terry model, bypassing explicit reward modeling and RL.
  • RLHF can suffer from reward hacking and requires careful KL regularization; DPO avoids RL instability but may overfit to the preference dataset.
  • Both RLHF and DPO require a base SFT model to start from; they are not replacements for SFT but refinements.
  • DPO is often more computationally efficient and easier to implement, but RLHF can potentially achieve better performance with online data collection.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

Compare full fine-tuning against parameter-efficient methods like LoRA. What does LoRA actually train, and what practical advantages does that give you?

Technical Trade-offsSystem Design
Author's notes

LoRA injects low-rank update matrices alongside the frozen originals, so you're training a tiny fraction of parameters.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clearly defining what full fine-tuning updates versus what LoRA trains, then contrast them across memory, compute, storage, and deployment dimensions. Use concrete examples or numbers to illustrate trade-offs, and tie the advantages back to practical scenarios like multi-task serving or rapid iteration.

Pro tip: Mention that LoRA's low-rank update can be merged back into the base weights at inference time, giving zero added latency—this shows you understand both training and serving implications. Also note that LoRA enables efficient multi-tenant serving by swapping small adapters instead of full models.

1. Define full fine-tuning

Explain that full fine-tuning updates all parameters of the pre-trained model, requiring gradients and optimizer states for every weight.

2. Explain LoRA's mechanism

Describe how LoRA freezes the base model and injects trainable low-rank matrices (A and B) into each layer, so only these small matrices are updated.

3. Compare resource requirements

Contrast memory, compute, and storage: full fine-tuning needs multiple copies of the model for gradients/optimizer states, while LoRA drastically reduces trainable parameters and memory footprint.

4. Highlight practical advantages

Discuss benefits like faster training, lower hardware requirements, easy sharing of adapters, and the ability to merge LoRA weights for inference with no latency overhead.

5. Address trade-offs and use cases

Acknowledge that full fine-tuning may achieve slightly better performance on some tasks, but LoRA is preferred for resource-constrained or multi-task scenarios.

Key Points to Mention

  • LoRA trains only low-rank decomposition matrices (A and B) while freezing the original weights.
  • Full fine-tuning updates all model parameters, requiring optimizer states and gradients for each.
  • LoRA reduces trainable parameters by orders of magnitude, leading to lower GPU memory and faster training.
  • Adapters can be stored and swapped easily, enabling efficient multi-task serving.
  • LoRA weights can be merged into base model for inference, eliminating added latency.
  • Full fine-tuning may yield marginally better accuracy but at much higher cost.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

Given a new task with limited labeled data and a cost/latency budget, how do you decide between prompting, retrieval-augmented generation, and fine-tuning?

Technical Trade-offsAdaptability & AmbiguityProduct Strategy
Author's notes

My answer was roughly: start with prompting, add RAG if the task needs fresh or private knowledge, fine-tune only when you have enough data and prompting has clearly hit a ceiling.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the task requirements, data availability, and budget constraints, then systematically evaluate each approach against criteria like data efficiency, latency, cost, and maintainability. Recommend a hybrid or staged approach, beginning with the simplest method that meets requirements and iterating based on performance and cost metrics.

Pro tip: Emphasize that you would prototype quickly with prompting and RAG before committing to fine-tuning, and always measure cost per query and latency in production-like conditions to make data-driven decisions.

1. Clarify Requirements and Constraints

Ask questions to understand the task complexity, available labeled data, latency and cost budgets, and expected quality. This ensures the decision is grounded in actual needs.

2. Evaluate Prompting First

Assess if a well-crafted prompt with a large language model can achieve acceptable performance. Prompting is fastest to implement and has low upfront cost, but may lack domain specificity.

3. Consider RAG for Knowledge-Intensive Tasks

If the task requires up-to-date or proprietary knowledge, RAG can augment prompting with relevant documents. It balances cost and latency by avoiding fine-tuning while improving accuracy.

4. Assess Fine-Tuning for Specialized Needs

If prompting and RAG fall short and you have sufficient labeled data, fine-tuning can improve performance. However, it incurs higher training cost, latency, and maintenance overhead.

5. Prototype, Measure, and Iterate

Implement a quick prototype of the most promising approach, measure key metrics (accuracy, latency, cost), and iterate. Be prepared to combine methods or switch based on results.

Key Points to Mention

  • Data efficiency: fine-tuning requires more labeled data than prompting or RAG.
  • Latency and cost: prompting and RAG typically have lower latency and cost per query than fine-tuning, but RAG adds retrieval overhead.
  • Task complexity: simple tasks may be solved with prompting; complex, domain-specific tasks may need fine-tuning.
  • Maintenance: fine-tuned models need retraining as data drifts, while RAG can update the knowledge base easily.
  • Hybrid approaches: combining RAG with fine-tuning or prompting can leverage strengths of each.
  • Evaluation metrics: define clear metrics (e.g., accuracy, F1, latency, cost) to compare approaches objectively.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q6

With a fully frozen hosted model, what levers do you have to steer its behavior? Cover zero-shot, few-shot, chain-of-thought prompting, system prompts, structured output elicitation, and RAG.

Technical Trade-offsAPI & Integrations
Author's notes

Went through these in roughly that order.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Frame the answer around the idea that even with a frozen model, you control the input context and output constraints. Systematically cover each lever (system prompts, zero-shot, few-shot, chain-of-thought, structured output, RAG), explaining what each does and when to use it. Emphasize trade-offs like cost, latency, and reliability, and how to combine levers for robust behavior.

Pro tip: Mention that system prompts and few-shot examples are often the cheapest and fastest levers, while RAG and structured output add complexity but unlock grounding and reliability. Also note that chain-of-thought can be elicited zero-shot with 'Let's think step by step' or few-shot with examples, but may increase latency and token usage.

1. Clarify the premise

Acknowledge that the model weights are frozen, so all steering happens via input context and output parsing. This sets the stage for discussing prompt engineering and retrieval.

2. Cover prompt-based levers

Explain system prompts (set role, tone, constraints), zero-shot (direct instruction), few-shot (provide examples), and chain-of-thought (elicit reasoning). For each, give a brief use case and trade-off.

3. Discuss structured output elicitation

Describe techniques like JSON mode, function calling, or explicit formatting instructions to get parseable outputs. Mention that this often requires few-shot examples or schema definitions.

4. Explain RAG

Detail how retrieval-augmented generation injects relevant documents into the prompt to ground responses in external knowledge, reducing hallucinations and enabling up-to-date information.

5. Synthesize and prioritize

Summarize how to choose levers based on requirements (e.g., start with system prompts and few-shot, add RAG for knowledge, structured output for integration). Highlight that levers can be combined.

Key Points to Mention

  • System prompts set global behavior and constraints (e.g., role, tone, safety).
  • Zero-shot prompting works for simple tasks but may lack precision; few-shot improves reliability by providing examples.
  • Chain-of-thought prompting elicits step-by-step reasoning, improving accuracy on complex tasks, but increases token usage and latency.
  • Structured output elicitation (e.g., JSON mode, function calling) ensures parseable responses for downstream systems.
  • RAG grounds the model in external knowledge, reducing hallucinations and enabling access to private or up-to-date data.
  • Trade-offs: cost, latency, reliability, and complexity vary across levers; combine them strategically.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q7

How does the quadratic attention cost relate to context window limits in practice, and what techniques exist to reduce it?

System DesignTechnical Trade-offs
Author's notes

KV caching I described correctly.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining that standard self-attention has O(n^2) time and memory complexity with respect to sequence length, which directly limits the context window due to quadratic growth. Then discuss practical implications like GPU memory constraints and latency, and finally survey techniques to reduce the cost, such as sparse attention, low-rank approximations, and kernel methods. Emphasize trade-offs between efficiency and model quality.

Pro tip: Mention that Google's own work like Performer, BigBird, and Reformer tackle this, and that in practice, context window limits are often set by memory bandwidth and quadratic memory, not just compute. Also note that reducing attention cost can introduce approximation errors that may hurt downstream tasks.

1. Define the quadratic cost

Explain that self-attention computes pairwise interactions between all tokens, resulting in O(n^2) time and memory complexity for sequence length n. This means doubling context length quadruples compute and memory.

2. Relate to context window limits

Discuss how this quadratic scaling makes long contexts impractical: memory limits (e.g., GPU RAM) and latency grow quadratically, forcing a trade-off between context length and batch size or model size. In practice, context windows are often capped at a few thousand tokens.

3. Survey reduction techniques

Cover major approaches: sparse attention (e.g., Longformer, BigBird), low-rank approximations (e.g., Linformer), kernel-based methods (e.g., Performer), recurrence (e.g., Transformer-XL), and block-wise or local attention. Mention that some methods achieve linear or near-linear complexity.

4. Discuss trade-offs and practical considerations

Highlight that these techniques often trade accuracy for efficiency, and may not work for all tasks. Also mention hardware-aware optimizations like FlashAttention that reduce memory overhead without changing asymptotic complexity.

5. Conclude with Google-specific context

If relevant, mention Google's contributions like Performer, BigBird, or Reformer, and how they enable longer contexts in production systems. Emphasize that the choice depends on the application's tolerance for approximation and available hardware.

Key Points to Mention

  • O(n^2) time and memory complexity of standard self-attention
  • Quadratic growth limits context window due to GPU memory and latency constraints
  • Sparse attention patterns (e.g., local, global, random) reduce complexity to O(n)
  • Low-rank approximations (e.g., Linformer) project keys/values to lower dimension
  • Kernel-based methods (e.g., Performer) use random features for linear attention
  • Trade-offs: approximation error, model quality, and implementation complexity
  • Hardware optimizations like FlashAttention improve memory efficiency but not asymptotic complexity

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q8

What is catastrophic forgetting and how does it factor into choosing between full fine-tuning and LoRA?

Technical Trade-offs
Author's notes

Full fine-tuning on a small domain dataset can overwrite general capabilities baked in during pretraining.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Define catastrophic forgetting clearly, then explain how it manifests differently in full fine-tuning versus LoRA. Frame the trade-off in terms of when preserving general knowledge matters versus when task-specific adaptation is acceptable, and tie it to practical engineering decisions.

Pro tip: Mention that LoRA's low-rank update acts as an implicit regularizer, often reducing forgetting without explicit replay or regularization techniques—this shows you understand the mechanism, not just the outcome.

1. Define catastrophic forgetting

Explain that it's the tendency of a model to lose previously learned knowledge when fine-tuned on a new task, especially with small datasets or high learning rates.

2. Contrast full fine-tuning vs. LoRA

Full fine-tuning updates all weights, risking large drift from the pretrained distribution; LoRA freezes base weights and learns low-rank updates, limiting drift.

3. Connect to trade-offs

Discuss how LoRA reduces forgetting but may underfit complex tasks; full fine-tuning can achieve higher task performance but may degrade general capabilities.

4. Provide decision criteria

Suggest factors: task similarity to pretraining, dataset size, compute budget, and whether the model must retain broad knowledge (e.g., multi-task serving).

5. Conclude with practical recommendation

State that LoRA is often preferred when forgetting is a concern or resources are limited, while full fine-tuning is chosen when maximal task performance justifies the risk.

Key Points to Mention

  • Catastrophic forgetting definition and causes (distribution shift, overfitting to new task)
  • Full fine-tuning updates all parameters, leading to higher risk of forgetting
  • LoRA freezes pretrained weights and learns low-rank updates, acting as a regularizer
  • Trade-off: LoRA may underperform on tasks requiring large model changes
  • Factors: task similarity, dataset size, compute budget, need to preserve general knowledge
  • Mitigation strategies: rehearsal, elastic weight consolidation, or LoRA's implicit regularization

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q9

A model confidently states a false fact. How do you diagnose whether the fix is a prompt change, RAG, or fine-tuning?

Root Cause AnalysisTechnical Trade-offsAdaptability & Ambiguity
Author's notes

This was the most interesting follow-up.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing the problem as a diagnostic exercise: identify the root cause of the hallucination before jumping to solutions. Then evaluate each fix (prompt, RAG, fine-tuning) against criteria like cost, latency, accuracy, and maintainability, and propose a decision framework that prioritizes the simplest effective intervention.

Pro tip: Emphasize that you would first check if the model lacks knowledge (fine-tuning or RAG) versus fails to use existing knowledge correctly (prompt or RAG). This distinction often reveals that fine-tuning is overkill and a prompt or retrieval fix suffices.

1. Reproduce and Characterize the Error

Determine if the false fact is consistent or sporadic, and whether it occurs for specific queries or across the board. This helps isolate whether the issue is knowledge-based or reasoning-based.

2. Assess Model's Internal Knowledge

Probe the model with variations of the question to see if it ever produces the correct fact. If it never does, the knowledge is likely missing or corrupted, pointing to RAG or fine-tuning.

3. Evaluate Prompt Sensitivity

Test if rephrasing the prompt, adding context, or using few-shot examples corrects the error. If yes, a prompt change is the cheapest and fastest fix.

4. Test Retrieval Augmentation

If the knowledge exists externally, try RAG by providing relevant documents. If the model then answers correctly, RAG is a viable solution that avoids retraining.

5. Consider Fine-Tuning as Last Resort

If the knowledge is proprietary, must be internalized, and prompt/RAG fail, fine-tuning may be needed. Weigh its high cost and maintenance against the benefits.

Key Points to Mention

  • Root cause analysis: distinguish between missing knowledge, retrieval failure, and reasoning error.
  • Cost-benefit analysis: prompt changes are cheap and fast; RAG adds latency and infrastructure; fine-tuning is expensive and slow.
  • Data availability: RAG requires a knowledge base; fine-tuning requires labeled data.
  • Latency and scalability: RAG can increase response time; fine-tuning bakes knowledge into the model.
  • Maintenance: RAG allows easy updates; fine-tuning requires retraining for updates.
  • Evaluation metrics: define how to measure success (accuracy, factuality, etc.) before choosing a fix.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q10

How would you actually evaluate whether a fine-tune or a prompt change improved the product, beyond manually checking a few outputs?

A/B Testing & ExperimentationProduct Analytics & Metrics
Author's notes

Talked about held-out eval sets, automated metrics where applicable, and ideally an online A/B test on real traffic.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining clear, measurable product metrics that the fine-tune or prompt change is intended to impact, then design a controlled experiment (A/B test) with proper randomization and sample size. Emphasize the importance of offline evaluation with a held-out dataset and online metrics, and discuss how to interpret results with statistical rigor.

Pro tip: Always pre-register your hypothesis and success metrics before running the experiment to avoid p-hacking and to ensure stakeholders agree on what 'improvement' means. Also, consider guardrail metrics to catch unintended regressions.

1. Define success metrics

Identify primary and secondary metrics that reflect product goals, such as task success rate, user engagement, or conversion. Ensure they are measurable and tied to the change.

2. Set up offline evaluation

Use a held-out test set to compare the fine-tuned model or new prompt against the baseline, measuring metrics like accuracy, F1, or BLEU. This provides a quick sanity check before online testing.

3. Design and run an A/B test

Randomly assign users to control (old model/prompt) and treatment (new model/prompt) groups. Determine sample size via power analysis and run the test for a sufficient duration to capture meaningful effects.

4. Analyze results with statistical rigor

Use hypothesis testing (e.g., t-test, bootstrap) to determine if differences are statistically significant. Check for practical significance and confidence intervals.

5. Monitor guardrail metrics and iterate

Track metrics like latency, cost, or user satisfaction to ensure no unintended harm. If results are inconclusive or negative, iterate on the model or prompt.

Key Points to Mention

  • Define clear, quantifiable metrics aligned with product goals (e.g., CTR, task completion rate).
  • Use offline evaluation with a held-out dataset for quick iteration before online testing.
  • Conduct A/B tests with proper randomization, control groups, and sufficient sample size.
  • Apply statistical significance testing and consider practical significance (effect size).
  • Monitor guardrail metrics to detect regressions in latency, cost, or user experience.
  • Avoid common pitfalls like peeking, multiple comparisons, and ignoring novelty effects.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.