# Writing

32 posts, newest first. Append `.md` to any post URL for its Markdown source.

- **The backtest is the experiment, and most of them aren't controlled** (August 12, 2026) — Self-taught quantitative research primarily fails on statistical biases and uncorrected multiple testing rather than mathematical complexity. Front-loading the pitfall literature dictates building reproducibility infrastructure before writing strategy code.
  https://himanshuat.com/blogs/the-backtest-is-the-experiment.md
- **554 million ticks and the wrong reason mmap loses** (August 12, 2026) — Industry lore states that memory mapping is inefficient for large sequential database scans. On Apple Silicon, empirical profiling shows mmap is faster, slower, and faster again based on working-set ratios relative to physical RAM, governed by kernel fault-population policies rather than base page size.
  https://himanshuat.com/blogs/the-fault-policy-not-the-page-size.md
- **LLM as judge, what the numbers actually say** (June 23, 2026) — I let an LLM judge gate whether changes shipped because public benchmarks cited 80% human agreement. Six weeks in, an apparent performance improvement turned out to be judge variance across reruns. This is what that 80% figure measures and why chance-corrected agreement deflates headline metrics.
  https://himanshuat.com/blogs/llm-as-judge-what-the-numbers-actually-say.md
- **Loop Engineering** (June 02, 2026) — Agents fail in production not because models lack reasoning capacity, but because unmonitored variance causes identical tasks to succeed once and fail on subsequent runs. Here is how to engineer verification ladders, context budgets, and deterministic checklists.
  https://himanshuat.com/blogs/loop-engineering.md
- **Graph Agents and When the Graph Earns Its Keep** (May 12, 2026) — A graph framework introduces an additional control flow abstraction. Here is when cyclic state machines, checkpoint durability, and human approval justify graph infrastructure over plain loops.
  https://himanshuat.com/blogs/graph-agents-when-the-graph-earns-its-keep.md
- **When the documents disagree** (March 17, 2026) — An answer cited a specification section by number and was wrong, because an addendum had already revised that clause and the vector index had no model of temporal precedence. A technical account of hierarchical document routing, supersession graphs, and NLI verification.
  https://himanshuat.com/blogs/when-the-documents-disagree.md
- **Database Agents That Know When They're Wrong** (January 20, 2026) — A database agent that returns a clean, confident, incorrect result set is a liability. Here is how to build AST validation guards, database-level security boundaries, and ambiguity classifiers to catch silent query errors.
  https://himanshuat.com/blogs/db-agents-that-know-when-theyre-wrong.md
- **Production-Grade RAG: A Blueprint for Scalable, Real-Time Architecture** (November 27, 2025) — A RAG system fails quietly when it answers from documents that were modified or deleted upstream. Real-time accuracy requires event-driven change data capture, explicit vector index configuration, tiered semantic caching, and telemetry that monitors silent retrieval drift.
  https://himanshuat.com/blogs/production-grade-rag-architecture-blueprint.md
- **The Self-Correcting RAG: Implementing Agentic and Recursive Retrieval Loops** (November 18, 2025) — Static RAG retrieves once and assumes top-k results contain complete context. Recursive retrieval loops inspect accumulated context, identify missing facts, synthesize targeted follow-up queries, and terminate on explicit criteria or iteration bounds.
  https://himanshuat.com/blogs/self-correcting-rag-agentic-recursive-retrieval.md
- **We beat the benchmarks and ran out of runway** (September 25, 2025) — Flux-VTON+ scores 0.85 SSIM on global traditional garments where SDXL manages 0.45, and we have signed deals with real apparel groups. We're winding the company down anyway. This is what I think the research was worth, written while both of those things are true at once.
  https://himanshuat.com/blogs/we-beat-the-benchmarks-and-ran-out-of-runway.md
- **Three clouds, one inference path** (September 17, 2025) — Inference executed across three cloud providers because client data residency required in-region processing, interactive research needed persistent state, and catalog rendering arrived in sporadic batch spikes. A technical review of the multi-cloud placement router, artifact provenance, and operational tradeoffs.
  https://himanshuat.com/blogs/three-clouds-one-inference-path.md
