#AI(54)

September 2026
#AI #RAG #OpenSearch #Search #Python

Reciprocal Rank Fusion for Hybrid Search

Reciprocal Rank Fusion merges two ranked lists without tuning score weights. The RRF formula, why the k constant matters, and how to run it in OpenSearch.

Read more →
August 2026
#AI #LLM #GPU #Inference #Python

How Continuous Batching Speeds Up LLM Serving

A naive LLM server holds finished slots idle until the slowest request in the batch drains. Continuous batching refills them every step. How it works.

Read more →
August 2026
#AI #LLM #Claude #FastAPI #Python

Prompt Caching with the Claude API

Prompt caching reuses a stable prompt prefix to cut Claude API cost and latency. How breakpoints, TTLs, and cache reads work, and what quietly breaks a hit.

Read more →
August 2026
#AI #LLM #RAG #Embeddings #Search

Contextual Retrieval for RAG, Step by Step

Vector search misses chunks that lost their document context. Contextual Retrieval prepends a short LLM-written summary to each chunk before you embed it.

Read more →
August 2026
#AI #LLM #GPU #Inference #Performance

Speculative Decoding: Faster LLM Inference

Speculative decoding uses a small draft model to guess tokens a big model verifies in one parallel pass, cutting LLM latency with no change to output.

Read more →
August 2026
#AI #LLM #GPU #Inference #Python

Prefill vs Decode: Two Phases of LLM Inference

The first token is slow, the rest stream fast. Why LLM inference splits into a compute-bound prefill and a memory-bound decode, and what it costs you.

Read more →
August 2026
#AI #LLM #RAG #Retrieval #Python

HyDE: Hypothetical Document Embeddings for RAG

Vector search fails when a short question looks nothing like its answer. HyDE has an LLM draft a fake answer, embeds that, and retrieves against it instead.

Read more →
August 2026
#AI #LLM #RAG #Security #Prompt Injection

Prompt Injection Defense for RAG Systems

Retrieved documents are untrusted input. A practical guide to defending a RAG copilot against direct and indirect prompt injection, and why filters alone fail.

Read more →
August 2026
#AI #LLM #RAG #Evaluation #Python

LLM-as-a-Judge: Scoring RAG Answer Quality

Retrieval metrics say the right docs came back, not that the answer is right. Build an LLM-as-a-judge to score RAG answers for faithfulness and quality.

Read more →
August 2026
#AI #RAG #VectorSearch #Embeddings #FAISS

Product Quantization for Vector Search

HNSW makes vector search fast, but the embeddings still fill your RAM. Product quantization compresses them ~32x with a small recall hit. Here is how it works.

Read more →
August 2026
#AI #LLM #RAG #FastAPI #Python

Build a Semantic Cache for LLM Apps

Semantic caching for LLM apps: cache answers by embedding similarity in FastAPI, tune the cutoff, and avoid false cache hits. Working code and failure modes.

Read more →
August 2026
#AI #LLM #GPU #Inference #vLLM

How PagedAttention Powers vLLM's KV Cache

A self-hosted LLM server wastes most of its GPU memory to KV cache fragmentation. Here is how PagedAttention in vLLM pages the cache like an OS.

Read more →
August 2026
#AI #LLM #GPU #Inference #Transformers

How Grouped-Query Attention Shrinks the KV Cache

Grouped-query attention shares key/value heads across query heads to cut the KV cache. How GQA sits between MHA and MQA, with the memory math and code.

Read more →
August 2026
#AI #RAG #Embeddings #Vector Search #LLM

Matryoshka Embeddings: Smaller Vectors for RAG

Matryoshka embeddings front-load meaning into a vector's first dimensions, so you can truncate them for cheaper, faster RAG search without losing much recall.

Read more →
August 2026
#AI #LLM #GPU #Inference #Python

How FlashAttention Speeds Up the Attention Layer

Attention is memory-bound, not compute-bound. Here's how FlashAttention uses tiling and online softmax to skip the N×N matrix and run exact attention faster.

Read more →
August 2026
#AI #LLM #Tokenization #NLP #Python

How Byte-Pair Encoding Tokenizes Text for LLMs

Byte-pair encoding turns text into the tokens an LLM bills and reasons over. How BPE merges are learned, why token counts drive cost, and where it breaks.

