TechSchool
Home / Interview questions / AI engineering / Google DeepMind

Google DeepMind AI Engineer Interview Questions

Short answers to 22 AI engineering questions asked at Google DeepMind.

Questions and answers (22)

Answers are written in plain English and reviewed for technical accuracy. Each answer states the point first, then the reason.

1. You are receiving an unbounded stream of event IDs. Return the k most frequent IDs seen so far, at any point, with bounded memory.

Use the Misra-Gries algorithm to keep at most k-1 counters. Each new ID either increments a counter, fills a free slot, or decrements all counters. The counts are approximate, but any ID above n/k frequency is always kept. Memory stays bounded at O(k).

def mg(stream, k):
    c = {}
    for x in stream:
        if x in c: c[x] += 1
        elif len(c) < k - 1: c[x] = 1
        else: c = {y: v - 1 for y, v in c.items() if v > 1}
    return c

2. Closest key: given a dictionary with letter keys and lists of letters as values, find the closest key.

Compare the target letter to each key and pick the key with the smallest distance. A simple approach scores each key by the position of the letter in its value list. The lowest score wins, and a missing letter gets a large score.

def closest_key(d, letter):
    best, score = None, float('inf')
    for k, v in d.items():
        s = v.index(letter) if letter in v else float('inf')
        if s < score: best, score = k, s
    return best

3. Write a function to compute root-mean-square error given y_pred and y_true lists.

Compute the mean of the squared differences between predictions and true values, then take the square root. RMSE has the same unit as the target, so it is easy to read. It penalizes large errors more than MAE does.

def rmse(y_pred, y_true):
    n = len(y_true)
    mse = sum((p - t) ** 2 for p, t in zip(y_pred, y_true)) / n
    return mse ** 0.5

4. Parse bigrams: extract two-word phrases from strings for NLP feature engineering.

Split each string into tokens, then join each adjacent pair into a bigram. Lowercase the text and drop punctuation first to reduce noise. A tokenizer that keeps word order makes this step simple.

import re
from collections import Counter
def bigrams(text):
    w = re.findall(r"[a-z0-9']+", text.lower())
    return Counter(zip(w, w[1:]))

5. Define the bias-variance trade-off and discuss the relationship between the two.

The bias-variance trade-off is the balance between underfitting and overfitting. Bias is error from wrong assumptions, and variance is error from sensitivity to training data. Total error equals bias squared plus variance plus irreducible noise. A more flexible model lowers bias but raises variance.

6. What are the assumptions of linear regression?

Linear regression assumes a linear relation between inputs and the expected target. It assumes independent errors with constant variance and zero mean. It also assumes no perfect multicollinearity and no strong measurement error in inputs.

7. Distinguish regularization from validation: when is each the right tool?

Regularization controls model complexity during training, and validation estimates generalization after training. Use regularization when the model overfits or weights grow large. Use validation to choose hyperparameters and to compare models. The two work together, because validation measures the effect of regularization.

8. Derive the gradient of cross-entropy loss with softmax inputs, and explain why we fuse them numerically.

For logits z and softmax p, the gradient of cross-entropy loss L is p minus the one-hot target y. This result is simple, so we fuse softmax and cross-entropy into one stable step. The fused form avoids overflow and underflow in exp. It also saves one backward pass and some FLOPs.

import numpy as np
def ce_grad(z, y):
    p = np.exp(z - z.max()) / np.exp(z - z.max()).sum()
    return p - y

9. Explain the SVD and give two places it shows up in modern deep learning.

SVD factors a matrix into two rotation matrices and a diagonal matrix of singular values. It shows up in LoRA, where low-rank factors approximate a weight update. It also shows up in model compression, where small singular values are dropped to shrink a weight matrix.

10. On average, how many fair coin flips until you see two heads in a row? Walk me through it.

The expected number of flips is 6. Let E0 be the expectation from no progress, E1 from one head, and E2 from two heads. The equations are E2 = 0, E1 = 1 + 0.5*E0, and E0 = 1 + 0.5*E1 + 0.5*E0. Solving gives E0 = 6.

