The lab notebook
Field notes on AI engineering
824 articles · page 8 of 28
Semantic vs Keyword Search: What RAG Actually Needs
Semantic search finds meaning, keyword search finds exact terms, and most production RAG systems fail because they pick only one. Here's how to decide, and when to run both.
RAG Query Routing: Sending Questions to the Right Index
When your RAG system has more than one index, sending every query to every source wastes tokens and hurts accuracy. Here's how to route each question to the index that can actually answer it.
Monitoring a RAG Pipeline in Production
A RAG pipeline that passed your eval suite can still fail silently in production. Here is what to actually measure, log, and alert on across retrieval, generation, and the index itself.
The Parent Document Retriever Pattern in RAG
Small chunks retrieve well but read poorly in isolation. The parent document retriever pattern fixes this by searching small and returning large, and this guide shows exactly how to build it.
Multi-Vector Retrieval: ColBERT and Beyond
Single-vector embeddings collapse a whole document into one point and lose the fine-grained matches that make retrieval accurate. Here is how multi-vector RAG with ColBERT-style late interaction fixes that, with working code.
Metadata Filtering in RAG: Precise Retrieval at Scale
Vector similarity alone returns plausible-looking but wrong chunks once your corpus grows past a few thousand documents. Here is how to design and implement RAG metadata filtering that keeps retrieval accurate at scale.
Building a Golden Dataset for RAG Evaluation
Your RAG pipeline looks fine in the demo and falls apart in production because you never built a real test set. Here is how to construct a rag golden dataset that actually catches regressions.
RAG Caching Strategies: Cutting Latency and Cost
Every RAG call redoes work you already paid for. Here is where to put caches in a retrieval pipeline, what each one saves, and where teams get it wrong.
Prompt Versioning and Management for Teams
Prompts break production just like code does, but most teams still paste them into Slack. Here is how to version, test, and roll back prompts the same way you handle code.
Prompt Chaining Patterns for Complex Tasks
Prompt chaining breaks a hard task into smaller LLM calls that hand off to each other. Here are the patterns that hold up in production, with runnable code.
Prompt Caching Explained
Prompt caching can cut your LLM input costs by up to 90 percent and slash latency, but only if you understand the prefix-match rule that silently breaks it. Here is exactly how it works, what it costs, and where to put the breakpoints.
Pairwise Model Comparison for LLM Selection
Absolute 1-10 scores from an LLM judge are noisy and hard to compare across runs. Pairwise comparison, showing a judge two outputs and asking which is better, gives you a ranking you can actually trust.
Offline vs Online LLM Evals: What to Run Where
Offline evals gate deploys, online LLM evaluation scores real traffic. Here is a decision matrix for what to run where, with working code for both sides.
Testing n8n Workflows Before They Break
n8n workflows fail quietly in production unless you test them the way you'd test code. Here's how to build a real test harness around your automations.
n8n vs LangGraph for AI Workflows
n8n and LangGraph solve different problems even though both get pitched for "AI workflows." Here is how to pick the right one, with real code for both.
Self-Hosting n8n with Docker: A Complete Setup Guide
Run n8n self host docker in production with Postgres, HTTPS, and encrypted credentials, not the default SQLite demo setup that breaks on your first real workflow.
Building a RAG Workflow in n8n
A step-by-step build of a production-ready n8n RAG workflow, from document ingestion and chunking to vector search and grounded LLM answers, with node configs you can copy directly.
Multi-Agent Orchestration in n8n
Learn how to design n8n multi agent workflows with a router node, worker sub-workflows, shared memory, and error handling that actually survives production traffic.
Connecting n8n to MCP Servers
A hands-on guide to wiring n8n up to MCP servers, from the built-in MCP Client node to hosting your own MCP server so any workflow can act as an agent tool.
Model Routing Strategies for Cost and Quality
Sending every request to your biggest model burns budget for no reason. Here is how to build a model router that sends easy questions to a cheap model and hard ones to a strong one, without breaking quality.
Meta-Prompting: Using LLMs to Write Better Prompts
Stop hand-tuning prompts by guesswork. Meta-prompting uses one LLM call to design, critique, and rewrite the prompt for another, and it reliably beats manual iteration once you know the loop.
MCP vs OpenAPI Tool Calling: When to Use Each
MCP and OpenAPI tool calling solve overlapping problems in different ways. Here is how they actually differ under the hood, and a concrete decision framework for picking one over the other.
How to Test MCP Servers: Unit, Integration, and Inspector
A working MCP server that "looks fine in Claude Desktop" can still fail silently in production. Here is a layered testing approach: unit tests for tool handlers, the MCP Inspector for manual poking, and integration tests against a real client.
Stateful MCP Sessions: Managing Connection State
MCP sessions carry more than a connection ID: capability negotiation, subscriptions, and per-client memory all live inside them. Here is how to build servers that manage that state correctly instead of leaking it.
MCP Sampling and Elicitation: Server-Initiated LLM Calls
Most MCP tutorials stop at tools and resources. Sampling and elicitation let an MCP server ask the client's model to think, or ask the client's user a question, mid-task, without holding its own API key.
The MCP Registry Explained: Discovering and Publishing Servers
The MCP registry is the missing directory for Model Context Protocol servers. Here is how to search it, evaluate what you find, and publish your own server the right way.
MCP Observability: Logging, Tracing, and Metrics
MCP servers fail in ways your normal APM stack won't catch. Here is how to add structured logging, distributed tracing, and metrics to an MCP server without breaking the stdio transport.
Securing MCP Servers with OAuth: Authorization in Practice
A working guide to MCP authorization: the OAuth 2.1 flow, resource indicators, dynamic client registration, and the code that makes a remote MCP server actually reject stolen tokens.
Building Multi-Tenant MCP Servers: Isolation and Scaling
A practical guide to building a multi-tenant MCP server that keeps customer data isolated, enforces per-tenant quotas, and scales past a single-tenant proof of concept.
MCP Error Handling Patterns: Building Resilient Servers
MCP error handling has two distinct layers that most tutorials never separate, and mixing them up is why so many custom servers crash agents instead of helping them recover.