← Adobe Interview Insights

Adobe·Machine Learning Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
Apr 2026

Summary

Adobe ML Engineer technical screen focused heavily on transformer internals, specifically Multi-Head Attention. The depth they expected was real, not just surface-level definitions. Came out feeling like I'd either nailed it or completely missed what they were looking for.

Questions Asked (6)

Q1

Walk through the full operation order inside Multi-Head Attention, step by step.

System DesignTechnical Trade-offs
Author's notes

I started with the Q/K/V projections and worked forward, but I stumbled a bit on where exactly the reshape happens relative to the score computation.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start with a high-level overview of the multi-head attention mechanism, then systematically walk through each operation from input projection to output projection. Emphasize the parallel nature of heads and the mathematical operations at each step, using clear notation and referencing the scaled dot-product attention formula.

Pro tip: Connect the operations to practical benefits like computational efficiency and model expressiveness, and mention how this design enables parallelization across heads, which is crucial for training large models on GPUs.

1. Input Projections

Explain that the input sequence is linearly projected into queries (Q), keys (K), and values (V) for each head using learned weight matrices. Mention that for h heads, the projections are split into lower-dimensional subspaces.

2. Scaled Dot-Product Attention

Describe how each head computes attention scores by taking the dot product of Q and K, scaling by sqrt(d_k), applying softmax to get attention weights, and then multiplying by V to produce the head's output.

3. Concatenation of Heads

After computing attention for all heads in parallel, concatenate the outputs from each head along the feature dimension to form a combined representation.

4. Final Linear Projection

Apply a final linear transformation to the concatenated output to produce the final multi-head attention output, which is then passed to subsequent layers.

Key Points to Mention

  • The role of learned weight matrices W_Q, W_K, W_V, and W_O in projecting inputs and outputs.
  • The scaling factor 1/sqrt(d_k) to prevent softmax saturation and stabilize gradients.
  • Parallel computation across multiple heads, each with reduced dimensionality d_k = d_model / h.
  • The softmax function applied to attention scores to obtain normalized weights.
  • The concatenation operation and final linear projection to combine head outputs.
  • Computational complexity O(n^2 * d) and how multi-head attention improves model capacity without significantly increasing cost.

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

Q2

Explain the Q, K, V projections and how the tensors get reshaped for multi-head computation.

System DesignTechnical Trade-offs
Author's notes

This felt more concrete so I was okay here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining Q, K, V as learned linear projections of the input, then explain the multi-head reshaping step-by-step with tensor dimensions. Emphasize why we split into heads (parallel subspace attention) and how the reshape/transpose operations enable batched matrix multiplication.

Pro tip: Mention that the reshape to (batch, seq_len, num_heads, head_dim) followed by transpose to (batch, num_heads, seq_len, head_dim) is a common source of bugs, and that frameworks like PyTorch often use view/permute or einops for clarity. Also note that head_dim = d_model / num_heads must be integer, and that the final output projection merges heads back.

1. Define Q, K, V projections

Explain that for each input token (or sequence element), we compute Q = X W_Q, K = X W_K, V = X W_V, where W_Q, W_K, W_V are learned weight matrices of shape (d_model, d_model). These projections allow the model to learn different representations for queries, keys, and values.

2. Introduce multi-head concept

State that instead of a single attention function, we split the d_model dimensions into h heads, each of size d_k = d_model / h. This lets the model attend to information from different representation subspaces at different positions.

3. Reshape and transpose tensors

Describe the tensor operations: from (batch, seq_len, d_model) reshape to (batch, seq_len, h, d_k), then transpose to (batch, h, seq_len, d_k). This layout enables efficient batched matrix multiplication for attention scores.

4. Compute scaled dot-product attention per head

Explain that for each head, we compute attention scores = softmax(Q K^T / sqrt(d_k)) V, resulting in tensors of shape (batch, h, seq_len, d_k). This is done in parallel across heads.

5. Concatenate heads and project output

Finally, transpose back to (batch, seq_len, h, d_k), reshape to (batch, seq_len, d_model) by concatenating heads, and apply a final linear projection W_O to mix information across heads.