Read more →
August 2026
#FastAPI #Python #Backend #AI #API

How FastAPI Dependency Injection Actually Works

A practical guide to FastAPI dependency injection: how Depends resolves a graph, yield setup and teardown, per-request caching, and where it leaks.

Read more →
August 2026
#AI #LLM #RAG #VectorSearch #Python

Late Interaction Retrieval for RAG with ColBERT

A bi-encoder averages token detail away; a cross-encoder is too slow to rank a corpus. Late interaction with ColBERT sits between them. Here is how it works.

Read more →
August 2026
#AI #RAG #pgvector #Postgres #FastAPI

RAG Vector Search in Postgres with pgvector

Store and query RAG embeddings inside Postgres with pgvector: HNSW indexing, distance operators, metadata filtering, hybrid search, and the tradeoffs I hit.

Read more →
August 2026
#AI #LLM #RAG #Retrieval #Search

Contextual Retrieval for RAG Pipelines

Chunking a document for RAG strips each piece of its context. Contextual retrieval adds an LLM-written note to every chunk before you index it.

Read more →
August 2026
#AI #LLM #RAG #VectorSearch #Python

Metadata Filtering in Vector Search for RAG

Adding a metadata filter to a vector search can silently return fewer results or wreck recall. How post-filter, pre-filter, and filterable HNSW actually differ.

Read more →
July 2026
#AI #LLM #Agents #Python #RAG

Managing the Context Window in Long Agent Runs

An LLM agent that runs long enough fills its context window and starts to slow or fail. How to prune, compact, and offload context so agents keep going.

Read more →
July 2026
#AI #LLM #Sampling #RAG

LLM Sampling: Temperature, Top-p, and Top-k

Temperature, top-p, and top-k are the three knobs that shape how an LLM picks each token. How each one works, when to reach for it, and how they interact.

Read more →
July 2026
#AI #LLM #RAG #Embeddings #Search

How to Choose an Embedding Model for RAG

The embedding model sets the ceiling on RAG retrieval quality. How to choose one by task fit, sequence length, dimensions, and domain, plus the silent bugs.

Read more →
July 2026
#AI #LLM #Prompt Caching #FastAPI #Agents

Prompt Caching: Cut LLM Cost and Latency

Prompt caching reuses a request's prefix to cut LLM cost and latency. How the prefix match works, where to put the breakpoint, and the silent cache misses.

Read more →
July 2026
#AI #LLM #GPU #Quantization #Inference

LLM Quantization: INT8, GPTQ, and AWQ Explained

The weights don't fit on the GPU you have. How LLM quantization shrinks them to INT8 or INT4, why GPTQ and AWQ beat naive rounding, and where it breaks.

Read more →
July 2026
#AI #LLM #GPU #Inference #Performance

How Speculative Decoding Speeds Up LLM Inference

Speculative decoding uses a small draft model to guess tokens a big model verifies in one pass, cutting LLM latency 2-3x without changing the output.

Read more →
July 2026
#AI #LLM #RAG #Python #FastAPI

Query Rewriting for Better RAG Retrieval

Short, vague, follow-up questions don't match how your docs are written. How query rewriting, multi-query expansion, and HyDE fix retrieval before it runs.

Read more →
July 2026
#AI #LLM #Agents #Observability #OpenTelemetry

Tracing an LLM Agent with OpenTelemetry

An LLM agent request hides where the time and tokens went behind one flat log. Trace it with OpenTelemetry spans, the GenAI conventions, and where it breaks.

Read more →
July 2026
#AI #LLM #GPU #Inference #Serving

Continuous Batching for LLM Inference

Static batching leaves the GPU idle when requests finish at different steps. How continuous batching schedules LLM inference per token to raise throughput.

Read more →
July 2026
#AI #LLM #Evaluation #RAG #Python

LLM-as-a-Judge: Evaluating LLM Output Quality

Human review does not scale for grading LLM answers. How to use an LLM as a judge: write a rubric, score with structured output, and control the biases.

Read more →
July 2026
#AI #LLM #RAG #Security #Agents

Indirect Prompt Injection in RAG Systems

A RAG copilot reads tickets and logs, so whoever writes them can plant instructions in the prompt. How indirect prompt injection works and how to contain it.

