Labs for system design and machine learning
Small interactive pages for the ideas interviews keep coming back to. Add a server, fire a burst of requests, change a learning rate, and watch what happens.
System design
The building blocks every design round leans on, and a board to load-test a whole design.
Consistent hashing
Add and remove servers on a hash ring and count the keys that move, against plain hash % N.
5 min
Rate limiter
Fire requests at a token bucket, a fixed window and a sliding window, and see which ones each lets through.
5 min
Cache eviction
Send the same requests to an LRU and an LFU cache, run a scan, and watch which keys each one keeps.
5 min
Replication quorums
Write to W replicas, read from R, take some down, and find the settings where a read misses the latest write.
5 min
Back-of-the-envelope estimator
Set users, writes and a read ratio, and see the requests a second, storage and bandwidth they add up to, with every sum written out.
5 min
Load-test a design
Draw a system on the board, push peak traffic through it and find the box that breaks. Eight rounds, from a URL shortener to IRCTC Tatkal.
20 min
Machine learning
How models learn and how they choose words, with the maths on screen.
Gradient descent
Pick a learning rate and momentum, then watch the steps settle, zig-zag or fly off the map.
5 min
Overfitting
Raise a polynomial's degree until it chases the noise, then rein it in with regularisation or more data.
6 min
Precision and recall
Slide a classifier's threshold and watch precision and recall trade places, then make positives rare and see accuracy mislead.
6 min
Embeddings and cosine similarity
Drag a query among word vectors, see cosine, dot product and distance rank them, then normalise and watch all three agree.
5 min
LLM sampling
Turn temperature, top-k and top-p, and watch the odds of a model's next token change.
4 min