Key Points to Mention

  • Q, K, V are linear projections of the input with learned weight matrices.
  • Multi-head splits d_model into h heads of size d_k = d_model / h.
  • Reshape from (batch, seq_len, d_model) to (batch, seq_len, h, d_k) then transpose to (batch, h, seq_len, d_k).
  • Attention is computed independently per head in parallel using batched matmul.
  • Outputs of all heads are concatenated and projected with W_O to produce final output.
  • Common pitfalls: incorrect reshape/transpose order, ensuring d_model divisible by h, and handling masks correctly across heads.

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

Q3

How are attention scores computed and what role does softmax play?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Pretty standard.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining attention as a mechanism to compute weighted sums of values based on query-key similarity. Explain the scaled dot-product attention formula: Attention(Q, K, V) = softmax(QK^T / sqrt(d_k)) V, and then detail how softmax converts raw scores into a probability distribution. Emphasize the role of softmax in normalizing scores and enabling differentiable, focused attention.

Pro tip: Mention the scaling factor sqrt(d_k) and explain that it prevents softmax saturation, which would lead to vanishing gradients. This shows depth beyond the basic formula.

1. Define attention and its purpose

Explain that attention computes a weighted sum of values, where weights reflect the relevance of each key to a given query. This allows the model to focus on relevant parts of the input.

2. Describe score computation

Detail how attention scores are computed as the dot product between queries and keys, optionally scaled by 1/sqrt(d_k) to stabilize gradients.

3. Explain softmax normalization

Describe how softmax converts raw scores into a probability distribution over the keys, ensuring weights sum to 1 and are non-negative.

4. Discuss weighted sum and output

Explain that the final output is a weighted sum of values, using the softmax weights, producing a context-aware representation.

5. Highlight benefits and trade-offs

Mention that softmax enables differentiable attention and interpretability, but can be computationally expensive for long sequences due to quadratic complexity.

Key Points to Mention

  • Scaled dot-product attention formula
  • Role of scaling factor sqrt(d_k)
  • Softmax as a normalization function
  • Differentiability and gradient flow
  • Interpretability of attention weights
  • Computational complexity O(n^2)

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

Q4

Why does Multi-Head Attention use four linear projections total rather than three?

System DesignTechnical Trade-offs
Author's notes

Blanked for a second on this one.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify that the four projections are for Q, K, V, and the output, and explain why each is necessary for the attention mechanism to function and integrate with the rest of the network. Emphasize that the output projection is not redundant but serves to mix information across heads and align dimensions for residual connections.

Pro tip: Mention that the output projection is crucial for combining the outputs of multiple heads into a single representation that matches the model dimension, which is essential for residual connections and layer normalization. This shows you understand the architectural constraints of Transformers.

1. Define the four projections

State that Multi-Head Attention uses linear projections to generate Query (Q), Key (K), Value (V), and the final output. Each projection has its own learned weight matrix.

2. Explain the role of Q, K, V

Describe how Q and K are used to compute attention scores, and V is used to compute the weighted sum. These three projections are fundamental to the scaled dot-product attention mechanism.

3. Justify the output projection

Explain that after concatenating the outputs from all heads, a final linear projection (the fourth) is applied to mix information across heads and project back to the model dimension, ensuring compatibility with residual connections and subsequent layers.

4. Discuss the necessity of four vs three

Argue that without the output projection, the concatenated multi-head outputs would not be properly integrated, and the model would lose the ability to learn cross-head interactions. Also, the output projection ensures the dimensionality matches the input for residual addition.

5. Connect to practical implications

Highlight that this design allows each head to focus on different representation subspaces, and the output projection combines them effectively, which is key to the success of Transformers in various tasks.

Key Points to Mention

  • The four projections are for Q, K, V, and output.
  • Q, K, V projections enable the attention mechanism to compute context-aware representations.
  • The output projection mixes information from multiple heads and projects to the model dimension.
  • Residual connections require the output dimension to match the input dimension, which the output projection ensures.
  • Without the output projection, the multi-head outputs would be concatenated but not integrated, limiting model capacity.
  • The output projection adds parameters and computation but is essential for performance, as shown in ablation studies.

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

Q5

