How Instagram Knows: Recommendation Systems from First Principles
A feed turns small signals into a useful prediction.
insights(2) · reading index
Notes and case studies about AI systems, retrieval, infrastructure, and cost. Start with a topic, or follow a series.
A compact way into the writing. The categories are separate shelves, but the ideas overlap.
Three product-first notes on how feeds, first-use experiences, and search help people find what matters.
A feed turns small signals into a useful prediction.
Personalization starts with product choices before behavior exists.
Search becomes useful when people can describe a feeling, not just a keyword.
Retrieval, reranking, learned indexes, and practical notes around production GenAI systems.
A 40-step agent that is 99% reliable per step gets it right 67% of the time. The fix is not a better model. It is knowing which actions deserve a phone call — with LangGraph interrupts in Python and TypeScript.
A JSON inventory answers aggregation questions with 9,810 tokens instead of 663,181 — a 68x context collapse. Two LangGraph tools in Python, one Pydantic schema, and the honest benchmark that argues against the design.
A product-first introduction to recommendation systems with the math made explicit: implicit feedback, matrix factorization, two-tower retrieval, ranking, and evaluation.
How products make their first useful recommendation through onboarding choices, defaults, context, exploration, and early feedback.
A small Python exercise for learning PyTorch as a problem-solving tool: model the problem, write tests, represent state as tensors, compute loss, and use gradients only after the invariant is clear.
A first-principles RAG exercise in Python: use tests to define evidence, keep retrieved documents as data, reject instruction-like text, and refuse when support is weak.
How B-trees, LSM trees, and vector indexes are converging on the same underlying problem — and what that means for builders of GenAI retrieval systems.
Project writeups and case studies with the constraints, tools, and evidence kept close to the work.
Scentum and the ScoreVector: turning subjective taste into structured ML engineering dimensions.
How Scentum can make fragrance discovery work when people know the feeling they want before they know the words to search for.
A practical AI engineering review of building a browser-based Next.js Web UI RAG assistant for real users: retrieval, latency, prompt control, failure modes, and expectations.
A production support assistant for ecommerce: semantic product search, context-aware answers, and ticket deflection measurement.
A semantic fragrance search product: natural language queries, vector embeddings, and scoring over scent descriptors.
Engineering fundamentals, Python notes, containers, data structures, and measurement-first habits.
What 'pleasant' means when the thing behind your UI reasons in probabilities: visible intent, graceful uncertainty, and recoverable mistakes as the new UI primitives for 2026.
Containers before Kubernetes: why a container's real identity is its digest, not its tag — and what that means for reproducible ML training, on CPU and GPU.
Twelve of twenty-one well-known domains share a Cloudflare or AWS nameserver. Five live DNS queries, lamest to strangest, show the moment a lookup stopped answering "where" and started answering "who is asking."
Frontier models turning video, audio, sensor streams, and DNA sequences into structured JSON — the extraction problem finally has a general solution.
What decades of game engine event loops teach us about agent reasoning loops — six patterns, with conceptual code, for tool-calling agents.
The Neo Geo won on a 1.6× clock advantage. Apple's M-series wins while clocking lower. One number explains both — and it decides which model fits your device.
Why danstativa.dev's background is a pointer-reactive node network instead of a static graph-paper pattern — direct manipulation, game 'juice,' and random walks, with the full working code.
Python has not become statically typed. What changed is the tooling around it — type checkers, linters, and editors that reason about your code before it ever runs.
The humble AI engineer: less magic, more measurement across AI engineering, ML engineering, Python engineering, retrieval design, expected value, and product purpose.
From Stacks and Queues to Graph Algorithms: how primitive containers — stacks, queues, sets, heaps — power the higher-order algorithms of computer science.
Python concurrency explained from the primitive upward: threads for overlapping waiting, processes for CPU work, and why concurrency is not the same as parallelism.
Python virtual environments are a primitive that gives AI pipelines a clean dependency boundary, making experiments, training, and serving easier to isolate and rerun.
Search and generative-engine optimization notes, with a preference for measured changes over claims.
A short on-site SEO argument from Common Crawl to Core Web Vitals: before ranking, a page has to be fetched, parsed, rendered, measured, and turned into evidence.
The sequel to the on-site SEO workout: a second pass built on one hierarchy — does a byte need to exist, block, run, or weigh this much? Page JavaScript went from 113 KB to 1.6 KB and first paint from 0.6 to 0.4 seconds, mostly by deleting instead of compressing.
A real case study of on-site SEO in 2026: prerendered HTML, a render-blocking CSS diet, right-sized AVIF images, and immutable caching — taking a live site from 69 to 97 performance without touching its design.
Expected value, routing, retrieval costs, and decision-making for GenAI systems.
Why AI engineering is also game theory: model routing, retrieval, tool calls, human escalation, and stopping rules as repeated strategic decisions under uncertainty.
Tune agentic AI costs with EV-positive reasoning budgets, gated tool calls, context diets, stop-loss rules, and production cost traces.
Run the EV formula with real Python code: three GenAI strategies, Hugging Face models on CPU, actual EV numbers — Strategy A: −$0.052, RAG: +$0.230, Router: +$0.230.
Measure the EV of every Agentic AI and GenAI inference call. EV formula, RAG vs agentic cost breakdown, optimal model routing, and equilibrium play for production systems.