- **From a ComfyUI graph to an API a brand's team can call** (September 09, 2025) — Our try-on pipeline lived as a ComfyUI graph with implicit state, hand-picked seeds, and custom nodes tracking whatever was on main that week. Turning it into something another company's engineers could call meant writing down which code ran, which seed, when the work happens, and what we refuse.
  https://himanshuat.com/blogs/from-comfyui-graph-to-an-api.md
- **Fitting a saree into 24GB: the context window trick** (September 02, 2025) — A saree needs pixel density to hold its pleats, and a full-frame high-resolution pass doesn't fit on a 24GB card. The fix was to stop treating the frame as the unit of inference and hand the model only the region that matters.
  https://himanshuat.com/blogs/fitting-a-saree-into-24gb.md
- **FID was the wrong metric for the problem we had** (August 26, 2025) — Aggregate FID went 22.1 to 18.5 and I nearly read that as months of adapter work buying four points. Half the eval set was already close to solved and it dragged the average toward nothing. Splitting by garment category was the change that made the result visible.
  https://himanshuat.com/blogs/fid-was-the-wrong-metric.md
- **Composing adapters that disagree with each other** (August 05, 2025) — Two LoRA experts merged with two scalars shipped fine. A whole library of them for demographics, poses, lighting, and backgrounds did not, because adapters conflict per layer and one blend weight per adapter cannot express that.
  https://himanshuat.com/blogs/conflict-aware-adapter-composition.md
- **Production Agent Architecture: Memory, Approval Gates, and Durable Checkpointing** (August 05, 2025) — What actually breaks when you put a LangGraph agent in production: memory interfaces for vector stores, human-in-the-loop approval routing for critical operations, TypeScript orchestrators with transactional state persistence, and the deployment considerations that don't appear in tutorials.
  https://himanshuat.com/blogs/production-grade-agent-architecture-memory-human-in-the-loop.md
- **Architecting Multi-Agent Teams with LangGraph: Supervisor Patterns, Worker Isolation, and Sub-Graph Composition** (July 22, 2025) — Two patterns for multi-agent coordination: a Python supervisor that routes between specialist worker nodes via explicit state evaluation, and a typed graph engine that composes child sub-graphs with isolated state boundaries. When each earns its complexity, and the failure modes that make both patterns break.
  https://himanshuat.com/blogs/architecting-multi-agent-teams-with-langgraph.md
- **What happens when you merge two LoRAs** (July 15, 2025) — Two adapters that each pass on their own can make each other worse the moment you sum them into the base weights. We shipped a hand-tuned coefficient pair because we had to ship something, and months later I still don't have a principled answer for how those coefficients should be chosen.
  https://himanshuat.com/blogs/what-happens-when-you-merge-two-loras.md
- **Serverless GPUs for bursty training** (June 17, 2025) — Our fine-tuning load arrived in bursts: intensive compute sprints followed by quiet intervals. Rented static GPU instances handle this pattern poorly. An architectural breakdown of splitting workloads between dedicated EC2 nodes and serverless Modal GPU workers.
  https://himanshuat.com/blogs/serverless-gpus-for-bursty-training.md
- **RAG Foundations: From First Query to a Retriever You Can Actually Trust** (June 12, 2025) — Building a RAG system is straightforward. Building one whose retrieval you can measure, debug, and improve is not. This post covers chunking strategies with real Hit Rate and MRR comparisons, embedding model selection against concrete constraints, and the diagnostic checks that matter before you touch the generation side.
  https://himanshuat.com/blogs/rag-foundations.md
- **One LoRA per failure mode** (May 20, 2025) — Put a hand on a hip and our try-on pipeline painted the garment straight over the fingers. The obvious fix, one bigger dataset covering every hard case at once, quietly made the draping worse. Splitting the finetune into two adapters, one per named failure mode, is what actually worked.
  https://himanshuat.com/blogs/one-lora-per-failure-mode.md
- **Generic aesthetic scorers hate e-commerce photography** (April 29, 2025) — We pointed an open aesthetic scorer at a batch of generated product shots and it ranked the moody, low-key ones highest. That's a defensible opinion about photographs and the wrong answer for a catalogue. This is the scorer we built instead, and the parts of it I can't put a number on.
  https://himanshuat.com/blogs/teaching-a-model-what-a-catalogue-looks-like.md
