૮ ⚆ﻌ⚆ა Two Pug ૮ –ﻌ⚆ა

Interview Prep: The ML Grind

Screenshot 2025-11-29 at 151

Important: don't skip this, don't reorder, don't try to be too creative, follow the sequence. It will save you weeks of struggling.

The Tricks

These two together are learning multipliers. I genuinely would not have made it far without being pointed at both. Treat them as required, not "nice to have".

Practice

You will have to do both

Core - Pure NumPy, Implement FWD + BWD

These lock in your intuition for matmul flow, activation flow, and gradient flow. If you can't do these cleanly, everything later will feel like black magic.

Do the implementation if your role is more ML-heavy

Infra-leaning roles usually don't require writing this from scratch but you need to understand their impact on e2e performance.

As you work through exercises above, make sure you can answer the actual interview question to tie everything together.

One-Pager References - don't underestimate these.

Make lots of small, dense one-pagers - color-coded, quick to flip through:

This accelerates repetition and makes the whole grind way faster.

NumPy Broadcasting

    Shape A (9, 1, 3):  9 x 1 x 3
    Shape B (4, 1):     1 x 4 x 1
    After broadcast:    9 x 4 x 3

Matrix Multiplication

"..." - additional dimensions which will follow the broadcast rule above

Expression Result
(..., M, K) @ (..., K, N) (..., M, N)
K @ K scalar
M × K @ K M
K @ K × N N
... M K @ K ... ... M
K @ ... K N ... N

Reshape/View

In the einsum section, I mentioned you don't have to deal with reshapes, but that's not entirely true. In many interviews, you'll encounter existing codebases full of reshapes, and you'll need to know how to reason through them.

Flatten

x = torch.randn(3, 4, 5)
x.reshape(-1)  # Shape: [60]

Flatten keep batch dim

x = torch.randn(32, 3, 224, 224)  # [B, C, H, W]
x.reshape(32, -1)  # Shape: [32, 150528]

Add/Remove a dim

x = torch.randn(10, 20)
x.reshape(10, 20, 1)      # Add dimension
x.reshape(10, 4, 5)       # Split dimension
x.reshape(2, 5, 20)       # Split first dim
  1. Image source

  2. I loved using this pen - Lamy 2000.

  3. Uni Jetstream Multi Pen is another good and more affordable option.