Do a FLOPs analysis of the self-attention mechanism.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I've done this before but never under pressure.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the self-attention operation and its inputs, then derive the FLOPs for each matrix multiplication and softmax step, and finally express the total FLOPs in terms of sequence length and model dimension. Conclude by discussing the quadratic scaling with sequence length and its implications for efficiency.

Pro tip: Mention that FLOPs count only multiply-add operations and ignore memory access, but in practice memory bandwidth often dominates; this shows awareness of real-world performance beyond theoretical counts.

1. Define inputs and operations

State that self-attention takes an input sequence of length n and dimension d, and produces queries, keys, and values via linear projections. List the core operations: QK^T, softmax, and attention-weighted sum of V.

2. Compute FLOPs for QK^T

For each of the n^2 pairs, computing the dot product of two d-dimensional vectors requires d multiplications and d-1 additions, so approximately 2nd FLOPs per pair, totaling 2n^2d FLOPs.

3. Compute FLOPs for softmax

Softmax involves exponentiation, summation, and division for each of the n^2 entries. Exponentiation is typically counted as multiple FLOPs, but a common simplification is to count it as a few FLOPs per element, leading to O(n^2) FLOPs, which is negligible compared to the matrix multiplications for large d.

4. Compute FLOPs for attention-weighted sum

Multiplying the n x n attention matrix by the n x d value matrix requires n^2 * d multiply-adds, i.e., 2n^2d FLOPs.

5. Sum and analyze scaling

Total FLOPs for self-attention (excluding projections) is approximately 4n^2d. Note the quadratic dependence on sequence length n and linear in d. Discuss how this compares to other operations and the impact on long sequences.

Key Points to Mention

  • Self-attention FLOPs scale quadratically with sequence length (O(n^2 d)) and linearly with model dimension.
  • The dominant cost comes from the two matrix multiplications: QK^T and attention*V, each contributing 2n^2d FLOPs.
  • Softmax FLOPs are O(n^2) and often negligible for large d, but can matter for small d.
  • Linear projections for Q, K, V add additional FLOPs: 3 * 2n d^2 = 6n d^2, which may dominate for short sequences.
  • FLOPs count only multiply-adds; memory access and parallelism also affect actual runtime.
  • Practical implications: quadratic scaling motivates efficient attention variants (e.g., sparse, linear, or kernelized attention).

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

Q6

Why is the computational complexity of self-attention O(S^2) with respect to sequence length?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The QK^T product is the culprit since every token attends to every other token, so you get S times S dot products.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the self-attention mechanism and its core operations, then derive the complexity by analyzing the matrix multiplications involved. Conclude by discussing the implications of this quadratic complexity and potential optimizations.

Pro tip: Mention that while the complexity is O(S^2), the constant factors and memory access patterns often make self-attention the bottleneck in practice, and briefly touch on efficient attention variants like Linformer or Performer.

1. Define self-attention

Explain that self-attention computes a weighted sum of values based on pairwise similarities between all positions in the sequence.

2. Identify key operations

Break down the computation into: (1) computing query, key, and value projections, (2) computing attention scores via query-key dot products, (3) applying softmax, and (4) computing weighted sum of values.

3. Analyze complexity of each operation

Show that the query-key dot product involves multiplying an S x d matrix by a d x S matrix, resulting in O(S^2 d) operations. Similarly, the weighted sum of values is O(S^2 d).

4. Conclude overall complexity

Since d is typically fixed and smaller than S, the dominant term is O(S^2). Thus, the overall time complexity is quadratic in sequence length.

5. Discuss implications and optimizations

Mention that this quadratic scaling limits the use of self-attention for long sequences and briefly note approaches to reduce complexity, such as sparse attention or low-rank approximations.

Key Points to Mention

  • Self-attention computes pairwise interactions between all positions in the sequence.
  • The attention score matrix is of size S x S, requiring O(S^2) memory and computation.
  • Matrix multiplications QK^T and attention*V each take O(S^2 d) time.
  • Since d is usually fixed (e.g., 64, 128), the complexity simplifies to O(S^2).
  • This quadratic complexity is a bottleneck for long sequences, motivating efficient attention mechanisms.
  • Practical implementations may have different constant factors, but the asymptotic behavior remains quadratic.

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