Blog

Notes on data structures & algorithms, system design, and things I learn along the way.

Learning DSA? Follow the structured path — ordered articles from recursion to dynamic programming.→
September 17, 2026RAG Retrieval: Chunking, Embeddings, and Why It Misses10 min read

Most RAG failures are retrieval failures, not generation failures. How chunking and embeddings decide what the model ever sees, the similarity-is-not-relevance trap, and what actually fixes it.

#AI Engineering
September 16, 2026Context Windows: Budgeting Tokens Like Memory5 min read

The window is a budget you refill from scratch every turn. Where the tokens actually go in an agent, why prompt caching is a prefix match, and the difference between clearing context and compacting it.

#AI Engineering
September 16, 2026Retries, Backoff, and Jitter: How to Retry Without Causing an Outage10 min read

A naive retry loop is a denial-of-service attack you wrote yourself. Exponential backoff, why jitter matters more than the backoff, idempotency, and retry budgets.

#System Design
September 15, 2026Sharding and Replication: Splitting a Database That Outgrew One Box10 min read

Replication copies the same data; sharding splits different data. What each one actually buys you, how routing and failover behave, and the problems sharding creates that you have to live with.

#System Design
September 15, 2026Tool Calling: How a Model Picks a Function10 min read

A tool is a name, a description, and a JSON Schema — and the description is prompt text that gets read every turn. Schema design, validation, error messages that repair, and why fewer tools work better.

#AI Engineering
September 14, 2026A* Pathfinding: Dijkstra With a Sense of Direction4 min read

One extra term in the priority function turns an exhaustive search into a guided one. What admissible and consistent heuristics mean, why they preserve optimality, and where A* degrades.

#DSA
September 14, 2026The Agent Loop: What Actually Happens Between Prompt and Answer10 min read

An agent is a while loop around a stateless API. What stop_reason really controls, why the transcript is resent on every turn, and the failure modes that show up once tools are in the mix.

#AI Engineering
September 13, 2026Prefix Sums and Difference Arrays: Trading Space for Constant-Time Queries4 min read

Precompute once, answer range queries in O(1). How prefix sums work, the sentinel zero that removes every edge case, difference arrays for range updates, and the 2D version.

#DSA
September 12, 2026Monotonic Stacks: The Pattern Behind Next Greater Element4 min read

A stack that refuses to hold out-of-order values turns a pile of quadratic problems into linear ones. How the invariant works, why the amortised cost is O(n), and the four questions it answers.

#DSA
July 18, 2026Caching Strategies: Cache-Aside, Write-Through, and Write-Back10 min read

Adding a cache in front of a database is easy. Deciding when the cache gets populated and how writes stay consistent with the source of truth is where cache-aside, write-through, write-back and refresh-ahead diverge. Plus the stale-read race in cache-aside, TTLs, eviction policies, cache layers, and how to tell whether a cache is working.

#System Design

202 posts · page 16 of 21