Juan Pablo García

Writing

5 steps

How an agent harness works

Explainer

An agent is a model plus a harness: everything around it that decides what it sees, what it can do, what it remembers and what you can check afterwards.

5 steps

How agent loops work: the loops around the loop

Explainer

Every agent runs a loop of model calls and tool calls. Loop engineering adds the loops around it: one that checks the work, one that starts runs, one that improves the agent, and rules for when each stops.

5 steps

How agent graphs work: nodes, edges and safe cycles

Explainer

A graph makes an agent's control flow explicit: steps are nodes, allowed next steps are edges, and shared state moves along them. Here is my research agent drawn as one, and when not to draw one.

Nov 1, 2026

When does LoRA fine-tuning beat a good prompt? I measured the crossover

Article

A 1.5B model fine-tuned with LoRA against a larger model prompted with examples, on the same 100, 500 and 2,000 labeled examples. The prompt won easily at 100; at 2,000 the small model was 2 points behind, within noise, at 1/29 of the input.

Nov 1, 2026

What actually stops prompt injection? I tested four defenses

Article

I planted 36 injections in the documents a tool-using assistant reads. Undefended, 42% worked; a one-paragraph warning cut that to 6%. One fake policy update beat every defense I tested, and the strongest filter cost the answers.

5 steps

How prompt injection works, and what actually stops it

Explainer

I planted 36 injections in a tool-using assistant's documents and measured four defenses, alone and together. A warning in the prompt stopped most of them; one fake policy update beat all of them; the safest designs cost answers.

Nov 1, 2026

Does hybrid search plus reranking pay for itself? I measured my RAG pipeline

Article

I took my RAG service apart stage by stage on 1,008 labeled questions. The biggest gain was a one-line tokenizer fix, the reranker reorders more than it finds, and hybrid fusion added nothing significant until BM25 was fixed, and even then only at depth 10.

5 steps

How hybrid search and reranking work, measured on my RAG pipeline

Explainer

BM25, dense vectors, Reciprocal Rank Fusion and a cross-encoder, one stage at a time, with what each one added on 1,008 labeled questions.

Oct 31, 2026

Does a four-agent loop beat a single LLM call? I measured it

Article

On 100 multi-hop questions, my research agent answered 86% correctly against 74% for one retrieve-and-answer call, at about 6× the calls. Where the gain comes from, where it loses, and what I'd change.

5 steps

How an LLM request is served: prefill, decode and the KV cache

Explainer

Why the first token is slow and the rest stream, what fills GPU memory, and how batching and quantization make serving cheaper.

5 steps

Long context or RAG? What models actually use

Explainer

Million-token windows didn't make retrieval obsolete. Where models lose track of long prompts, what each approach costs, and how to choose.

5 steps

How structured outputs work: constrained decoding

Explainer

Why “reply in JSON” sometimes fails, how a schema becomes a mask over the model's next-token choices, and why valid JSON can still be wrong.

5 steps

How RLHF works

Explainer

Reinforcement learning from human feedback, stage by stage: demonstrations, comparisons, a reward model, PPO with a KL leash, and reward hacking.

5 steps

How DPO works, and when to use it instead of RLHF

Explainer

Direct Preference Optimization turns RLHF's reward model and RL loop into one loss on preference pairs. The math, the trade-offs and when to choose it.

5 steps

How to evaluate an LLM app

Explainer

Test cases, scoring, version comparisons and a release gate: measuring quality instead of guessing.

6 steps

How RAG works

Explainer

Retrieval-augmented generation, step by step: from splitting documents to an answer with sources.

5 steps

How AI agents work

Explainer

An agent is a language model in a loop: plan, call a tool, read the result, decide again.

5 steps

How MCP connects AI apps to tools

Explainer

The Model Context Protocol, step by step: discovery, tool calls, and why one server works in every app.

5 steps

How fine-tuning with LoRA works

Explainer

Why LoRA trains a fraction of a percent of the weights and still adapts a model.

5 steps

How transformers and attention work

Explainer

What happens inside a large language model: tokens, embeddings, attention and next-token prediction.

4 steps

How embeddings and vector search work

Explainer

How meaning becomes coordinates, and how a search finds the closest ones fast.

5 steps

How neural networks learn

Explainer

Forward pass, loss, backpropagation and gradient descent, drawn one step at a time.

5 steps

How diffusion models generate images

Explainer

Image generators learn to remove noise, then start from pure noise and clean it up step by step.

5 steps

How a web request is served

Explainer

Load balancing, caching and the database: the path most web requests take.

5 steps

How database indexes work

Explainer

Why an index turns a full table scan into a few reads, and what it costs on every write.

5 steps

How Docker containers work

Explainer

Dockerfile, layers, caching, containers and registries: how one image runs the same everywhere.

Other notes

General problem-solving methods and a talk summary, outside the main AI set.