<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>LLM &#183; PiniShv</title><link>https://pinishv.com/tags/llm/</link><description>Pini Shvartsman leads AI transformation inside a 100+ engineer SaaS org. Field notes on autonomous engineering: AI-powered execution, human accountability.</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>© 2026 Pini Shvartsman</copyright><lastBuildDate>Sat, 04 Apr 2026 18:00:00 +0200</lastBuildDate><atom:link href="https://pinishv.com/tags/llm/index.xml" rel="self" type="application/rss+xml"/><item><title>Your AI Stack Is Rented Until You Can Run Part of It Yourself</title><link>https://pinishv.com/articles/local-llms-your-stack-is-rented/</link><pubDate>Sat, 04 Apr 2026 18:00:00 +0200</pubDate><guid>https://pinishv.com/articles/local-llms-your-stack-is-rented/</guid><description>Anthropic just told Claude Code users that third-party harnesses need separate billing. Google dropped Gemma 4 under Apache 2.0 across phone-to-workstation tiers. One story is about dependence. The other is about escape velocity. The local LLM landscape finally crossed from &amp;lsquo;cute demo&amp;rsquo; to &amp;lsquo;actually useful.&amp;rsquo;</description><content:encoded>&lt;p>When &lt;a
href="https://techcrunch.com/2026/04/04/anthropic-says-claude-code-subscribers-will-need-to-pay-extra-for-openclaw-support/"
target="_blank"
>Anthropic tells&lt;/a> paying Claude Code subscribers that OpenClaw and other third-party harnesses need separate pay-as-you-go billing starting April 4, that&amp;rsquo;s not just a pricing update. That&amp;rsquo;s platform risk made visible. If your workflow depends on someone else&amp;rsquo;s limits, economics, and tolerance for power users, your stack is rented.&lt;/p>
&lt;p>At almost the same moment, &lt;a
href="https://blog.google/innovation-and-ai/technology/developers-tools/gemma-4/"
target="_blank"
>Google dropped Gemma 4&lt;/a> under Apache 2.0 across phone-to-workstation tiers. Over 400 million downloads of the Gemma family so far. This isn&amp;rsquo;t a niche hobbyist corner anymore.&lt;/p>
&lt;p>One story is about dependence. The other is about escape velocity.&lt;/p>
&lt;h2 class="relative group">Local finally crossed the line
&lt;div id="local-finally-crossed-the-line" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#local-finally-crossed-the-line" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>For a long time, &amp;ldquo;run it locally&amp;rdquo; meant weaker models, ugly tooling, and a lot of compromises. You got privacy but gave up capability.&lt;/p>
&lt;p>That&amp;rsquo;s changing fast. The model layer is better. The runtime layer is better. And the quality-to-hardware ratio finally crossed from &amp;ldquo;cute demo&amp;rdquo; to &amp;ldquo;actually useful.&amp;rdquo;&lt;/p>
&lt;p>The mistake people make is treating local LLMs as a single category. They&amp;rsquo;re not. There are now three very different tiers:&lt;/p>
&lt;p>&lt;strong>Phone and tablet.&lt;/strong> &lt;a
href="https://ai.google.dev/gemma/docs/core"
target="_blank"
>Gemma 4&amp;rsquo;s&lt;/a> smallest models (E2B at ~3.2GB, E4B at ~5GB) run on mobile through Google&amp;rsquo;s AI Edge Gallery. Microsoft&amp;rsquo;s &lt;a
href="https://huggingface.co/microsoft/Phi-4-mini-instruct"
target="_blank"
>Phi-4-mini&lt;/a> targets mobile CPUs with ONNX builds. Hugging Face&amp;rsquo;s &lt;a
href="https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B"
target="_blank"
>SmolLM2&lt;/a> is built for on-device from the start. Not your frontier coding copilot. But credible for summarization, drafting, classification, and offline assistance.&lt;/p>
&lt;p>&lt;strong>Laptop.&lt;/strong> The 4B to 8B class is the sweet spot. &lt;a
href="https://huggingface.co/Qwen/Qwen3-4B"
target="_blank"
>Qwen3-4B&lt;/a> with switchable thinking modes, Phi-4-mini for compact reasoning, &lt;a
href="https://mistral.ai/news/mistral-3"
target="_blank"
>Ministral 8B&lt;/a> for edge setups. Real assistants on normal hardware.&lt;/p>
&lt;p>&lt;strong>Workstation and higher-memory Macs.&lt;/strong> This is where local stops being a privacy story and becomes a control story. &lt;a
href="https://mistral.ai/news/mistral-small-3-1"
target="_blank"
>Mistral Small 3.1&lt;/a> runs on a single RTX 4090 or a 32GB Mac. Gemma 4&amp;rsquo;s 26B and 31B models are realistic for workstation setups. &lt;a
href="https://arxiv.org/abs/2505.09388"
target="_blank"
>Qwen3-30B-A3B&lt;/a> has 30.5B total parameters but only 3.3B activated per token, which is exactly the kind of design that makes local deployment attractive.&lt;/p>
&lt;p>And the tooling caught up. Gemma 4 is already in &lt;a
href="https://ollama.com/library/gemma4"
target="_blank"
>Ollama&lt;/a>. LM Studio keeps pushing the &amp;ldquo;download and run&amp;rdquo; workflow. Microsoft has ONNX Runtime and Foundry Local for Phi. The gap between &amp;ldquo;model exists&amp;rdquo; and &amp;ldquo;normal person can run it&amp;rdquo; is closing fast.&lt;/p>
&lt;h2 class="relative group">What local doesn&amp;rsquo;t do
&lt;div id="what-local-doesnt-do" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#what-local-doesnt-do" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Local isn&amp;rsquo;t magic and I don&amp;rsquo;t want to romanticize it.&lt;/p>
&lt;p>You still give up raw frontier capability. You give up some convenience. You give up the giant context windows and web-connected workflows that cloud models handle more naturally. On mobile, you fight battery and heat. A phone can run a model. That doesn&amp;rsquo;t mean you want it thinking for three minutes over a giant prompt while your battery melts.&lt;/p>
&lt;p>The local story is strongest around focused workloads: summarization, extraction, drafting, classification, translation, private notes, offline copilots, and first-pass coding help.&lt;/p>
&lt;p>So no, local doesn&amp;rsquo;t mean &amp;ldquo;replace Claude, ChatGPT, and Gemini everywhere.&amp;rdquo; That&amp;rsquo;s the wrong goal.&lt;/p>
&lt;p>The right goal is to stop letting every useful AI workflow become a monthly lease tied to someone else&amp;rsquo;s pricing model, product roadmap, and policy mood.&lt;/p>
&lt;h2 class="relative group">Why the Anthropic move matters more than people think
&lt;div id="why-the-anthropic-move-matters-more-than-people-think" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#why-the-anthropic-move-matters-more-than-people-think" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Everyone repeats the privacy argument for local models. Fair enough.&lt;/p>
&lt;p>The stronger argument is operational.&lt;/p>
&lt;p>If a vendor can wake up on Friday and tell you that a workflow you built around is no longer covered by the subscription you&amp;rsquo;re already paying for, then &amp;ldquo;works today&amp;rdquo; isn&amp;rsquo;t the same thing as &amp;ldquo;belongs in your stack.&amp;rdquo;&lt;/p>
&lt;p>Anthropic&amp;rsquo;s move may be rational. If third-party harnesses blow past the economics of a flat subscription, of course they&amp;rsquo;ll tighten the terms. That&amp;rsquo;s what platforms do. I &lt;a
href="https://pinishv.com/articles/ai-wrapper-companies-legitimacy-or-hype/">wrote about this pattern&lt;/a> when I was looking at AI wrappers, and again when I argued &lt;a
href="https://pinishv.com/articles/saas-is-dead-we-just-havent-stopped-paying-for-it/">the SaaS bargain is breaking&lt;/a>. Platform providers always move up the stack eventually.&lt;/p>
&lt;p>Local gives you a floor the platform can&amp;rsquo;t take away.&lt;/p>
&lt;p>That floor doesn&amp;rsquo;t need to be frontier-grade to be strategically valuable.&lt;/p>
&lt;p>It just needs to be yours.&lt;/p>
&lt;h2 class="relative group">What I&amp;rsquo;d actually run today
&lt;div id="what-id-actually-run-today" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#what-id-actually-run-today" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>If I wanted a phone-first local assistant: &lt;strong>Gemma 4 E2B/E4B&lt;/strong> first, then &lt;strong>Phi-4-mini&lt;/strong> for reasoning-heavy tasks.&lt;/p>
&lt;p>If I wanted a good local model on a normal laptop: &lt;strong>Qwen3-4B&lt;/strong>, &lt;strong>Phi-4-mini&lt;/strong>, or &lt;strong>Ministral 8B&lt;/strong>.&lt;/p>
&lt;p>If I had a 32GB Mac or stronger desktop: &lt;strong>Mistral Small 3.1&lt;/strong> and &lt;strong>Gemma 4 26B&lt;/strong>.&lt;/p>
&lt;p>If I had a 24GB GPU and wanted the best local jump in capability: &lt;strong>Gemma 4 31B&lt;/strong> and &lt;strong>Qwen3-30B-A3B&lt;/strong>.&lt;/p>
&lt;p>That&amp;rsquo;s not a benchmark answer. It&amp;rsquo;s a deployment answer.&lt;/p>
&lt;p>For two years, local LLMs mostly meant compromise. In 2026, they increasingly mean options. The frontier cloud models are still stronger. But that&amp;rsquo;s no longer the only question that matters.&lt;/p>
&lt;p>The real question is: which parts of your AI stack are you still comfortable renting?&lt;/p>
&lt;hr>
&lt;p>&lt;em>Running local models? I&amp;rsquo;d love to hear what you&amp;rsquo;re using and where. Find me on &lt;a
href="https://x.com/PiniShv"
target="_blank"
>X&lt;/a> or &lt;a
href="https://t.me/by_Pini"
target="_blank"
>Telegram&lt;/a>.&lt;/em>&lt;/p></content:encoded><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://pinishv.com/articles/local-llms-your-stack-is-rented/feature.png"/></item><item><title>Cisco Built an LLM Security Leaderboard. You Should Care Even If You Don't Use Cisco.</title><link>https://pinishv.com/articles/cisco-llm-security-leaderboard/</link><pubDate>Thu, 26 Mar 2026 10:00:00 +0200</pubDate><guid>https://pinishv.com/articles/cisco-llm-security-leaderboard/</guid><description>Cisco just published a public leaderboard scoring LLMs on how well they resist attacks. Anthropic dominates the top 10. Multi-turn attacks are where most models crack. The rankings are interesting, but the real value is the question they force every engineering team to ask.</description><content:encoded>&lt;p>Cisco &lt;a
href="https://blogs.cisco.com/ai/llm-security-leaderboard"
target="_blank"
>published&lt;/a> an &lt;a
href="https://leaderboard.aidefense.cisco.com/rankings"
target="_blank"
>LLM Security Leaderboard&lt;/a> that scores AI models on one thing: how well they resist being broken.&lt;/p>
&lt;p>Not benchmarks on reasoning. Not coding ability. Not helpfulness. Security. How often does the model refuse when someone tries to make it do something it shouldn&amp;rsquo;t?&lt;/p>
&lt;p>Every model is tested in its base configuration with no additional guardrails. Single-turn attacks (direct prompt injection, goal hijacking, obfuscation) and multi-turn attacks (social engineering, gradual escalation, persona adoption, persistent probing). The combined score weights both equally. The methodology maps to MITRE ATLAS, OWASP, and NIST. This isn&amp;rsquo;t a toy benchmark.&lt;/p>
&lt;h2 class="relative group">What the rankings actually show
&lt;div id="what-the-rankings-actually-show" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#what-the-rankings-actually-show" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Anthropic dominates. Seven of the top 10 spots belong to Claude models. Claude Opus 4.5 takes first place with a 93.3 combined score. Claude Sonnet 4.5 follows at 92.2. OpenAI&amp;rsquo;s GPT 5.4 Mini lands at #7 (89.1) and GPT 5.4 Nano at #8 (88.9).&lt;/p>
&lt;p>But the interesting story isn&amp;rsquo;t who&amp;rsquo;s on top. It&amp;rsquo;s the gap between single-turn and multi-turn scores.&lt;/p>
&lt;p>Most models handle direct prompt injection well. Single-turn scores cluster in the high 90s. Claude Opus 4.5 scores 97.8. GPT 5.4 scores 97.3. These models know how to say no to an obvious attack.&lt;/p>
&lt;p>Multi-turn is where things crack. The same GPT 5.4 that scores 97.3 on single-turn drops to 75.3 on multi-turn. Claude Opus 4.5 drops from 97.8 to 88.8. Across the board, patient multi-step attacks that build rapport, gradually escalate, and use social engineering are significantly more effective than direct attempts.&lt;/p>
&lt;p>That pattern matters. Because in production, your model isn&amp;rsquo;t facing single prompts from a benchmark. It&amp;rsquo;s facing users who have entire conversations. And the attackers who care most are the ones willing to take five, ten, fifteen turns to get what they want.&lt;/p>
&lt;h2 class="relative group">Why this matters beyond the scores
&lt;div id="why-this-matters-beyond-the-scores" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#why-this-matters-beyond-the-scores" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>The specific rankings will shift as models update. What matters more is the question this leaderboard forces every engineering team to confront:&lt;/p>
&lt;p>&lt;strong>Do you know how your model behaves when someone actively tries to break it?&lt;/strong>&lt;/p>
&lt;p>Most teams pick a model based on capability, cost, and speed. Security posture is an afterthought. The assumption is that the model provider handles safety. But these rankings show that models vary dramatically, and the variation is largest exactly where real-world attacks happen: sustained, patient manipulation across multiple turns.&lt;/p>
&lt;p>I&amp;rsquo;ve been writing about &lt;a
href="https://pinishv.com/articles/ai-security-culture-problem/">AI security as a culture problem&lt;/a> and &lt;a
href="https://pinishv.com/articles/prompt-injection-2-0-the-new-frontier-of-ai-attacks/">prompt injection as a real production threat&lt;/a> for a while. The pattern I keep seeing is teams deploying models without ever testing what happens when the input is hostile. They test for accuracy. They test for latency. They don&amp;rsquo;t test for adversarial resistance.&lt;/p>
&lt;p>And as Cisco&amp;rsquo;s blog points out: if these models are connected to agents, the damage risk increases exponentially while reversibility shrinks. That hits close to home given everything happening with &lt;a
href="https://pinishv.com/articles/cursor-automations-ai-stopped-waiting/">Cursor Automations&lt;/a> and &lt;a
href="https://pinishv.com/articles/claude-computer-use-dispatch/">Claude&amp;rsquo;s computer use&lt;/a> this month. Agents that can act autonomously need models that can resist manipulation. The leaderboard is a starting point for knowing where you stand.&lt;/p>
&lt;h2 class="relative group">What to do with this
&lt;div id="what-to-do-with-this" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#what-to-do-with-this" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>&lt;strong>Check your model&amp;rsquo;s baseline.&lt;/strong> Look up where it ranks before and after multi-turn testing. The gap tells you how vulnerable your application is to patient attackers.&lt;/p>
&lt;p>&lt;strong>Don&amp;rsquo;t rely on the model alone.&lt;/strong> These scores are base configurations with no guardrails. In production, layer input validation, output filtering, and monitoring on top.&lt;/p>
&lt;p>&lt;strong>Test multi-turn specifically.&lt;/strong> If your application supports conversation, your threat model needs to include attackers who are willing to take their time.&lt;/p>
&lt;p>&lt;strong>Make this part of model selection.&lt;/strong> Security resistance belongs in the decision matrix alongside capability, cost, and latency. It rarely is.&lt;/p>
&lt;p>This is the first serious public leaderboard that ranks models on the dimension most teams ignore. That alone makes it worth your time.&lt;/p>
&lt;hr>
&lt;p>&lt;em>How does your team evaluate LLM security before deploying to production? I&amp;rsquo;d like to hear what&amp;rsquo;s working. Find me on &lt;a
href="https://x.com/PiniShv"
target="_blank"
>X&lt;/a> or &lt;a
href="https://t.me/by_Pini"
target="_blank"
>Telegram&lt;/a>.&lt;/em>&lt;/p></content:encoded><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://pinishv.com/articles/cisco-llm-security-leaderboard/feature.png"/></item><item><title>So, You've Built a RAG. Now Let's Make It Not Suck.</title><link>https://pinishv.com/articles/so-youve-built-a-rag-now-lets-make-it-not-suck/</link><pubDate>Tue, 23 Sep 2025 00:00:00 +0000</pubDate><guid>https://pinishv.com/articles/so-youve-built-a-rag-now-lets-make-it-not-suck/</guid><description>Your basic RAG works in the demo. It falls apart with real users. Here&amp;rsquo;s how to upgrade from a fragile prototype to a production system that actually handles the messy reality of user queries.</description><content:encoded>&lt;p>Alright, you read &lt;a
href="../rag-for-developers-a-no-bs-introduction">the intro guide&lt;/a>. You connected an LLM to a vector database, stuffed it with your documents, and built your first Retrieval-Augmented Generation (RAG) app. It works. You ask a question, it spits out an answer backed by your data. High fives all around.&lt;/p>
&lt;p>Then you show it to a real user.&lt;/p>
&lt;p>They ask a question with a typo. The RAG returns garbage. They ask a question that requires info from two different documents. The RAG gets confused. They ask, &amp;ldquo;What are the key differences between product A and B?&amp;rdquo; and it just dumps the full spec sheet for product A.&lt;/p>
&lt;p>Suddenly, your shiny AI marvel feels less like a genius and more like a clumsy intern.&lt;/p>
&lt;p>Welcome to the real work of building RAG systems. The &amp;ldquo;hello world&amp;rdquo; version is easy. The production-grade version that doesn&amp;rsquo;t fall over when a user looks at it funny? That&amp;rsquo;s a different beast. Let&amp;rsquo;s dive into the upgrades that take your RAG from a fragile prototype to a robust powerhouse.&lt;/p>
&lt;h2 class="relative group">Upgrade 1: Your Retriever is a Dumb Metal Detector. Let&amp;rsquo;s Give It a Brain.
&lt;div id="upgrade-1-your-retriever-is-a-dumb-metal-detector-lets-give-it-a-brain" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#upgrade-1-your-retriever-is-a-dumb-metal-detector-lets-give-it-a-brain" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>The single biggest failure point in a naive RAG is the &amp;lsquo;R&amp;rsquo;, the retrieval. Your first attempt probably just does a simple semantic search. That&amp;rsquo;s a decent start, but it&amp;rsquo;s like using a metal detector to find a specific coin in a junkyard. It finds stuff that&amp;rsquo;s generally similar, but often misses the mark.&lt;/p>
&lt;h3 class="relative group">Fix #1: Hybrid Search
&lt;div id="fix-1-hybrid-search" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#fix-1-hybrid-search" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>Pure semantic search is great for understanding the meaning of a query, but it can be surprisingly bad with specific keywords, acronyms, or product codes. Your user types &amp;ldquo;Error Code: 4815162342&amp;rdquo; and the semantic search goes, &amp;ldquo;Hmm, you seem to be interested in numerical sequences and technical issues.&amp;rdquo; Not helpful.&lt;/p>
&lt;p>Hybrid search is the answer. It combines the best of both worlds:&lt;/p>
&lt;p>&lt;strong>Keyword Search (like &lt;a
href="https://en.wikipedia.org/wiki/Okapi_BM25"
target="_blank"
>BM25&lt;/a>):&lt;/strong> The old-school, reliable method that&amp;rsquo;s fantastic at finding exact matches for specific terms.&lt;/p>
&lt;p>&lt;strong>Semantic Search:&lt;/strong> The modern approach that&amp;rsquo;s great for understanding the intent and context behind a query.&lt;/p>
&lt;p>By running both and intelligently merging the results, you get a system that can understand &amp;ldquo;tell me about our database connection pooling issues&amp;rdquo; and also pinpoint the exact log file mentioning &lt;code>DB-CONN-POOL-ERR-8675309&lt;/code>.&lt;/p>
&lt;h3 class="relative group">Fix #2: Add a Reranker
&lt;div id="fix-2-add-a-reranker" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#fix-2-add-a-reranker" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>Your retriever&amp;rsquo;s job is to be fast and cast a wide net. It should quickly fetch a bunch of potentially relevant documents (say, the top 25). But fast doesn&amp;rsquo;t always mean accurate.&lt;/p>
&lt;p>A reranker is a second, more powerful (and slower) model that acts as a quality control inspector. It takes that initial list of 25 documents and scrutinizes each one against the original query. Its only job is to ask, &amp;ldquo;How truly relevant is this piece of text to this specific question?&amp;rdquo; It then re-orders the list, pushing the absolute best candidates to the top.&lt;/p>
&lt;p>Think of it this way: retrieval is your broad Google search. Reranking is you actually clicking the top 5 links to see which one has the answer. It&amp;rsquo;s a crucial step for boosting precision.&lt;/p>
&lt;h2 class="relative group">Upgrade 2: Stop Blaming the User. Fix Their Queries.
&lt;div id="upgrade-2-stop-blaming-the-user-fix-their-queries" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#upgrade-2-stop-blaming-the-user-fix-their-queries" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Users don&amp;rsquo;t write perfect queries. They&amp;rsquo;re vague, they&amp;rsquo;re complex, or they&amp;rsquo;re just plain weird. &amp;ldquo;Garbage in, garbage out&amp;rdquo; applies here. Instead of just passing that garbage to your retriever, you can use an LLM to clean it up first. This is called &lt;strong>Query Transformation&lt;/strong>.&lt;/p>
&lt;p>&lt;strong>Query Expansion:&lt;/strong> The user asks, &amp;ldquo;How to handle auth?&amp;rdquo; The LLM can expand this to &amp;ldquo;How to handle user authentication, including login, logout, and token management?&amp;rdquo; providing a richer query for the retriever.&lt;/p>
&lt;p>&lt;strong>Sub-Question Decomposition:&lt;/strong> The user asks a multi-part question like, &amp;ldquo;How does our pricing for the Pro plan compare to the Enterprise plan, and what are the overage fees?&amp;rdquo; A naive RAG will get lost. A smarter system uses an LLM to break this into three separate questions, retrieves answers for each, and then synthesizes a final response. This single technique can dramatically improve answers to complex queries.&lt;/p>
&lt;h2 class="relative group">Upgrade 3: From Simple Pipeline to Autonomous Agent
&lt;div id="upgrade-3-from-simple-pipeline-to-autonomous-agent" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#upgrade-3-from-simple-pipeline-to-autonomous-agent" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>This is the big leap. A standard RAG is a fixed pipeline: Query → Retrieve → Augment → Generate. It&amp;rsquo;s a one-way street.&lt;/p>
&lt;p>&lt;strong>Agentic RAG&lt;/strong> throws that out the window. An agent is an LLM given a brain and a toolkit. Instead of blindly following a pipeline, it can reason, plan, and use tools to answer a question.&lt;/p>
&lt;p>Here&amp;rsquo;s what that actually means:&lt;/p>
&lt;p>&lt;strong>Planning:&lt;/strong> The agent receives the query and creates a multi-step plan. For &amp;ldquo;Compare product A and B,&amp;rdquo; the plan might be: 1. Find docs about product A. 2. Find docs about product B. 3. Synthesize the findings and highlight differences.&lt;/p>
&lt;p>&lt;strong>Tool Use:&lt;/strong> Your agent isn&amp;rsquo;t limited to just one retriever. You can give it multiple tools. Maybe it has a &lt;code>vector_search_tool&lt;/code> for your tech docs, a &lt;code>sql_database_tool&lt;/code> for user data, and an &lt;code>api_call_tool&lt;/code> for checking real-time stock prices. The agent chooses the right tool for the job based on the query.&lt;/p>
&lt;p>&lt;strong>Self-Correction:&lt;/strong> What if the first retrieval comes back with nothing useful? A naive RAG gives up. An agent can recognize the failure, think &amp;ldquo;Okay, that didn&amp;rsquo;t work,&amp;rdquo; and try something else, like rephrasing the query using one of the transformation techniques we just talked about and running the search again. It&amp;rsquo;s an iterative, self-healing process.&lt;/p>
&lt;p>This is the difference between a simple script and a thinking application. It&amp;rsquo;s how you go from answering simple questions to tackling complex, multi-faceted research tasks.&lt;/p>
&lt;h2 class="relative group">Upgrade 4: Your Data is Probably Garbage. Fix That First.
&lt;div id="upgrade-4-your-data-is-probably-garbage-fix-that-first" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#upgrade-4-your-data-is-probably-garbage-fix-that-first" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Here&amp;rsquo;s an uncomfortable truth: most RAG failures aren&amp;rsquo;t caused by fancy retrieval algorithms. They&amp;rsquo;re caused by bad data preparation. You can have the world&amp;rsquo;s most sophisticated agentic RAG, but if you&amp;rsquo;re feeding it poorly chunked, inconsistent documents, it&amp;rsquo;ll still give you garbage answers.&lt;/p>
&lt;h3 class="relative group">Chunking Strategy Matters More Than You Think
&lt;div id="chunking-strategy-matters-more-than-you-think" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#chunking-strategy-matters-more-than-you-think" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>Your first chunking attempt was probably &amp;ldquo;split on 500 characters with 50 character overlap.&amp;rdquo; That&amp;rsquo;s fine for a demo, but it&amp;rsquo;s terrible for production.&lt;/p>
&lt;p>&lt;strong>Semantic Chunking:&lt;/strong> Instead of arbitrary character limits, break documents at logical boundaries; paragraphs, sections, topics. Libraries like LangChain now support semantic chunking that uses embeddings to detect natural break points.&lt;/p>
&lt;p>&lt;strong>Context-Aware Chunking:&lt;/strong> Each chunk should be self-contained. A chunk that says &amp;ldquo;As mentioned above, the API key should be&amp;hellip;&amp;rdquo; is useless without the context. Add document titles, section headers, and relevant metadata to each chunk.&lt;/p>
&lt;p>&lt;strong>Multi-Scale Chunking:&lt;/strong> Store chunks at different granularities. Maybe you have sentence-level chunks for precise retrieval, paragraph chunks for context, and document-level chunks for broad topics. Different queries need different levels of detail.&lt;/p>
&lt;h3 class="relative group">Clean Your Data Like Your RAG Depends On It
&lt;div id="clean-your-data-like-your-rag-depends-on-it" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#clean-your-data-like-your-rag-depends-on-it" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>&lt;strong>Normalization:&lt;/strong> Convert everything to consistent formats. Dates, phone numbers, product codes. Standardize them. Your search will thank you.&lt;/p>
&lt;p>&lt;strong>Metadata is Gold:&lt;/strong> Don&amp;rsquo;t just store text. Add document type, creation date, author, department, confidence level, last updated. This metadata becomes powerful filtering criteria during retrieval.&lt;/p>
&lt;p>&lt;strong>Content Cleaning:&lt;/strong> Remove headers, footers, navigation elements, and other noise that dilutes the signal. A chunk that&amp;rsquo;s 80% boilerplate and 20% actual content will hurt your embeddings.&lt;/p>
&lt;h2 class="relative group">Upgrade 5: Stop Flying Blind. Measure What Matters.
&lt;div id="upgrade-5-stop-flying-blind-measure-what-matters" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#upgrade-5-stop-flying-blind-measure-what-matters" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>You&amp;rsquo;ve built an impressive RAG system, but how do you know if it&amp;rsquo;s actually good? &amp;ldquo;It feels better&amp;rdquo; isn&amp;rsquo;t enough when you&amp;rsquo;re in production.&lt;/p>
&lt;h3 class="relative group">Automated Evaluation is Non-Negotiable
&lt;div id="automated-evaluation-is-non-negotiable" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#automated-evaluation-is-non-negotiable" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>&lt;strong>Retrieval Evaluation:&lt;/strong> Track metrics like Mean Reciprocal Rank (MRR), Recall@K, and NDCG. Are you actually retrieving the right documents? Create a golden dataset of question-answer pairs and measure against it regularly.&lt;/p>
&lt;p>&lt;strong>Answer Quality:&lt;/strong> Use LLM-as-a-judge evaluation. GPT-5 can score your system&amp;rsquo;s answers against ground truth for relevance, accuracy, and completeness. It&amp;rsquo;s not perfect, but it&amp;rsquo;s consistent and scalable.&lt;/p>
&lt;p>&lt;strong>Human Feedback Loops:&lt;/strong> Build thumbs up/down buttons into your interface. Track which answers users found helpful. This real-world feedback is more valuable than any synthetic benchmark.&lt;/p>
&lt;h3 class="relative group">Production Monitoring
&lt;div id="production-monitoring" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#production-monitoring" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>&lt;strong>Retrieval Confidence Scores:&lt;/strong> Track when your system returns low-confidence results. If confidence drops below a threshold, surface that to users or trigger human review.&lt;/p>
&lt;p>&lt;strong>Query Pattern Analysis:&lt;/strong> What types of questions is your system struggling with? Are users asking about topics not covered in your knowledge base? This drives content strategy.&lt;/p>
&lt;p>&lt;strong>Hallucination Detection:&lt;/strong> Monitor when your system generates answers that don&amp;rsquo;t match the retrieved content. Some techniques include consistency checking and fact verification against the source material.&lt;/p>
&lt;h2 class="relative group">Upgrade 6: Know When to Say &amp;ldquo;I Don&amp;rsquo;t Know&amp;rdquo;
&lt;div id="upgrade-6-know-when-to-say-i-dont-know" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#upgrade-6-know-when-to-say-i-dont-know" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>A RAG system that confidently gives wrong answers is worse than one that admits uncertainty. Teaching your system to be humble is a production necessity, not a nice-to-have.&lt;/p>
&lt;p>
&lt;figure>
&lt;img
class="my-0 rounded-md"
loading="lazy"
decoding="async"
fetchpriority="low"
alt="GPT-5 admitting it doesn&amp;rsquo;t know something"
srcset="
/articles/so-youve-built-a-rag-now-lets-make-it-not-suck/gpt-5-do-not-know_hu_6c81db6f7dbfe042.png 330w,
/articles/so-youve-built-a-rag-now-lets-make-it-not-suck/gpt-5-do-not-know_hu_82cf3a0f558d02db.png 660w,
/articles/so-youve-built-a-rag-now-lets-make-it-not-suck/gpt-5-do-not-know_hu_ed305e07621dcd9b.png 1280w
"
data-zoom-src="https://pinishv.com/articles/so-youve-built-a-rag-now-lets-make-it-not-suck/gpt-5-do-not-know.png"
src="https://pinishv.com/articles/so-youve-built-a-rag-now-lets-make-it-not-suck/gpt-5-do-not-know.png">
&lt;/figure>
&lt;/p>
&lt;h3 class="relative group">Confidence Thresholding
&lt;div id="confidence-thresholding" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#confidence-thresholding" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>Set minimum confidence thresholds for both retrieval and generation. If your retriever returns documents with low similarity scores, or if your LLM&amp;rsquo;s generation confidence is low, return a &amp;ldquo;I couldn&amp;rsquo;t find sufficient information&amp;rdquo; response instead of hallucinating.&lt;/p>
&lt;h3 class="relative group">Query Coverage Analysis
&lt;div id="query-coverage-analysis" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#query-coverage-analysis" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>Build systems to detect when queries fall outside your knowledge base. If someone asks about &amp;ldquo;Project Falcon&amp;rdquo; but your documents only cover &amp;ldquo;Project Eagle,&amp;rdquo; detect that gap and respond appropriately rather than making something up about Falcon.&lt;/p>
&lt;h3 class="relative group">Graceful Degradation
&lt;div id="graceful-degradation" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#graceful-degradation" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>Instead of &amp;ldquo;I don&amp;rsquo;t know,&amp;rdquo; provide helpful alternatives:&lt;/p>
&lt;ul>
&lt;li>&amp;ldquo;I couldn&amp;rsquo;t find specific information about X, but here&amp;rsquo;s related information about Y&amp;hellip;&amp;rdquo;&lt;/li>
&lt;li>&amp;ldquo;Based on the documents available to me, I can only find partial information about&amp;hellip;&amp;rdquo;&lt;/li>
&lt;li>&amp;ldquo;This question might require information not in my knowledge base. You might want to check&amp;hellip;&amp;rdquo;&lt;/li>
&lt;/ul>
&lt;h2 class="relative group">Upgrade 7: Speed vs. Quality: Welcome to Production Trade-offs
&lt;div id="upgrade-7-speed-vs-quality-welcome-to-production-trade-offs" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#upgrade-7-speed-vs-quality-welcome-to-production-trade-offs" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Your beautiful multi-stage RAG pipeline with reranking and query transformation? It might be taking 8 seconds per query. Users will not wait.&lt;/p>
&lt;h3 class="relative group">Latency Optimization Strategies
&lt;div id="latency-optimization-strategies" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#latency-optimization-strategies" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>&lt;strong>Caching:&lt;/strong> Cache embeddings, cache frequent queries, cache reranker results. Redis becomes your best friend.&lt;/p>
&lt;p>&lt;strong>Parallel Processing:&lt;/strong> Run retrieval and reranking in parallel where possible. While you&amp;rsquo;re generating embeddings for the query, start your keyword search.&lt;/p>
&lt;p>&lt;strong>Staged Retrieval:&lt;/strong> Use fast, rough retrieval for the first stage (getting 100 candidates), then expensive, precise reranking for the final stage (ranking top 10).&lt;/p>
&lt;p>&lt;strong>Pre-computation:&lt;/strong> For common queries or categories, pre-compute and cache results. Your &amp;ldquo;How do I reset my password?&amp;rdquo; answer doesn&amp;rsquo;t need to be generated fresh every time.&lt;/p>
&lt;h3 class="relative group">Scaling Considerations
&lt;div id="scaling-considerations" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#scaling-considerations" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>&lt;strong>Multi-Modal Indexing:&lt;/strong> Different document types might need different indexing strategies. PDFs, code, structured data, don&amp;rsquo;t force everything through the same pipeline.&lt;/p>
&lt;p>&lt;strong>Distributed Search:&lt;/strong> As your knowledge base grows, you&amp;rsquo;ll need distributed vector search. Plan for it early.&lt;/p>
&lt;p>&lt;strong>Load Balancing:&lt;/strong> Different queries have different computational costs. A simple FAQ lookup is cheap; a complex multi-document analysis is expensive. Route accordingly.&lt;/p>
&lt;h2 class="relative group">Upgrade 8: Not Everyone Should See Everything
&lt;div id="upgrade-8-not-everyone-should-see-everything" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#upgrade-8-not-everyone-should-see-everything" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>In the enterprise world, document access control isn&amp;rsquo;t optional. Your RAG system needs to respect the same permissions as your file system.&lt;/p>
&lt;h3 class="relative group">User-Aware Retrieval
&lt;div id="user-aware-retrieval" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#user-aware-retrieval" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>&lt;strong>Filtered Search:&lt;/strong> Before retrieval, filter your knowledge base based on user permissions. Never retrieve documents the user shouldn&amp;rsquo;t see, even if they&amp;rsquo;re relevant.&lt;/p>
&lt;p>&lt;strong>Department-Based Access:&lt;/strong> Sales shouldn&amp;rsquo;t see engineering docs, finance shouldn&amp;rsquo;t see HR records. Implement role-based filtering at the retrieval level.&lt;/p>
&lt;p>&lt;strong>Dynamic Permissions:&lt;/strong> Permissions change. That project doc that was public last month might be confidential now. Keep your permission metadata synchronized with your source systems.&lt;/p>
&lt;h3 class="relative group">Security Considerations
&lt;div id="security-considerations" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#security-considerations" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>&lt;strong>Audit Trails:&lt;/strong> Log what users searched for and what documents were accessed. Compliance teams will thank you.&lt;/p>
&lt;p>&lt;strong>Data Residency:&lt;/strong> Know where your embeddings and cached data live. Some enterprises have strict requirements about data geography.&lt;/p>
&lt;p>&lt;strong>Prompt Injection Protection:&lt;/strong> Users will try to trick your system into revealing information they shouldn&amp;rsquo;t see. Implement safeguards against prompt injection attacks.&lt;/p>
&lt;h2 class="relative group">Upgrade 9: Presentation is Half the Battle
&lt;div id="upgrade-9-presentation-is-half-the-battle" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#upgrade-9-presentation-is-half-the-battle" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Having the right answer is only half the problem. Presenting it in a way that builds user trust and provides actionable information is the other half.&lt;/p>
&lt;h3 class="relative group">Citation and Source Attribution
&lt;div id="citation-and-source-attribution" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#citation-and-source-attribution" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>&lt;strong>Always Cite Sources:&lt;/strong> Every claim should link back to the source document, with page numbers or section references when possible.&lt;/p>
&lt;p>&lt;strong>Confidence Indicators:&lt;/strong> Show users how confident the system is. &amp;ldquo;Based on 3 highly relevant documents&amp;rdquo; vs &amp;ldquo;Based on 1 partially relevant document&amp;rdquo; sets very different expectations.&lt;/p>
&lt;p>&lt;strong>Source Metadata:&lt;/strong> Show document dates, authors, and types. A 5-year-old troubleshooting guide has different credibility than last week&amp;rsquo;s policy update.&lt;/p>
&lt;h3 class="relative group">Answer Formatting
&lt;div id="answer-formatting" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#answer-formatting" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>&lt;strong>Structured Responses:&lt;/strong> Don&amp;rsquo;t just return paragraphs. Use bullet points, tables, step-by-step instructions when appropriate.&lt;/p>
&lt;p>&lt;strong>Progressive Disclosure:&lt;/strong> Start with a concise answer, then offer &amp;ldquo;Show more detail&amp;rdquo; options for users who want to dig deeper.&lt;/p>
&lt;p>&lt;strong>Multi-Modal Responses:&lt;/strong> If your knowledge base includes images, charts, or code snippets, surface them alongside text answers.&lt;/p>
&lt;h2 class="relative group">The Implementation Reality
&lt;div id="the-implementation-reality" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#the-implementation-reality" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Let me be honest: these aren&amp;rsquo;t just academic improvements. They&amp;rsquo;re the difference between a system that works in your demo and one that works when your boss&amp;rsquo;s boss uses it.&lt;/p>
&lt;p>&lt;strong>Start with hybrid search and reranking.&lt;/strong> These are the highest-ROI improvements. Most vector databases now support hybrid search out of the box (Weaviate, Pinecone, Elasticsearch). For rerankers, Cohere has an excellent API, or you can use open-source models like &lt;code>ms-marco-MiniLM-L-12-v2&lt;/code>.&lt;/p>
&lt;p>&lt;strong>But here&amp;rsquo;s the priority order for real production systems:&lt;/strong>&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Fix your data first&lt;/strong> (Upgrade 4). No amount of fancy retrieval will save you from bad chunking and dirty data.&lt;/li>
&lt;li>&lt;strong>Add measurement and monitoring&lt;/strong> (Upgrade 5). You can&amp;rsquo;t improve what you can&amp;rsquo;t measure.&lt;/li>
&lt;li>&lt;strong>Implement hybrid search and reranking&lt;/strong> (Upgrades 1-2). Highest ROI improvements.&lt;/li>
&lt;li>&lt;strong>Handle uncertainty gracefully&lt;/strong> (Upgrade 6). Better to say &amp;ldquo;I don&amp;rsquo;t know&amp;rdquo; than to hallucinate confidently.&lt;/li>
&lt;li>&lt;strong>Optimize for production constraints&lt;/strong> (Upgrades 7-9). Speed, security, and presentation matter.&lt;/li>
&lt;li>&lt;strong>Consider agentic architectures&lt;/strong> (Upgrade 3). Only when you&amp;rsquo;ve hit the limits of linear RAG.&lt;/li>
&lt;/ol>
&lt;h2 class="relative group">The Bottom Line: Production RAG is Systems Engineering
&lt;div id="the-bottom-line-production-rag-is-systems-engineering" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#the-bottom-line-production-rag-is-systems-engineering" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Building a basic RAG is now table stakes. Building a RAG that survives contact with real users, enterprise security requirements, and production scale? That&amp;rsquo;s systems engineering.&lt;/p>
&lt;p>The difference between a prototype and production isn&amp;rsquo;t just code, it&amp;rsquo;s data quality, monitoring, user experience, security, and operational concerns. The companies winning with RAG aren&amp;rsquo;t the ones with the fanciest algorithms; they&amp;rsquo;re the ones who&amp;rsquo;ve solved these unglamorous but critical problems.&lt;/p>
&lt;p>Your users don&amp;rsquo;t care about your embedding model. They care about getting accurate, fast, trustworthy answers to their questions. Everything else is just implementation details.&lt;/p>
&lt;p>The tools are evolving rapidly; LlamaIndex, LangChain, specialized vector databases, evaluation frameworks. But the fundamentals remain: clean data, good measurement, graceful failure handling, and respect for production constraints.&lt;/p>
&lt;p>The future belongs to RAG systems that are both intelligent and reliable. Make yours one of them.&lt;/p></content:encoded><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://pinishv.com/articles/so-youve-built-a-rag-now-lets-make-it-not-suck/feature.png"/></item><item><title>RAG for Developers: A No-BS Introduction</title><link>https://pinishv.com/articles/rag-for-developers-a-no-bs-introduction/</link><pubDate>Sun, 21 Sep 2025 00:00:00 +0000</pubDate><guid>https://pinishv.com/articles/rag-for-developers-a-no-bs-introduction/</guid><description>Developers keep asking me to explain RAG. Here&amp;rsquo;s the straightforward explanation: it&amp;rsquo;s the difference between an AI that makes stuff up and one that actually knows your company&amp;rsquo;s data.</description><content:encoded>&lt;p>I&amp;rsquo;m being asked by developers from time to time to explain what RAG is. Usually, it&amp;rsquo;s because they&amp;rsquo;ve heard the term thrown around in AI circles, or their company is evaluating whether to build a RAG system, or they&amp;rsquo;re trying to figure out if it&amp;rsquo;s just another AI buzzword.&lt;/p>
&lt;p>Here&amp;rsquo;s the straightforward answer: &lt;strong>RAG stands for Retrieval-Augmented Generation, and it&amp;rsquo;s the difference between an AI that makes stuff up and one that actually knows your company&amp;rsquo;s data.&lt;/strong>&lt;/p>
&lt;p>Think of an LLM like a brilliant new hire who has read the entire internet up to a certain date. They know a ton, but their knowledge is frozen in time, and they don&amp;rsquo;t know anything about your company&amp;rsquo;s private data; your internal wiki, your codebase, your support tickets, your processes.&lt;/p>
&lt;p>You have two ways to get this new hire up to speed:&lt;/p>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>Fine-Tuning:&lt;/strong> Send them to an intense, months-long training program. You retrain the model on your specific data. It&amp;rsquo;s powerful, but it&amp;rsquo;s slow, expensive, and you have to do it all over again every time your data changes.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>RAG:&lt;/strong> Give them access to your company&amp;rsquo;s internal search engine. When they get a question, they first search for the most relevant documents and &lt;em>then&lt;/em> use their intelligence to formulate an answer based on what they found.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>RAG is the second approach. It&amp;rsquo;s a surprisingly simple way to make LLMs smarter, more accurate, and more useful by connecting them to live, external data sources.&lt;/p>
&lt;h2 class="relative group">How RAG Actually Works
&lt;div id="how-rag-actually-works" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#how-rag-actually-works" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>At its core, RAG is a two-step process. When you ask a question, the system doesn&amp;rsquo;t just pass it directly to the LLM.&lt;/p>
&lt;h3 class="relative group">Step 1: Retrieval (The &amp;ldquo;R&amp;rdquo;)
&lt;div id="step-1-retrieval-the-r" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#step-1-retrieval-the-r" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>First, the system takes your question and searches for relevant information. This isn&amp;rsquo;t keyword search, it&amp;rsquo;s semantic search that looks for meaning and context, not just matching words.&lt;/p>
&lt;p>Here&amp;rsquo;s where the magic happens:&lt;/p>
&lt;p>&lt;strong>Embeddings:&lt;/strong> An embedding model converts your text (documents, sentences, your question) into a vector, a list of numbers that represents the text&amp;rsquo;s meaning. Think of it like GPS coordinates for information. Texts with similar meanings get similar vectors and end up &amp;ldquo;close&amp;rdquo; to each other in high-dimensional space.&lt;/p>
&lt;p>&lt;strong>Vector Database:&lt;/strong> This is where you store and search through these vectors incredibly fast. When your question comes in, the system creates an embedding of the question and uses the vector database to find the text chunks whose vectors are closest to your question&amp;rsquo;s vector. Popular options include Pinecone, Chroma, and Weaviate.&lt;/p>
&lt;p>&lt;strong>Chunking:&lt;/strong> You don&amp;rsquo;t dump entire documents into the database. You break them down into logical pieces or &amp;ldquo;chunks.&amp;rdquo; This makes search results more precise and relevant.&lt;/p>
&lt;p>The retrieval step finds the most relevant chunks of text from your knowledge base and passes them to the next step.&lt;/p>
&lt;h3 class="relative group">Step 2: Augmentation and Generation (The &amp;ldquo;AG&amp;rdquo;)
&lt;div id="step-2-augmentation-and-generation-the-ag" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#step-2-augmentation-and-generation-the-ag" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>This part is straightforward. The system takes your original question and &amp;ldquo;augments&amp;rdquo; it by stuffing the relevant text chunks right into the prompt.&lt;/p>
&lt;p>The final prompt sent to the LLM looks like this:&lt;/p>
&lt;pre tabindex="0">&lt;code>Context: [Here are the relevant text chunks we found...]
Based on the context above, answer this question: [Your original question...]
&lt;/code>&lt;/pre>&lt;p>The LLM uses its reasoning ability to synthesize an answer based &lt;em>only on the provided context&lt;/em>. This simple trick dramatically improves the quality and accuracy of the output.&lt;/p>
&lt;h2 class="relative group">Why You Should Care
&lt;div id="why-you-should-care" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#why-you-should-care" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Okay, so the tech is interesting. But what does it actually mean for you as a developer?&lt;/p>
&lt;p>&lt;strong>It fights hallucinations.&lt;/strong> The biggest problem with LLMs is that they sometimes make stuff up with incredible confidence. RAG grounds the LLM in facts. By forcing it to base answers on documents you provide, you drastically reduce hallucination.&lt;/p>
&lt;p>&lt;strong>Your data stays yours.&lt;/strong> With RAG, you&amp;rsquo;re not retraining a model or sending sensitive data to third parties. The knowledge base lives in your infrastructure. You&amp;rsquo;re just pulling relevant pieces at query time.&lt;/p>
&lt;p>&lt;strong>It&amp;rsquo;s always up-to-date.&lt;/strong> Company wiki updated? New support ticket? Just create an embedding and add it to your vector database. The LLM can use this information instantly. Compare that to the pain of constantly fine-tuning a model.&lt;/p>
&lt;p>&lt;strong>You can cite sources.&lt;/strong> Because you know exactly which chunks were used to generate the answer, you can easily add citations. This builds trust in your application, whether it&amp;rsquo;s an internal chatbot or public-facing support system.&lt;/p>
&lt;h2 class="relative group">RAG vs. Fine-Tuning: When to Use What
&lt;div id="rag-vs-fine-tuning-when-to-use-what" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#rag-vs-fine-tuning-when-to-use-what" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Here&amp;rsquo;s the practical breakdown:&lt;/p>
&lt;h3 class="relative group">Use RAG when:
&lt;div id="use-rag-when" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#use-rag-when" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;ul>
&lt;li>You need to ground the LLM in specific, factual, changing information&lt;/li>
&lt;li>You need to prevent hallucinations and cite sources&lt;/li>
&lt;li>Your application is knowledge-based (Q&amp;amp;A on documents, custom support bot)&lt;/li>
&lt;li>You want your AI to know about recent information&lt;/li>
&lt;/ul>
&lt;h3 class="relative group">Use Fine-Tuning when:
&lt;div id="use-fine-tuning-when" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#use-fine-tuning-when" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;ul>
&lt;li>You need to change the LLM&amp;rsquo;s &lt;em>behavior&lt;/em>, &lt;em>style&lt;/em>, or &lt;em>tone&lt;/em>&lt;/li>
&lt;li>You want it to learn specific domain language or formats&lt;/li>
&lt;li>You need it to always respond in a particular way (like generating code in a niche programming language)&lt;/li>
&lt;/ul>
&lt;p>They aren&amp;rsquo;t mutually exclusive. You can use RAG on a fine-tuned model for the best of both worlds. But &lt;strong>for most developers starting out, RAG is the most direct, cheapest, and effective way to build powerful, fact-based AI applications.&lt;/strong>&lt;/p>
&lt;h2 class="relative group">The Real-World Impact
&lt;div id="the-real-world-impact" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#the-real-world-impact" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Here are some quick wins for teams looking to implement RAG:&lt;/p>
&lt;p>&lt;strong>Support teams&lt;/strong> should build chatbots that can answer customer questions using the actual documentation, not hallucinated answers that sound plausible but are wrong.&lt;/p>
&lt;p>&lt;strong>Engineering teams&lt;/strong> should create internal assistants that can explain legacy codebases, find relevant examples, and help onboard new developers using actual project documentation and code comments.&lt;/p>
&lt;p>&lt;strong>Product teams&lt;/strong> should build recommendation systems that use real product data, user feedback, and business context rather than generic suggestions.&lt;/p>
&lt;p>The pattern is consistent: RAG turns general-purpose AI into domain-specific expertise. And that&amp;rsquo;s where the real value lives.&lt;/p>
&lt;h2 class="relative group">The Bottom Line
&lt;div id="the-bottom-line" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#the-bottom-line" aria-label="Anchor">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>RAG isn&amp;rsquo;t magic, it&amp;rsquo;s engineering. It&amp;rsquo;s a straightforward pattern that solves a real problem: how to make AI systems that are both intelligent and accurate.&lt;/p>
&lt;p>If you&amp;rsquo;re building AI applications that need to be grounded in facts, cite sources, or work with private data, RAG should be on your radar. The infrastructure is mature, the patterns are proven, and the results speak for themselves.&lt;/p>
&lt;p>The future belongs to AI systems that combine the reasoning power of large language models with the accuracy of real data. RAG is how you get there.&lt;/p></content:encoded><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://pinishv.com/articles/rag-for-developers-a-no-bs-introduction/feature.png"/></item></channel></rss>