11. When would you choose Q-learning over policy gradients, and vice versa?

Choose Q-learning for small discrete action spaces with cheap simulation. Choose policy gradients for large or continuous action spaces and for stochastic policies. Q-learning has lower sample cost per step but can be unstable with function approximation. Policy gradients have higher variance but handle continuous control well.

12. You have a binary loan-approval classifier and limited access to feature weights. How do you explain a rejection?

Use a local surrogate model such as LIME or SHAP to explain the rejection. These methods fit a simple model near the input and report the top features that push the score down. Give the applicant the top three reasons in plain language. This approach needs only black-box access to the classifier.

13. Your pretraining loss suddenly diverges at step 300k of a long run. Diagnose and fix it.

First suspect a learning-rate spike or bad data batch, then roll back and resume. Check the gradient norm and the loss curve just before step 300k. Lower the peak learning rate and add gradient clipping at norm 1.0. Skip or filter the corrupt shard if the data check finds it.

14. Design the training setup for a model that doesn't fit on one accelerator, say 70B parameters on a pod.

Use data parallelism, tensor parallelism, and pipeline parallelism together across the pod. Shard optimizer states with ZeRO stage 3 or FSDP to cut memory per device. Use activation checkpointing and mixed precision to fit the 70B model. Plan the parallel layout around the interconnect bandwidth of each node.

15. Design the serving system for a multimodal assistant (text + image in, streaming text out) at hundreds of millions of users.

Split the system into a stateless gateway, an image encoder service, and a streaming text decoder. Use a KV cache with paged attention to batch many requests on each GPU. Stream tokens to the client over server-sent events. Cache image embeddings and common prompts at the edge to cut load.

16. Design a personalised recommendation system for rental listings using demographics, property metadata, amenities, price, reviews and location.

Build a two-stage system with candidate generation and ranking. Use embeddings for user demographics, listing metadata, amenities, and location to retrieve candidates. Rank the candidates with a model that uses price and review features. Train on clicks and bookings, and add diversity and freshness rules.

17. Design a classifier that predicts the optimal moment to insert a commercial break in a video.

Frame the task as a binary classifier over candidate break points. Label each point with a reward signal such as watch time or retention after the break. Use features from the transcript, audio energy, scene changes, and viewer history. The tradeoff is label noise, because viewer drop-off has many causes.

18. How would you improve product search results, focusing on the fraction of relevant documents retrieved (recall)?

Add a dense retrieval stage and fuse it with the current keyword search. Dense embeddings catch synonyms and paraphrases that exact term matching misses. Measure recall at k on a labeled query set before and after the change. A common result is a clear recall gain at k=100 with a small latency cost.

19. Justify using a neural network for a given problem: what do you need to know about the network, dataset, timeline and business context?

You need to know the network size and type, the dataset size and label quality, the deadline, and the cost of errors. A neural network pays off when the data is large and the patterns are complex. It is a poor fit when the dataset is small or the timeline is short. State the baseline first, because a simple model often matches a network on small data.

20. Build the evaluation harness for a new frontier model release. What does it need to do?

The harness must run fixed benchmarks, compare against the prior model, and report scores with confidence intervals. It needs versioned prompts, deterministic decoding, and a stored result for every run. It must also cover safety checks and cost and latency. Keep a held-out set that no one tunes on.

21. Do 1 million Seattle ride trips suffice to build an accurate ETA prediction model? How would you decide?

One million trips can suffice, but the count alone does not decide it. Check coverage across hours, weather, and neighborhoods, and measure error on a held-out set. Compare against a simple baseline such as distance divided by average speed. If the model beats the baseline by a useful margin, the data is enough.

22. Tell me about a time you disagreed with a researcher or tech lead about priorities, and what happened.

I once argued for a smaller scope on a model launch and the lead agreed after we reviewed the risk. I proposed a staged rollout with a clear rollback plan. We shipped the core feature first and added the rest two weeks later. The result was a stable launch with no major incidents.

Related lessons
Ai agent intro Ai agent function calling Agent architecture Ai rag Retrieval augmented generation Vector database