- **LoRA finetuning: the hyperparameters settled in a week, the data never did** (April 08, 2025) — An early draping adapter kept rendering identical flat planes across shoulder folds, regardless of prompt. This is memorization rather than learned geometric priors, traced back to pinned studio photos. Hyperparameters stabilize quickly in Low-Rank Adaptation; dataset curation and caption isolation determine generalization.
  https://himanshuat.com/blogs/lora-finetuning-what-moved-the-needle.md
- **Two streams: why one diffusion pass couldn't do virtual try-on** (March 18, 2025) — Masking a torso and inpainting a garment demos well in an afternoon. Getting back the exact garment, with its weave and its print placement intact, is a different problem. One conditioning stream could not hold both the body and the reference, so Flux-VTON+ runs two.
  https://himanshuat.com/blogs/flux-fill-and-redux-two-streams.md
- **What 5,000 images taught me about curation** (February 25, 2025) — More data made the model worse in a way no automatic metric could see. The seed adapters behind AuraX-V1 ended up trained on 5,000 images a person had looked at one by one. Here is what the filter caught, and what it kept missing.
  https://himanshuat.com/blogs/what-5000-images-taught-me-about-curation.md
- **ComfyUI as a research lab** (February 04, 2025) — A custom node pack updated, a mask node changed its default on inverted masks, and our outputs moved with nothing changed on our side. Running a try-on diffusion pipeline as a node graph made every experiment a commit, and made very clear where a graph stops being a program.
  https://himanshuat.com/blogs/comfyui-as-a-research-lab.md
- **Virtual try-on is not image generation** (January 14, 2025) — A text-to-image model invents a plausible shirt. Try-on has to reproduce the exact shirt the customer is already looking at, on a person whose face has to survive the process intact. Getting that wrong on a saree is the failure that started all of this.
  https://himanshuat.com/blogs/virtual-try-on-is-not-image-generation.md
- **Transformer Architectures Compared: BERT, GPT, Mamba, and Mixture of Experts** (May 31, 2024) — A single triangular mask separates BERT from GPT. That structural choice determines pre-training objectives, task alignment, and inference mechanics. This post covers the masking math, MLM vs CLM training objectives, PyTorch implementations of both, then the architectures pushing beyond attention: SSMs, Mamba, and sparse MoE routing.
  https://himanshuat.com/blogs/understanding-transformers-architectures-bert-gpt.md
- **Building a Transformer from Scratch: Attention, Architecture, and Memory** (May 10, 2024) — A ground-up implementation of the Transformer: scaled dot-product attention in NumPy and PyTorch, the full decoder block with RoPE, RMSNorm, and causal masking, then the memory optimizations that make large models practical: FlashAttention, KV caching, GQA, and LoRA.
  https://himanshuat.com/blogs/understanding-transformers-implementation.md
- **Part 3: Scaling LangGraph: State Persistence, Checkpointing, and Parallelism** (May 03, 2024) — Long-running multi-agent workflows require durable state persistence and concurrency management. Here is how to configure SQLite and Redis checkpointers alongside Pregel super-step parallel branching in LangGraph.
  https://himanshuat.com/blogs/scaling-langgraph-persistence-and-parallelism.md
- **StyleX Architecture: Compile-Time CSS Extraction, Deterministic Resolution, and Atomic Bundling** (December 16, 2023) — An architectural breakdown of StyleX, examining how compile-time Babel AST transforms eliminate CSS-in-JS runtime overhead, guarantee deterministic class merges, and generate atomic stylesheets.
  https://himanshuat.com/blogs/stylex-new-frontend-styling-framework.md
- **Modern Neovim from Scratch: Lua Modular Architecture, Lazy.nvim, LSP, and Treesitter** (September 12, 2023) — A practical guide to configuring a fast, modular Neovim development environment using Lua, Lazy.nvim, native LSP with Mason, nvim-cmp, and Treesitter.
  https://himanshuat.com/blogs/my-nvim-setup.md

---

Source: https://himanshuat.com/blogs
