Blog
2026
- Merging multiple sources of truth safelyWhen a system answers a question by combining a stored rule, a cached copy of external data, and a live authoritative source, the merge needs an explicit priority order and explicit staleness handling, or the wrong sources win silently.
- Cloud free tiers don't remove cost, they relocate itA free tier means one number on the invoice reads zero. The cost that would have shown up there doesn't disappear, it moves into engineering time, architectural complexity, or the risk sitting behind a quota you haven't hit yet.
- When talking to the database directly is fine, and when it isn'tFirebase and Supabase let a client write to the database with security rules as the only gate. Whether that's a reasonable architecture or a liability comes down to one axis: how much of your access control can be written declaratively.
- RAG's real bottleneck is trust in the source, not retrievalMost RAG effort goes into retrieval quality: better embeddings, reranking, chunking. But perfect retrieval doesn't guarantee the generated answer actually traces back to what was retrieved. Faithfulness is a separate axis from relevance, and it's the harder one.
- Constraining an LLM's output space beats prompting it to be carefulWhen a wrong answer has a real-world consequence, the fix isn't a prompt that says double-check yourself, it's removing the model's ability to generate the risky part of the output in the first place.
- What chaos testing catches that code review can'tCode review catches the bugs a reviewer can imagine happening. Load and chaos testing catch a structurally different class: races, partial failures, and resource exhaustion that only exist under real concurrency.
- Fail open vs fail closedWhen the infrastructure behind a check goes down, you have to decide what happens to the request in front of it. Neither answer is the safe default, it depends what you're protecting.
- Modeling state with more than two outcomesA boolean can only ever mean two things. The moment 'false' has to cover both 'never happened' and 'happened, then got superseded', you need a bigger type, not a bigger boolean.
- A critic-and-revise loop needs a graph, not a pipelineA linear chain of steps can't express go back to step 2 if step 3 fails a check. Anything with a revise-and-retry loop needs real cyclic control flow, plus a cap that guarantees the loop ends.
- Typed signatures instead of hand-written prompt stringsA raw prompt string is brittle: change a word and the output format can shift with nothing to catch it until a user does. Declaring inputs and outputs as a typed signature moves that contract out of prose and into something checkable.
- Client-side encryption is a trust boundary decision, not just an algorithmEncrypting data before it leaves the client blinds the server to what it's storing by design. That single choice quietly cancels out deduplication, content inspection, and anything else a server might assume it can do with the bytes it holds.
- Erasure coding vs replication: the actual tradeoff behind cheap storageReplication survives failures by paying for extra full copies. Erasure coding gets the same guarantee for a fraction of the storage cost by paying in CPU and complexity instead. The math behind that trade, with a real Reed-Solomon implementation as the concrete case.
- The trap of a perfect eval scoreA perfect score on your own eval is ambiguous evidence. It can mean the system is genuinely good, or it can mean the eval never got hard enough to fail. The two look identical from the number alone.
- Idempotency keys are a caching problemIdempotency isn't a payments-specific technique. It's a cache with a client-generated key and one very specific invalidation rule, and it applies to any POST that has a side effect.
- Solving Race Conditions at 10K RPSHow I built a Flash Sale engine that handles 10,000+ concurrent requests without overselling, using Redis Lua scripts and distributed state machines.
- Building a Production-Ready Distributed LLM PlatformLessons learned from building K2-Chat: a self-hosted multimodal AI platform using FastAPI, gRPC, and modern DevOps practices.
2024
- PyTorch Performance Optimization TipsAdvanced techniques for speeding up PyTorch training and inference, from mixed precision to data loading optimization.
- PyTorch Basics: Tensors and AutogradLearn the fundamentals of PyTorch, including tensor operations, automatic differentiation, and building neural networks from scratch.
- Finetuning LLMs - A brief OverviewEverything you need to know before you start finetuning your LLMs
- Introduction to Transformer ArchitectureUnderstanding the revolutionary architecture behind GPT, BERT, and modern large language models.
- Grokking in Neural NetworksA mechanistic interpretability perspective into how neural networks suddenly generalize after memorizing training data.
- Refusal Vector Ablation in LLMsUnderstanding how large language models learn when and how to refuse harmful requests through mechanistic interpretability.
- Understanding PyTorch TensorsA deep dive into PyTorch's fundamental data structure and how to use them effectively in deep learning applications.
- Getting Started with Neural NetworksBuilding your first neural network from scratch using PyTorch and understanding the fundamentals of deep learning.