Blog

Notes on AI engineering, LLM agents, and shipping production software.

Generating branded social-preview images at build time

8 min

Every page wants its own 1200×630 social card. Instead of designing each one by hand, drive headless Chrome over a parameterized HTML template at build time, then shrink the output ~80% with a PNG8 palette step whose key move is turning dithering off on flat graphics.

Sub-second triage: tiering LLMs for latency-critical paths

14 min

I benchmarked a tiered LLM safety gate with 800 real API calls: a fast model on the hot path, a larger one for the cases that need reasoning, plus circuit breakers and a caution-biased fallback. The measurements upended my reasons for tiering. On current models the fast and large tiers run at nearly the same speed, so the real payoffs are cost and, more importantly, catching the emergencies the cheap model quietly gets wrong.

A fast molecular-dynamics simulator in pure NumPy

11 min

A naive molecular-dynamics loop is O(N²) and dies past a few hundred particles. With cell lists, a cutoff Lennard-Jones potential, velocity-Verlet integration, and reduced units, you can simulate thousands of particles in pure NumPy and watch a gas equilibrate.