n0tls

Learning

Deep-dive writeups from ongoing research projects, grouped by topic. Each one ends with an optional multiple-choice quiz on the core concepts.

Retrieval Research

Why an LLM agent misses the right doc, how far you get without vectors, and whether a small fine-tuned retriever beats it.

Teaching a Small Model to Find Documents
Bi-encoders, cross-encoders, retrieve-then-rerank, and contrastive fine-tuning — a field guide to how a small model learns to match queries to documents.
bi-encoders · cross-encoders · contrastive training
Inside the Transformer
From raw text to the 384 numbers a bi-encoder hands back: tokenization, attention, pooling, and why training one from scratch on a small corpus wouldn't work.
tokenization · attention · pretraining
Cosine Similarity
The geometric intuition for why direction, not distance, is what retrieval ranks documents by — with an interactive demo you can drag around and a worked ranking example.
vector geometry · interactive demo
The Retrieval Pipeline, Line by Line
Three files that turn bi-encoder architecture diagrams into something that actually runs: synthetic training pairs, contrastive training, and brute-force cosine search — with the real code for each.
bi-encoders · sentence-transformers · code walkthrough
The Best Wrong Answer
A hard negative is a document that looks right and isn't — and it matters more to a contrastive loss than almost anything else in the batch. The math for why, worked through step by step.
contrastive loss · softmax temperature · hard negatives
Digging for Hard Negatives
The code that mines real hard negatives per base model, a real CUDA out-of-memory crash mid-sweep, and a 12-run sweep in which no configuration clearly beat its in-batch-only baseline.
hard-negative mining · hyperparameter sweep · CUDA