Archive

1046 posts · Page 15 of 88. ← Blog

Pratik Dhanave · ·6 min read

LCEL and Runnables

The pipe operator that lets you write `prompt | model | parser` is not syntactic sugar — it's LangChain's core composition model, and everything you pipe together shares one standard interface that gives you streaming, batching, and async for free. Understanding Runnables and LCEL is understanding how LangChain applications are actually built.

The pipe operator that lets you write prompt | model | parser is not syntactic sugar — it's LangChain's core composition model, and everything you pipe together shares one interface that gives you streaming, batching, and async for free.

Pratik Dhanave · ·6 min read

Structured Outputs

This is the feature Pydantic AI is named for and built around: you declare a Pydantic model as your agent's output type, and you get back a validated instance of it — not a string to parse, not JSON to hope about, but a real typed object. It turns the single most brittle part of LLM applications into the most reliable.

This is the feature Pydantic AI is named for: you declare a Pydantic model as your agent's output type and get back a validated instance — not a string to parse. It turns the most brittle part of LLM applications into the most reliable.

Pratik Dhanave · ·7 min read

Sanctions and Watchlist Screening

Sanctions screening looks simple — check if a name is on a list — and is genuinely hard, because names are messy, lists are fuzzy, and the penalty for a miss is among the most severe in all of compliance. It's a string-matching problem with strict-liability stakes, which is exactly what makes the false-positive-versus-false-negative balance so unforgiving.

Sanctions screening looks simple — check if a name is on a list — and is genuinely hard, because names are messy, matching is fuzzy, and the penalty for a miss is among the most severe in compliance: a string-matching problem with strict-liability stakes.

Pratik Dhanave · ·6 min read

DNS

DNS is the internet's phone book — it turns the names humans use into the addresses machines route to — and it's also the internet's most common outage cause and a frequent source of baffling latency. "It's always DNS" is a running joke among engineers precisely because DNS is invisible until it breaks, and then it breaks everything.

DNS is the internet's phone book — it turns the names humans use into the addresses machines route to — and it's also the internet's most common outage cause. 'It's always DNS' is a running joke because DNS is invisible until it breaks, and then it breaks everything.

Pratik Dhanave · ·7 min read

Traces

When a request touches ten services and comes back slow, metrics tell you it's slow and logs tell you what each service did — but neither shows you the one thing you need: where, along that journey, the time actually went. Distributed tracing is the pillar built for exactly this, following a single request across every service it touches and showing you the whole path at once.

When a request touches ten services and comes back slow, metrics say it's slow and logs say what each service did — but neither shows where the time went. Distributed tracing follows a single request across every service and shows the whole path at once.

Pratik Dhanave · ·7 min read

Tokens: Access, Refresh, and JWTs

Tokens are the currency of modern identity — they carry proof of authorization and identity across every request. But "token" hides real distinctions: access versus refresh versus ID tokens do different jobs, and a JWT you can read but must validate correctly is a razor that cuts both ways. Most identity vulnerabilities live in how tokens are issued, stored, and checked.

Tokens are the currency of modern identity — access, refresh, and ID tokens do different jobs, and a JWT you can read but must validate correctly is a razor that cuts both ways. Most identity vulnerabilities live in how tokens are issued, stored, and checked.

Pratik Dhanave · ·6 min read

QLoRA and Quantized Fine-Tuning

LoRA shrank the trainable parameters, but you still had to hold the full base model in memory to train against it — and for a large model that alone needs serious hardware. QLoRA closes the gap: quantize the frozen base model to 4-bit, train LoRA adapters on top, and fine-tune a large model on a single consumer GPU with almost no quality loss. It's what truly democratized fine-tuning.

LoRA shrank the trainable parameters, but you still had to hold the full base model in memory. QLoRA closes the gap: quantize the frozen base to 4-bit, train LoRA adapters on top, and fine-tune a large model on a single consumer GPU with almost no quality loss.

Pratik Dhanave · ·6 min read

IVF: The Inverted File Index

The simplest way to beat brute force is to avoid searching most of your data — cluster the vectors into regions, and at query time only look inside the few regions nearest the query. That's IVF, and its one tuning knob, how many regions to probe, is a clean, visible dial on the recall-versus-speed trade at the heart of the whole field.

The simplest way to beat brute force is to avoid searching most of your data — cluster the vectors into regions, and at query time only look inside the few nearest the query. That's IVF, and its one knob (nprobe) is a clean dial on the recall-versus-speed trade.

Pratik Dhanave · ·6 min read

The On-Device Runtime

Between your quantized model file and a running feature sits the runtime — the engine that loads the model, maps it onto the phone's CPU, GPU, or NPU, and turns tokens into text. You rarely write inference math yourself; you pick a runtime and let it handle the brutal complexity of executing a neural network across thousands of different devices.

Between your quantized model file and a running feature sits the runtime — the engine that loads the model, maps it onto the phone's CPU, GPU, or NPU, and turns tokens into text across thousands of different devices.

Pratik Dhanave · ·6 min read

Quantization

Quantization shrinks a model by storing its numbers in fewer bits — and because LLM decode is bottlenecked on moving those numbers from memory, making them smaller makes inference both cheaper to host and faster to run. It's the rare optimization that improves memory, cost, and speed at once, if you respect its limits on quality.

Quantization stores a model's numbers in fewer bits — and because decode is bottlenecked on moving those numbers from memory, making them smaller makes inference cheaper to host and faster to run, if you respect the limits on quality.

Pratik Dhanave · ·6 min read

The Write-Ahead Log and Durability

Durability — the promise that a committed transaction survives a crash — comes down to one deceptively simple rule: write down what you're about to do before you do it. The write-ahead log is that rule made concrete, and it's the reason a database can be both fast and crash-safe, two goals that otherwise pull in opposite directions.

Durability comes down to one deceptively simple rule: write down what you're about to do before you do it. The write-ahead log is that rule made concrete — the reason a database can be both fast and crash-safe.

Pratik Dhanave · ·6 min read

Time, Clocks, and Ordering

The most dangerous line of code in a distributed system is the one that trusts a timestamp. Physical clocks on different machines disagree, drift, and jump backward — so "which event happened first?" cannot be answered by comparing wall-clock times. Logical clocks answer it instead, by tracking causality rather than time.

The most dangerous line in a distributed system is the one that trusts a timestamp. Logical clocks — Lamport timestamps and vector clocks — order events by causality instead of unreliable wall-clock time.