<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Python in Plain English - Medium]]></title>
        <description><![CDATA[New Python content every day. Follow to join our 3.5M+ monthly readers. - Medium]]></description>
        <link>https://python.plainenglish.io?source=rss----78073def27b8---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Python in Plain English - Medium</title>
            <link>https://python.plainenglish.io?source=rss----78073def27b8---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 10 Nov 2026 06:00:44 GMT</lastBuildDate>
        <atom:link href="https://python.plainenglish.io/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[AI Is Allowed in Coding Interviews Now. Python Interviews Got Harder Anyway.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://python.plainenglish.io/ai-is-allowed-in-coding-interviews-now-python-interviews-got-harder-anyway-6c806b325424?source=rss----78073def27b8---4"><img src="https://cdn-images-1.medium.com/max/2600/1*LJUJFPZxweuufUow0VoEvw.png" width="2800"></a></p><p class="medium-feed-snippet">Google, Meta and Canva let candidates bring an assistant. The algorithm screen never left, and the new round grades the skill that is&#x2026;</p><p class="medium-feed-link"><a href="https://python.plainenglish.io/ai-is-allowed-in-coding-interviews-now-python-interviews-got-harder-anyway-6c806b325424?source=rss----78073def27b8---4">Continue reading on Python in Plain English »</a></p></div>]]></description>
            <link>https://python.plainenglish.io/ai-is-allowed-in-coding-interviews-now-python-interviews-got-harder-anyway-6c806b325424?source=rss----78073def27b8---4</link>
            <guid isPermaLink="false">https://medium.com/p/6c806b325424</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[github-copilot]]></category>
            <category><![CDATA[coding-interviews]]></category>
            <dc:creator><![CDATA[Zainab Ikhwan]]></dc:creator>
            <pubDate>Tue, 10 Nov 2026 05:54:16 GMT</pubDate>
            <atom:updated>2026-11-10T05:54:14.794Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[8 Python Libraries That Do the Work of Whole Services]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://python.plainenglish.io/8-python-libraries-that-do-the-work-of-whole-services-033302811b6e?source=rss----78073def27b8---4"><img src="https://cdn-images-1.medium.com/max/1672/1*rBhTOdVX0HxkCZCmDXnupg.png" width="1672"></a></p><p class="medium-feed-snippet">Some Python libraries replace a web service, a paid API or a week of research with one import.</p><p class="medium-feed-link"><a href="https://python.plainenglish.io/8-python-libraries-that-do-the-work-of-whole-services-033302811b6e?source=rss----78073def27b8---4">Continue reading on Python in Plain English »</a></p></div>]]></description>
            <link>https://python.plainenglish.io/8-python-libraries-that-do-the-work-of-whole-services-033302811b6e?source=rss----78073def27b8---4</link>
            <guid isPermaLink="false">https://medium.com/p/033302811b6e</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Hasnainraja]]></dc:creator>
            <pubDate>Tue, 10 Nov 2026 00:31:01 GMT</pubDate>
            <atom:updated>2026-11-10T00:31:01.641Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[7 Python Libraries That Solve Problems You Assumed Were Hard]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://python.plainenglish.io/7-python-libraries-that-solve-problems-you-assumed-were-hard-da8c731c2b3d?source=rss----78073def27b8---4"><img src="https://cdn-images-1.medium.com/max/1672/1*UK2ImnTYBC6gNsXn3GCYHg.png" width="1672"></a></p><p class="medium-feed-snippet">Some Python libraries turn a problem that sounds like research into a few clear lines.</p><p class="medium-feed-link"><a href="https://python.plainenglish.io/7-python-libraries-that-solve-problems-you-assumed-were-hard-da8c731c2b3d?source=rss----78073def27b8---4">Continue reading on Python in Plain English »</a></p></div>]]></description>
            <link>https://python.plainenglish.io/7-python-libraries-that-solve-problems-you-assumed-were-hard-da8c731c2b3d?source=rss----78073def27b8---4</link>
            <guid isPermaLink="false">https://medium.com/p/da8c731c2b3d</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Abdul Ahad]]></dc:creator>
            <pubDate>Tue, 10 Nov 2026 00:01:02 GMT</pubDate>
            <atom:updated>2026-11-10T00:01:01.984Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Random Wavelet nnU-Net: Prostate Lesion Masks Across bpMRI Sites]]></title>
            <link>https://python.plainenglish.io/random-wavelet-nnu-net-prostate-lesion-masks-across-bpmri-sites-1982892ab97e?source=rss----78073def27b8---4</link>
            <guid isPermaLink="false">https://medium.com/p/1982892ab97e</guid>
            <category><![CDATA[healthcare]]></category>
            <category><![CDATA[medical-imaging]]></category>
            <category><![CDATA[prostate-cancer]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Mohammed El Amine Mokhtari]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 23:12:07 GMT</pubDate>
            <atom:updated>2026-11-09T23:12:06.663Z</atom:updated>
            <content:encoded><![CDATA[<p>AI-assistance disclosure: I drafted this article with AI assistance, then edited it and fact-checked every number against the paper (arXiv:2611.08535).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K-v3zBgugrV_iGapyHzzhQ.png" /></figure><p>If you have ever tried to train a prostate lesion model on more than one public dataset, you know the problem. Every cohort was scanned differently and labeled by different rules, and the lesions themselves are small and low contrast on biparametric MRI (bpMRI). In <a href="https://arxiv.org/abs/2611.08535">arXiv:2611.08535</a>, Thibault Heintz and colleagues at Weill Cornell Medicine and Cornell Tech pool five of those cohorts into one nnU-Net, add a deliberately destructive augmentation based on random wavelet filters, and release both the trainer code and the trained checkpoint, so you can download the model and run it on your own studies.</p><h3>What the model does</h3><p>You give it three co-registered sequences of a prostate bpMRI study: T2-weighted, the ADC map and the high b-value DWI, with ADC and DWI resampled onto the T2 grid. It returns a 3D mask with a lesion label. During training it also learns a prostate gland label, a trick called BackSplit (co-developed by one of the authors) that gives the network extra signal about the organ around a small lesion. At inference only the lesion label is used.</p><p>For a viewer or a reporting tool, the mask stands in for the contour a radiologist draws by hand today before an MRI-ultrasound fusion biopsy or a structured report. The paper cites only moderate agreement between readers for those contours, so a model-drafted first contour has a clear place in that workflow.</p><h3>Five cohorts, five labeling rules</h3><p>The training pool has 1,579 lesion-containing cases, which the authors describe as the largest collection used for this task. It combines a derived PROMIS set, PI-CAI (with the extra annotations by Pooch et al.), Prostate158, the UCLA Prostate-MRI-US-Biopsy collection (PMUB) and an internal Weill Cornell cohort. The cohorts differ in three ways that matter for training:</p><ul><li><strong>Scanners.</strong> PROMIS is entirely 1.5T, PI-CAI mixes 1.5T and 3T, the rest are 3T. High b-values range from 1000 to 1400 s/mm².</li><li><strong>What counts as a lesion.</strong> Prostate158 annotates PI-RADS 4 and above, the internal cohort generally PI-RADS 3 and above, PMUB only the biopsy targets, and PI-CAI lesions of ISUP grade 2 or higher.</li><li><strong>Lesion size.</strong> Median lesion volume runs from 0.182 mL in the internal data to 1.121 mL in PROMIS, mostly a consequence of those labeling rules.</li></ul><h3>Destructive augmentation with random wavelets</h3><p>With probability 0.5 per training sample, on top of the standard nnU-Net augmentations, each sequence is replaced by the response of a randomly built wavelet filter. The filter decomposes the volume at four scales, mixes the detail bands of the three axes along a random direction, sums the scales with random weights and rescales the result to the original intensity range. A new filter is drawn for each sequence.</p><p>The result looks nothing like an MRI. The featured image of this post shows Fig. 1 of the paper: the top row is a PI-CAI case as acquired, the bottom row is the same case after the sym4 filter. Textures are scrambled and edges are displaced. The authors argue that this helps because the labels are fuzzy and the cohorts differ, so the network gains little from fitting exact image-to-mask alignment. They compare four wavelet families (Haar, db2, db4, sym4) against random convolutions and nnU-Net’s stronger DA5 preset, and sym4 comes out best on average Dice. The gain is largest on PROMIS, the only cohort scanned entirely at 1.5T and a minority of the training data.</p><p>The second change is the loss. Plain Dice plus cross-entropy is computed over all lesion voxels at once, so one large lesion can dominate a case with several small ones. They add a connected-component loss (CC-Dice-CE) that splits the volume into Voronoi cells around each reference lesion and scores each lesion in its own cell, and they show it works together with BackSplit.</p><h3>How well it works</h3><p>On the official Prostate158 test split, against Reader 1 labels, the final model reaches a Dice of 0.614, compared with the 0.450 baseline reported by the dataset authors. Across all five test sets, the full recipe raises mean Dice from 0.391 for a plain nnU-Net ResEnc-M to 0.422.</p><p>Both the wavelet augmentation and the CC loss raise lesion-level recall and lower precision. The final model’s lesion F1 across all test sets is 0.571, below the 0.596 of the BackSplit-only model, though still above plain nnU-Net. The authors say they prefer recall because a missed lesion costs more than a false positive. In a viewer, that means more candidate blobs for the reader to dismiss.</p><h3>Where it can fail</h3><ul><li><strong>No negative cases.</strong> Cases without an annotated lesion were excluded from training and testing, so there is no evidence on how often the model marks something in a lesion-free gland. Run it on your own negatives before you show its output to anyone.</li><li><strong>Lenient detection rule.</strong> A predicted lesion counts as found if it overlaps a reference lesion with Dice above 0.1. The detection numbers are therefore generous about boundary quality.</li><li><strong>Small public test set.</strong> The Prostate158 test split behind the headline number has 19 cases.</li><li><strong>Single fold, final checkpoint.</strong> Every configuration was trained once on one fold, so small differences between augmentations may sit inside run-to-run noise.</li><li><strong>Input preparation is on you.</strong> The model expects ADC and DWI already resampled to the T2 grid and stored as NIfTI in nnU-Net’s channel order. When you start from DICOM series, that conversion and resampling step is where most integration bugs will hide.</li><li><strong>Not tested out of domain.</strong> The authors list a true out-of-domain evaluation as future work.</li></ul><h3>Code, weights and license</h3><p>The trainers live on GitHub at <a href="https://github.com/tppm/prostate_lesion_segmentation">tppm/prostate_lesion_segmentation</a> under the MIT license. They plug into nnU-Net v2 as extra trainer classes driven by small YAML configs, and the repo includes the evaluation script and the train, validation and test split lists for the public cohorts. The final checkpoint (ResEnc-M, 3d_fullres, fold 0, about 400 MB as safetensors) is on Hugging Face at <a href="https://huggingface.co/heintz/prostate_lesion_seg">heintz/prostate_lesion_seg</a>, also marked MIT. A few rough edges as of 9 November 2026: the README still shows a placeholder for the Hugging Face repo name, the trainer imports a bicc_loss module that is not in the repo, and the README says the models were trained on an nnU-Net fork without linking the commit. Expect some plumbing before the first prediction.</p><p>The MIT tag covers the code and the weights as published. The training data come from public cohorts with their own terms plus an internal cohort that is not shared, so check those terms before building a commercial product on the checkpoint. The model is research software and is not cleared as a medical device.</p><p><strong>Paper:</strong> <a href="https://arxiv.org/abs/2611.08535">arXiv:2611.08535</a> · <strong>Code:</strong> <a href="https://github.com/tppm/prostate_lesion_segmentation">GitHub</a> (MIT) · <strong>Weights:</strong> <a href="https://huggingface.co/heintz/prostate_lesion_seg">Hugging Face</a> (MIT)</p><p>Originally published on pycad.co, the canonical version: https://pycad.co/blog/random-wavelet-nnunet-prostate-lesion-bpmri/</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1982892ab97e" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/random-wavelet-nnu-net-prostate-lesion-masks-across-bpmri-sites-1982892ab97e">Random Wavelet nnU-Net: Prostate Lesion Masks Across bpMRI Sites</a> was originally published in <a href="https://python.plainenglish.io">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day #2 of Learning Python for Machine Learning and Data Science]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://python.plainenglish.io/day-2-of-learning-python-for-machine-learning-and-data-science-a8b206d630c0?source=rss----78073def27b8---4"><img src="https://cdn-images-1.medium.com/max/2600/0*x8c4RByNHWJL6Ypz" width="14467"></a></p><p class="medium-feed-snippet">Understanding variables and data types</p><p class="medium-feed-link"><a href="https://python.plainenglish.io/day-2-of-learning-python-for-machine-learning-and-data-science-a8b206d630c0?source=rss----78073def27b8---4">Continue reading on Python in Plain English »</a></p></div>]]></description>
            <link>https://python.plainenglish.io/day-2-of-learning-python-for-machine-learning-and-data-science-a8b206d630c0?source=rss----78073def27b8---4</link>
            <guid isPermaLink="false">https://medium.com/p/a8b206d630c0</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Ekta Soni]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 23:11:53 GMT</pubDate>
            <atom:updated>2026-11-09T23:11:52.402Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[What is Low Level Design? (Explained Like You’re Building Your First House)]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://python.plainenglish.io/what-is-low-level-design-explained-like-youre-building-your-first-house-5320973852d7?source=rss----78073def27b8---4"><img src="https://cdn-images-1.medium.com/max/1485/1*AuuKrcwMZmsv1V8Wo_xi6A.png" width="1485"></a></p><p class="medium-feed-snippet">LLD in Python &#x2014; From Zero, Part 1</p><p class="medium-feed-link"><a href="https://python.plainenglish.io/what-is-low-level-design-explained-like-youre-building-your-first-house-5320973852d7?source=rss----78073def27b8---4">Continue reading on Python in Plain English »</a></p></div>]]></description>
            <link>https://python.plainenglish.io/what-is-low-level-design-explained-like-youre-building-your-first-house-5320973852d7?source=rss----78073def27b8---4</link>
            <guid isPermaLink="false">https://medium.com/p/5320973852d7</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[low-level-design]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Pulkit Kapoor]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 23:11:40 GMT</pubDate>
            <atom:updated>2026-11-09T23:11:39.069Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Classes and Objects in Python: The Cookie Cutter Story]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://python.plainenglish.io/classes-and-objects-in-python-the-cookie-cutter-story-3e748c4adb64?source=rss----78073def27b8---4"><img src="https://cdn-images-1.medium.com/max/1485/1*b5qMIdC-uT75LA6CXaRi1Q.png" width="1485"></a></p><p class="medium-feed-snippet">LLD in Python &#x2014; From Zero, Part 2</p><p class="medium-feed-link"><a href="https://python.plainenglish.io/classes-and-objects-in-python-the-cookie-cutter-story-3e748c4adb64?source=rss----78073def27b8---4">Continue reading on Python in Plain English »</a></p></div>]]></description>
            <link>https://python.plainenglish.io/classes-and-objects-in-python-the-cookie-cutter-story-3e748c4adb64?source=rss----78073def27b8---4</link>
            <guid isPermaLink="false">https://medium.com/p/3e748c4adb64</guid>
            <category><![CDATA[low-level-design]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Pulkit Kapoor]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 23:11:23 GMT</pubDate>
            <atom:updated>2026-11-09T23:11:22.278Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[10 Developer Tools I Wish I Had Discovered Earlier]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://python.plainenglish.io/10-developer-tools-i-wish-i-had-discovered-earlier-30e546ba2e52?source=rss----78073def27b8---4"><img src="https://cdn-images-1.medium.com/max/1672/1*iT2nGLedCsj4MT7zTXfB0w.png" width="1672"></a></p><p class="medium-feed-snippet">Not every useful developer tool is an AI tool. These 10 underrated utilities can make coding, debugging, and everyday development much&#x2026;</p><p class="medium-feed-link"><a href="https://python.plainenglish.io/10-developer-tools-i-wish-i-had-discovered-earlier-30e546ba2e52?source=rss----78073def27b8---4">Continue reading on Python in Plain English »</a></p></div>]]></description>
            <link>https://python.plainenglish.io/10-developer-tools-i-wish-i-had-discovered-earlier-30e546ba2e52?source=rss----78073def27b8---4</link>
            <guid isPermaLink="false">https://medium.com/p/30e546ba2e52</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Arham Ali]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 23:11:08 GMT</pubDate>
            <atom:updated>2026-11-09T23:11:06.883Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Building an AI Research Agent from Scratch in Python with LangChain]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://python.plainenglish.io/building-an-ai-research-agent-from-scratch-in-python-with-langchain-802472a5a8f6?source=rss----78073def27b8---4"><img src="https://cdn-images-1.medium.com/max/2600/0*JkxmmD9T8-ciged9" width="14467"></a></p><p class="medium-feed-snippet">This pattern, LLM + structured output + tools + prompt, is the core of most production agents built with LangChain today.</p><p class="medium-feed-link"><a href="https://python.plainenglish.io/building-an-ai-research-agent-from-scratch-in-python-with-langchain-802472a5a8f6?source=rss----78073def27b8---4">Continue reading on Python in Plain English »</a></p></div>]]></description>
            <link>https://python.plainenglish.io/building-an-ai-research-agent-from-scratch-in-python-with-langchain-802472a5a8f6?source=rss----78073def27b8---4</link>
            <guid isPermaLink="false">https://medium.com/p/802472a5a8f6</guid>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[python-web-developer]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python-libraries]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Ifeanyi Ogbuehi]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 15:12:17 GMT</pubDate>
            <atom:updated>2026-11-09T15:12:16.279Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Why RAG Systems Still Give Wrong Answers, and Where to Look First]]></title>
            <link>https://python.plainenglish.io/why-rag-systems-still-give-wrong-answers-and-where-to-look-first-29efe02b7851?source=rss----78073def27b8---4</link>
            <guid isPermaLink="false">https://medium.com/p/29efe02b7851</guid>
            <dc:creator><![CDATA[Anna Parker | Business & Tech Analyst]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 14:50:16 GMT</pubDate>
            <atom:updated>2026-11-09T14:50:14.401Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zt5akLWEFFAZC-banxSJyg.png" /><figcaption>Image credit: Original cover graphic created by the author, Anna Parker</figcaption></figure><p>Retrieval augmented generation, usually shortened to RAG, is often sold as the fix for made up answers. The model looks up documents first, then answers from them. In practice a RAG system can still give wrong answers, and the cause is rarely the language model itself.</p><p>Most failures start earlier in the pipeline. Understanding where they come from saves a lot of time, because tuning the prompt will not repair a retrieval problem.</p><h3>The right passage never gets retrieved</h3><p>If the answer is not in the retrieved text, the model has two options: admit it does not know, or fill the gap from its training data. Many models choose the second. So the first thing to check is whether the correct passage appears in the top results at all.</p><p>Common reasons it does not: the question uses different words than the document, the embedding model handles your domain terms poorly, or the search returns only a few results and the useful one ranks sixth. Combining keyword search with vector search often helps here, because exact terms such as product codes or error names are easy for keywords and hard for embeddings.</p><h3>Chunks cut the answer in half</h3><p>Documents are split into chunks before they are indexed. A fixed size split can separate a rule from its exception, or a table from its heading. The model then sees a fragment that looks complete and answers confidently from it.</p><p>Splitting along natural boundaries such as headings and paragraphs usually works better than counting characters. Keeping a small overlap between chunks, and storing the document title with each one, gives the model more context to work with.</p><h3>Old or conflicting documents</h3><p>A knowledge base that holds three versions of the same policy will return all three. The model has no way to know which one is current unless you tell it. Adding dates or version labels as metadata, and filtering out superseded files, removes a whole class of errors that look like model mistakes but are really data problems.</p><h3>Too much context can hurt</h3><p>It is tempting to retrieve twenty chunks and let the model sort it out. Long contexts dilute the relevant passage, and models tend to pay less attention to material in the middle. Retrieving fewer, better ranked chunks, perhaps with a reranking step, often improves accuracy and lowers cost at the same time.</p><h3>The prompt does not demand grounding</h3><p>Even with good retrieval, the instructions matter. A prompt that says “answer the question” invites the model to use whatever it knows. A prompt that says to answer only from the supplied passages, to quote the source, and to say so when the passages do not contain the answer gives a clearer rule to follow. Asking for citations also makes errors easier to spot, because a reader can check the quoted passage.</p><h3>Nobody measures it</h3><p>The most common problem is that the system is judged by a few demo questions. A small test set of real questions with known answers lets you measure two things separately: did retrieval find the right passage, and did the model use it correctly. If retrieval scores are low, work on chunking and search. If retrieval is fine and answers are still wrong, work on the prompt and the model.</p><h3>A short debugging order</h3><p>When an answer is wrong, check in this order. First, was the correct passage retrieved? Second, was it complete, or cut off by chunking? Third, was it outdated or contradicted by another document? Fourth, did the prompt tell the model to stay within the sources? Most bugs are found in the first two steps.</p><p>It also helps to log every request. Store the question, the retrieved chunks with their scores, the final prompt and the answer. When a user reports a wrong answer, you can see at once whether retrieval or generation failed, without guessing. Over a few weeks these logs also show which questions your documents cannot answer, which points to content that is missing rather than a bug.</p><p>Finally, decide what the system should do when it is unsure. A low retrieval score is a useful signal. Instead of answering anyway, the system can say that it could not find a reliable source and suggest where to look. Users tend to trust a tool more when it admits its limits than when it answers every question with the same confidence.</p><p>RAG reduces made up answers when each stage does its job. Treat it as a search system with a writer on the end, and test the search part first.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29efe02b7851" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/why-rag-systems-still-give-wrong-answers-and-where-to-look-first-29efe02b7851">Why RAG Systems Still Give Wrong Answers, and Where to Look First</a> was originally published in <a href="https://python.plainenglish.io">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>