Read more →
July 2026
#AI #LLM #Caching #Embeddings #Python

How to Build a Semantic Cache for LLM Apps

Exact-match caching misses paraphrases, so LLM bills stay high. Here is how to build a semantic cache with embeddings, a similarity threshold, and its traps.

Read more →
July 2026
#AI #LLM #Agents #MCP #Python

Build an MCP Server for Your LLM Agent

MCP standardizes how LLM agents reach your tools and data. A hands-on guide to building an MCP server in Python, picking a transport, and where it breaks.

Read more →
July 2026
#React #LLM #Frontend #Streaming #AI

Cancelling an LLM Stream in React with AbortController

A user hits stop or switches chats and the old LLM stream keeps writing tokens and running up cost. How to cancel a streaming fetch in React the right way.

Read more →
July 2026
#AI #LLM #Structured Outputs #Python #FastAPI

Getting Reliable JSON Out of an LLM

Getting an LLM to return JSON is easy; getting valid JSON every time is not. How to use JSON Schema, constrained decoding, and validation to make it reliable.

Read more →
July 2026
#React #LLM #Frontend #Markdown #AI

Streaming LLM Markdown in React Without Flicker

LLM tokens arrive one at a time, and re-parsing Markdown on every token flickers and drags. How to render streaming Markdown in React without the jank.

Read more →
July 2026
#AI #LLM #GPU #Inference #Python

LLM KV Cache: Why GPU Memory Runs Out

A long prompt or a long agent run can hit CUDA out of memory, and the KV cache is usually why. How it grows, the per-token math, and how to shrink it.

Read more →
July 2026
#LLM #FastAPI #Python #Backend #AI

Handling LLM API Rate Limits: Retries and Backoff

Your LLM backend returns 429s the moment traffic bursts. How to retry with backoff and jitter, respect Retry-After, and pace fan-out to stay under the limit.

Read more →
July 2026
#AI #LLM #RAG #VectorSearch #Python

How HNSW Vector Search Actually Works

Every RAG stack leans on HNSW but treats it as a black box. Here is how the layered graph index finds nearest neighbors fast, and the knobs that matter.

Read more →
July 2026
#AI #LLM #RAG #Python #FastAPI

Cross-Encoder Reranking for RAG Pipelines

Retrieval puts the right chunk at rank 8, but the generator only reads the top few. How a cross-encoder reranker reorders RAG candidates, and where it fails.

Read more →
July 2026
#AI #LLM #RAG #Python #FastAPI

Chunking Strategies for RAG Pipelines

How to chunk documents for a RAG pipeline: why fixed-size splitting fails, structure-aware splitting, size and overlap tradeoffs, and the failure modes.

Read more →
July 2026
#AI #LLM #Agents #Python #Security

Running LLM-Generated Code in a Sandbox

An LLM that writes and runs code needs real isolation, not a try/except. How to sandbox AI-generated code with E2B microVMs, and the failure modes.

Read more →
July 2026
#AI #LLM #RAG #Evaluation #Python

Measuring RAG Retrieval Quality: recall@k, MRR

Changed your embeddings or added a reranker? Measure it. Build a golden set and score retrieval with recall@k, MRR, and nDCG before you trust the change.

Read more →
July 2026
#AI #LLM #RAG #OpenSearch #Python

Hybrid Search for RAG: BM25 + Vectors

Vector search alone misses exact IDs and error codes. Here's how to combine BM25 keyword search with dense retrieval, fuse the rankings with RRF, and rerank.

Read more →
June 2026
#AI #LLM #FastAPI #React #Python

Streaming LLM Responses from FastAPI with SSE

Stream LLM output token by token from a FastAPI backend with Server-Sent Events: working code, the EventSource client, proxy buffering, and failure modes.

Read more →
June 2026
#AI #LLM #Agents #Python #Claude

How an LLM Agent Tool-Calling Loop Works

A practical look at the agent loop behind LLM tools: how the model asks to call a tool, your code runs it, and the result feeds back until the answer is done.

Read more →
June 2026
#AI #LLM #RAG #FastAPI #Python

Incremental Indexing for RAG Pipelines

How to keep a RAG index fresh without full rebuilds: detect changed files with checksums, re-embed only what changed, and handle deletions safely.

Read more →