Courses · Machine learning coding
Machine learning coding interview questions
The round where you are handed an empty editor and asked to write softmax, backpropagation or k-means without a library. 40 problems in 12 lessons, each with a live Python and NumPy editor, the tests it will be judged on, and a worked solution.
- 12 lessons
- 40 problems
- 14 easy · 23 medium · 3 hard
- Python and NumPy in the page
Before the interview: the details that break when machine learning is written from scratch.
Course outline
12 lessons and 40 problems: 14 easy, 23 medium, 3 hard. Read the lesson, then solve its problems in order.
What this round tests
ML engineering and research interviews at large technology companies, AI labs and quant funds increasingly include a round that is neither LeetCode nor theory. You implement a piece of machine learning from first principles, in NumPy, and the interviewer watches how you handle shapes, numerical stability and the conventions that libraries normally hide.
The problems below are the ones that come up: a softmax that survives a logit of 1000, the gradient of a two-layer network by hand, attention with a causal mask, batch norm's two variances, k-means with an empty cluster, PCA with a sign convention, AUC with tied scores. Each is short. Each has one detail that most candidates miss, and the tests are written to find it.
How each problem works
- A real editor. Python 3 with NumPy runs in your browser. Nothing to install, and your code never leaves your machine.
- The real tests. Every problem is judged on a fixed table of cases, compared within a stated floating-point tolerance, including the overflow and tie cases that catch people.
- Checked solutions. Every reference solution is verified before publication against an independent slow implementation: exact rational or 60-digit arithmetic, brute force, or finite differences for gradients, on the published tests and on 40 random inputs.
- Timed attempts. Start the clock to work at interview pace, with a target time for each problem.
- Ask AI about any line of a statement or a solution.
Related practice
Statistics and machine learning questions
The theory round: bias and variance, regularisation, metrics, probability, with worked answers.
Statistics and ML questions → ·Coding interview course
Algorithms and data structures by pattern, solved in six languages, with an interview mode.
Coding interview practice → ·Quant research interviews
What trading firms test for research roles, and how the strategy hour can help with a live process.
Quant interview preparation →Common questions
Which companies ask machine learning coding questions?
Machine learning engineer and research scientist loops at large technology companies and AI labs often include one implementation round, and quant funds ask research candidates for the statistics and linear algebra versions: PCA, regression, rank correlation. The format varies; the content is remarkably consistent, which is why a short list of problems covers most of it.
Can I use PyTorch or scikit-learn in the interview?
Usually not for the core of the problem. You are typically allowed NumPy, and asked to write the model, the loss or the layer yourself. The interviewer wants to see that you know what the library does, so these problems are set up the same way.
How much maths do I need?
Matrix calculus at the level of differentiating a loss with respect to a weight matrix, basic probability, and the idea of an eigenvector. Each lesson derives what its problems use, so the lessons double as revision.
Why are answers compared with a tolerance?
Two correct implementations of the same formula can differ in the last few digits because they add numbers in a different order. Every problem states its tolerance, typically a relative error of one in a billion, which is tight enough to catch a wrong formula and loose enough to accept any correct one.
Book the strategy hour — £250 What the hour covers →
Paid in full, in advance. No refunds. Full terms