How to build an agent that gets better over time:
There are 3 areas an agent can learn from:
1. The model: Only works for code and math, where a computer can score right vs. wrong. Leave this to the big labs.
2. The harness: These are the steps, tools, and safety checks you build around the model. This is easy to control and will give you a huge payoff now.
3. The context: This is a plain-text representation of what the agent has learned. Probably the simplest place to start.
But there's something else that most people miss:
Your agent should learn from its users.
You want to learn from every time a user fixes the agent's decision. Nothing can replace feedback from real usage.
the four pillars of loop engineering.
the loop itself is six lines, and nobody competes on it. every serious agent framework lands on the same tiny while-loop. model reads context, calls a tool, you feed the result back, repeat until it stops asking.
so if that part is solved, what is everyone actually engineering?
the answer is everything around the model. Boris Cherny, who built Claude Code, put it plainly. he doesn't prompt Claude anymore, he writes loops and lets them run.
that shift has a name now, and it rests on four pillars that are harder than the six lines make them look. these are the parts that actually break:
→ knowing when to stop. a terminal message ends the turn, not the task. an agent will write failing code, glance around, and declare victory. "done" has to mean the tests pass, not the agent feeling good about its work.
→ keeping the context clean. long loops rot from the inside as old outputs and dead ends pile up. a worse context produces a worse decision, which adds more noise, and the agent gets dumber the longer it runs. you fight it by treating context as a budget, not a bucket.
→ tools the agent can actually use. pile on a hundred tools and it loses track of which one to reach for. writes have to be safe to repeat, because loops retry, and a retried "create customer" call leaves you with duplicate records.
→ something that can say no. left alone, an agent agrees with itself. the fix is to separate the maker from the checker so the worker never grades its own homework.
put those four together and your job changes. you stop steering the agent move by move and start designing the system that steers it.
Karpathy runs research loops overnight that tweak a script, test it, keep what works, and throw away what doesn't, with himself nowhere in the loop. he arranges it once and hits go.
the model is becoming a commodity. the loop around it is where the real engineering lives now.
the best builders stopped asking what they should tell the agent to do. they started asking what system would do this without them.
I wrote the full breakdown. the article is quoted below.
stay tuned for more on this!
Anthropic Research Lead:
"99% of our engineers run swarms of 300+ self-improving agents"
"Close the loop, give the model a way to verify its own output"
In a 20-minute session, an Anthropic Team member breaks down how to build agents that improve themselves
The real setup is Claude running through loops, plan mode, and dynamic workflows
Better than most $300 agent courses
Bookmark and watch the talk
Then read the article below
Your LLM inference is burning 50% of its compute on work it has already done.
If you are running RAG or Multi-Turn Chat, you are likely recomputing the KV Cache for the same documents over and over again.
I found the open-source library that solves this. It’s called LMCache. It makes the KV cache Persistent and Shareable across different engine instances (vLLM, SGLang).
The "Cheat Code" for AI Infrastructure => Instead of the cache dying when a request finishes, LMCache offloads it to a shared layer (CPU/Disk/Network).
This unlocks architecture patterns that were previously impossible:
1./ Instant RAG
Process a 100-page PDF once. Store the KV cache. Now any user query against that doc starts instantly (Zero Time-To-First-Token).
2./ Disaggregated Serving
Run heavy "Prefill" on H100s. Stream the cache to cheaper L4s for "Decoding."
3./ Context Sharing
Multiple users asking about the same context? Compute it once, serve everyone.
🚀 15x throughput gain in multi-round QA workloads.
⚡ 3-10x reduction in Time-To-First-Token (TTFT).
It integrates directly with vLLM and SGLang. Stop letting your GPUs do the same homework twice.
You can now fine-tune LLMs and deploy them directly on your phone! 🚀
We collabed with PyTorch so you can export and run your trained model 100% locally on your iOS or Android device.
Deploy Qwen3 on Pixel 8 and iPhone 15 Pro at ~40 tokens/sec.
Guide: https://t.co/8wyQLJfzeC
If you're an "ML Engineer" and you think LayerNorm/BatchNorm “just stabilize training,” you’re missing one of the deepest ideas in modern deep learning.
Concept 20: Normalization Layers, Stabilization, the geometry behind it.
Normalization layers completely change the geometry of your network's function.
They rewrite:
• the curvature,
• the Jacobian spectrum,
• the Lipschitz constant,
• the optimization trajectory,
• and the effective loss surface your model trains on.
Reference Paper: Santurkar et al. (NeurIPS 2018)
This paper proves that normalization reduces sharpness, smooths the loss landscape, and improves gradient predictability.
1. Normalization rescales internal activations
Take an activation vector h.
LayerNorm computes:
h_norm = (h - mean(h)) / std(h)
This forces:
• zero mean
• unit variance
• constant energy
Santurkar et al. show this operation makes the loss surface smoother, not because of “covariate shift,” but because normalization controls how activations propagate.
2. Normalization collapses pathological curvature
Neural network losses often contain extremely sharp, unstable directions.
Normalization:
• shrinks sharp curvature
• expands flat areas
• smooths steep walls
Santurkar et al. demonstrate that BatchNorm dramatically reduces the Lipschitz constant of both the loss and its gradients, making the optimization surface easier to traverse.
3. Normalization controls the Jacobian (gradient flow)
Without normalization:
• singular values of the Jacobian explode or collapse
• gradients vanish or blow up
• deep models become untrainable
Normalization keeps the Jacobian’s singular values within a controlled band.
This improves gradient flow and prevents training collapse.
This is one of the core mathematical reasons Transformers must include LayerNorm or RMSNorm. (Go back to my Transformers concept)
4. Normalization makes networks “scale-invariant”
If weights are scaled:
W → αW
BatchNorm and LayerNorm make this transformation functionally negligible.
This creates:
• smoother optimization
• higher learning rate tolerance
• invariances that dramatically simplify the loss geometry
Santurkar et al. explicitly show that scale-invariance contributes to faster optimization.
5. Normalization changes the optimization trajectory itself
With normalization, the network trains on a different loss landscape:
L̃(θ) = L( f_norm(x; θ) )
Santurkar et al. empirically demonstrate that this transformed landscape has:
• fewer sharp cliffs
• better-behaved gradients
• a smoother Hessian spectrum
• dramatically improved convergence behavior
Normalization doesn't fix instability. It more or less changes the geography of the space you're optimizing.
6. Why every modern architecture depends on normalization
CNNs → BatchNorm
Transformers → LayerNorm / RMSNorm
Diffusion models → GroupNorm
LLMs → PreNorm + RMSNorm
Normalization is the scaffolding that makes deep function learning possible.
Without it, scaling modern architectures becomes almost impossible.
TL;DR:
Normalization layers do stabilize training, but more importantly they reshape the curvature, Lipschitz constant, and Hessian spectrum of the model. This is the math and functionality behind the "veil" of stabilization that people assume.
Santurkar et al. (NeurIPS 2018) show that normalization smooths the loss landscape and improves gradient predictability, which is exactly why deep architectures like Transformers depend on it (thankfully).
Normalization isn’t a trick. It is a mathematical transformation that makes deep learning work.
MLOPS PROJECT UPDATE!
- Added Feature Store using Feast and Redis ✅
- Rate limiting for training parent and child models with different limits/min, stored in Redis ✅
- Async training with Redis cache ✅ (on small Yahoo dataset; not recommended for heavy training)
- Removed JWT ❌
Next: Moving to AI Agents that use model predictions (ML + Gen AI), then basic Streamlit dashboard + data/model drift monitoring.
Note: This project is a tutorial/learning-focused one, so emphasis is on ML project design, not accuracy or real-world impact.
For AWS: Will set up GPUs (LSTM model, even if small). Not sure how many learners can afford AWS, so releasing both localhost and AWS versions ;)
My new book just came out! 🎉😊
Kindle & e-book available now, print within 1–2 weeks.
You can get it at: https://t.co/OzaSoITBnE
(you'll also find free online content there)
Play with the notebooks at:
https://t.co/XZHbIc3NH9
Hope you'll find it useful!
How did I master data pipelines as an ML Engineer?
(A GOLD SKILL)
Since joining the industry, I've built data pipelines more often than trained models. Model training is a 1-day task but pipelines sometimes take weeks.
Here's how to build unbroken data pipelines:
1. Optimize the SQL query simply.
2. Connect SQL to Pandas.
3. Check no. of cols and rows.
4. Construct logic for operations on the data.
5. Process features step by step.
6. Define end goal—save to DB, df, or push to registry like HF.
7. Use LIMIT on SQL query to test on 100 records.
8. Make it BATCH INGESTION.
9. Carefully check these conditions:
A. Batch size is correct.
B. Save checkpoint of ID to resume after interruption.
C. Ingestion restarts from last saved checkpoint.
D. Overwrite duplicate data in target DB or registry.
E. Check DB or registry after ingestion.
F. Write code to reset: delete all checkpoints and drop table (CAREFUL).
Keep these in mind for data ingestion. Nowadays, I'm ingesting ~130M rows from 3-4 DBs into a single target DB.
PySpark and Polars are great, but at the start, Pandas and multithreading can help ingest data.
Always test on 100 sample records before full DB execution.
If your data is good, model training is easy.
Keep learning ;)
Everyone is sleeping on this new OCR model!
dots-ocr is a new 1.7B vision-language model that achieves SOTA performance on multilingual document parsing.
- Supports 100+ languages
- Works with both images and PDFs
- Handles text, tables, formulas seamlessly
100% open-source.
PaddleOCRv5 is now on @huggingface Hub with Apache-2.0 license ����
despite being tiny (70M) the benchmarks look insane, outperforms latest models!
it supports 40 languages, deploy it anywhere 🤯
demo and model on the next one ⤵️