<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Salma Ouardi — ML Engineer</title>
    <link>https://www.salmaouardi.com/blog/</link>
    <description>ML Engineer specializing in NLP &amp; LLMs. Building production AI systems at the intersection of language and intelligence.</description>
    <language>en</language>
    <atom:link href="https://www.salmaouardi.com/feed.xml" rel="self" type="application/rss+xml"/>
    <lastBuildDate>Wed, 01 Apr 2026 09:00:00 GMT</lastBuildDate>
    <item>
      <title>Advanced RAG: Lessons from a Production Legal AI System</title>
      <link>https://www.salmaouardi.com/blog/advanced-rag-production-lessons/</link>
      <guid isPermaLink="true">https://www.salmaouardi.com/blog/advanced-rag-production-lessons/</guid>
      <pubDate>Wed, 01 Apr 2026 09:00:00 GMT</pubDate>
      <dc:creator>Salma Ouardi</dc:creator>
      <description>What I learned optimizing a Legal RAG system for high-stakes document analysis — retrieval strategies, evaluation, and what benchmarks miss.</description>
      <category>RAG</category>
      <category>LLM</category>
      <category>Production</category>
      <content:encoded><![CDATA[<p>Most RAG demos fail in production for the same reason: they optimize for pretty answers, not reliable retrieval. In this article, I break down the practical decisions that made our legal assistant usable in real workflows.</p>
<h2 id="retrieval-quality-matters-more-than-prompt-tricks">Retrieval quality matters more than prompt tricks<a class="heading-anchor" aria-label="Link to this section" href="#retrieval-quality-matters-more-than-prompt-tricks">#</a></h2>
<p>We improved chunking strategy, metadata filtering, and query expansion before changing generation prompts. Answer quality increased because context quality improved first.</p>
<ul>
<li>Use chunking boundaries aligned with legal clause structure</li>
<li>Filter by document source and version before retrieval</li>
<li>Rerank top candidates instead of increasing top-k blindly</li>
</ul>
<h2 id="evaluation-has-to-look-like-real-usage">Evaluation has to look like real usage<a class="heading-anchor" aria-label="Link to this section" href="#evaluation-has-to-look-like-real-usage">#</a></h2>
<p>Offline benchmarks were useful, but they were not enough. We created scenario-based checks with realistic legal questions, citation validation, and failure analysis loops.</p>
<ul>
<li>Track citation correctness, not just answer fluency</li>
<li>Measure confidence gaps between easy and high-risk queries</li>
</ul>
<h2 id="reliability-is-a-systems-problem">Reliability is a systems problem<a class="heading-anchor" aria-label="Link to this section" href="#reliability-is-a-systems-problem">#</a></h2>
<p>Asynchronous pipelines, retries, logging, and traceability made a bigger difference than model swaps. Stable operations created user trust.</p>
<hr>
<blockquote>
<p>If you are building a RAG product, start with retrieval quality and evaluation design. Fancy generation comes later.</p>
</blockquote><hr/><p>Originally published at <a href="https://www.salmaouardi.com/blog/advanced-rag-production-lessons/">https://www.salmaouardi.com/blog/advanced-rag-production-lessons/</a>.</p>]]></content:encoded>
    </item>
  </channel>
</rss>
