<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Danil Vilkhovskiy</title>
    <description>The latest articles on DEV Community by Danil Vilkhovskiy (@vilkhovskiy).</description>
    <link>https://dev.to/vilkhovskiy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3108531%2Fd6672fc0-957d-4bb6-af05-fbcfbb7cd062.jpg</url>
      <title>DEV Community: Danil Vilkhovskiy</title>
      <link>https://dev.to/vilkhovskiy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vilkhovskiy"/>
    <language>en</language>
    <item>
      <title>Local Hybrid RAG Over 5,700 Docs: Why Dropping Directory Auto-Guessing Beat Chunk Context Tuning</title>
      <dc:creator>Danil Vilkhovskiy</dc:creator>
      <pubDate>Thu, 26 Nov 2026 10:22:58 +0000</pubDate>
      <link>https://dev.to/softenq/local-hybrid-rag-over-5700-docs-why-dropping-directory-auto-guessing-beat-chunk-context-tuning-36ph</link>
      <guid>https://dev.to/softenq/local-hybrid-rag-over-5700-docs-why-dropping-directory-auto-guessing-beat-chunk-context-tuning-36ph</guid>
      <description>&lt;p&gt;When building an internal RAG knowledge base for AI coding and operations agents (~&lt;strong&gt;5,700 documents&lt;/strong&gt; and &lt;strong&gt;~49,000 chunks&lt;/strong&gt; in Russian mixed with English ports, hosts, and service names), semantic-only vector search misses exact identifiers—while naive metadata rules silently kill recall before ranking even starts.&lt;/p&gt;

&lt;p&gt;We built a 100% self-hosted hybrid search stack (Qdrant dense + BM25 + &lt;code&gt;BGE-M3&lt;/code&gt; + &lt;code&gt;bge-reranker-v2-m3&lt;/code&gt; exposed over the open &lt;strong&gt;MCP&lt;/strong&gt; protocol) and benchmarked every change in an evaluation harness before rollout. &lt;em&gt;(Complete methodology, statistical tests, and charts: &lt;a href="https://www.softenq.com/cases/ai-knowledge-search/" rel="noopener noreferrer"&gt;Softenq Case Study&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Architecture: Local Hybrid Retrieval + MCP
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;qdrant_client&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;

&lt;span class="c1"&gt;# text: query after synonym expansion; query_vec: dense BGE-M3 vector&lt;/span&gt;
&lt;span class="n"&gt;candidates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;qdrant&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query_points&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;collection_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;COLLECTION&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;prefetch&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Prefetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;query_vec&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Prefetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Document&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"qdrant/bm25"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="s2"&gt;"stemmer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"snowball"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"language"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"russian"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="s2"&gt;"stopwords"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"russian"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="s2"&gt;"tokenizer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"word"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;using&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"bm25"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;FusionQuery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fusion&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Fusion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;RRF&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# bge-reranker-v2-m3 cross-encoder rescores the top 15; top 5 go to the agent&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero cloud search APIs:&lt;/strong&gt; Qdrant, &lt;code&gt;BGE-M3&lt;/code&gt; embeddings, and &lt;code&gt;bge-reranker-v2-m3&lt;/code&gt; run on local GPU servers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No semantic result cache:&lt;/strong&gt; In a technical KB where queries differ only by a port (&lt;code&gt;8080&lt;/code&gt; vs &lt;code&gt;8081&lt;/code&gt;), cosine similarity hits &lt;code&gt;0.965&lt;/code&gt;—above a &lt;code&gt;0.96&lt;/code&gt; cache threshold—returning the wrong config. Result caching stays disabled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rerank depth discipline:&lt;/strong&gt; Expanding candidates from &lt;code&gt;30/15&lt;/code&gt; to &lt;code&gt;100/60&lt;/code&gt; added zero Hit@5 gain (&lt;code&gt;22&lt;/code&gt; vs &lt;code&gt;23&lt;/code&gt; of &lt;code&gt;27&lt;/code&gt;) while quadrupling median harness latency (&lt;code&gt;487 ms&lt;/code&gt; → &lt;code&gt;2,063 ms&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What Actually Moved Retrieval Accuracy (p &amp;lt; 0.001)
&lt;/h2&gt;

&lt;p&gt;On &lt;strong&gt;76 held-out and chunk-context questions&lt;/strong&gt; collected after our first cleanups:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Former Search&lt;/th&gt;
&lt;th&gt;First Cleanups (Keyword Filter)&lt;/th&gt;
&lt;th&gt;Current Search (+ Qdrant BM25)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Hit@1&lt;/strong&gt; (right doc first)&lt;/td&gt;
&lt;td&gt;34 / 76&lt;/td&gt;
&lt;td&gt;42 / 76&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;49 / 76&lt;/strong&gt; (&lt;code&gt;p &amp;lt; 0.001&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Hit@5&lt;/strong&gt; (right doc in top 5)&lt;/td&gt;
&lt;td&gt;45 / 76&lt;/td&gt;
&lt;td&gt;55 / 76 (&lt;code&gt;p = 0.006&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;63 / 76&lt;/strong&gt; (&lt;code&gt;p = 0.039&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;MRR@5&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.50&lt;/td&gt;
&lt;td&gt;0.62&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.73&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;In top 30 candidates&lt;/td&gt;
&lt;td&gt;50 / 76&lt;/td&gt;
&lt;td&gt;60 / 76&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;70 / 76&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three engineering lessons stood out:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Automatic directory selection was the #1 bug:&lt;/strong&gt; Guessing a subdirectory from question keywords acted as a hard filter and caused &lt;strong&gt;7 of 9&lt;/strong&gt; top-five misses and every zero-result query. Now we search the entire KB unless the caller passes an explicit &lt;code&gt;path_prefix&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;BM25 scoring beats boolean keyword filters:&lt;/strong&gt; A hard keyword filter required &lt;em&gt;every&lt;/em&gt; query word to appear, returning nothing on long questions. Switching to Qdrant BM25 lifted Hit@5 on long/context questions (&lt;code&gt;10 wins, 2 losses&lt;/code&gt;, &lt;code&gt;p = 0.039&lt;/code&gt;; &lt;code&gt;6 wins, 0 losses&lt;/code&gt;, &lt;code&gt;p = 0.031&lt;/code&gt; on the 36 post-switch questions).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-encoder reranking fixes #1 precision:&lt;/strong&gt; Across 103 questions, &lt;code&gt;bge-reranker-v2-m3&lt;/code&gt; lifted Hit@1 from &lt;code&gt;51&lt;/code&gt; to &lt;code&gt;67&lt;/code&gt; (&lt;code&gt;p = 0.002&lt;/code&gt;) at &lt;code&gt;355 ms&lt;/code&gt; vs &lt;code&gt;21 ms&lt;/code&gt; in the harness—and &lt;strong&gt;every rollout goes through an automated A/B quality gate&lt;/strong&gt; against the live production copy.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Meanwhile, &lt;strong&gt;Contextual Retrieval chunk summaries (~49,000 chunks)&lt;/strong&gt; showed no statistically significant gain on an 82-question blind check, so we kept complexity low and left them out of production.&lt;/p&gt;




&lt;h2&gt;
  
  
  Production Performance &amp;amp; Why MCP Agents Beat Single-Call RAG (&lt;code&gt;95%&lt;/code&gt; vs &lt;code&gt;75%&lt;/code&gt;)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live agent queries (&lt;code&gt;57&lt;/code&gt; answered in KB):&lt;/strong&gt; &lt;strong&gt;&lt;code&gt;96%&lt;/code&gt;&lt;/strong&gt; Hit@5 (&lt;code&gt;55/57&lt;/code&gt;), &lt;strong&gt;&lt;code&gt;81%&lt;/code&gt;&lt;/strong&gt; Hit@1 (&lt;code&gt;46/57&lt;/code&gt;), MRR@5 &lt;strong&gt;&lt;code&gt;0.87&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Latency:&lt;/strong&gt; &lt;strong&gt;&lt;code&gt;288 ms&lt;/code&gt; median&lt;/strong&gt; (&lt;code&gt;408 ms&lt;/code&gt; p95) on single-node queries; &lt;code&gt;548 ms&lt;/code&gt; median in production logs (default &lt;code&gt;&amp;lt;= 5&lt;/code&gt; results, no directory filter).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MCP Agent vs One-Shot Chain (Qwen 3.8 27B on 177 blind-scored questions):&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Single-call top-5 RAG chain: &lt;strong&gt;&lt;code&gt;133 / 177&lt;/code&gt; (75%)&lt;/strong&gt; correct answers (&lt;code&gt;82%&lt;/code&gt; when gold doc was in top-5).&lt;/li&gt;
&lt;li&gt;Same model acting as an &lt;strong&gt;MCP agent&lt;/strong&gt; (calling search + reading full documents): &lt;strong&gt;&lt;code&gt;169 / 177&lt;/code&gt; (95%)&lt;/strong&gt; correct (&lt;code&gt;p &amp;lt; 0.001&lt;/code&gt;), locating the source doc in &lt;code&gt;164&lt;/code&gt; vs &lt;code&gt;155&lt;/code&gt; cases (&lt;code&gt;p = 0.035&lt;/code&gt;) with &lt;strong&gt;&lt;code&gt;98%&lt;/code&gt; (161/164)&lt;/strong&gt; accuracy once opened.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Engineered by &lt;a href="https://www.softenq.com/" rel="noopener noreferrer"&gt;Softenq&lt;/a&gt; — self-hosted enterprise AI, Go/Java/Python systems, and observability engineering. Full experimental tables and McNemar/bootstrap stats: &lt;a href="https://www.softenq.com/cases/ai-knowledge-search/" rel="noopener noreferrer"&gt;&lt;code&gt;https://www.softenq.com/cases/ai-knowledge-search/&lt;/code&gt;&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>qdrant</category>
      <category>mcp</category>
    </item>
    <item>
      <title>LLM Gateway on LiteLLM: 4 Failure Classes Your Health Probe Will Never Catch</title>
      <dc:creator>Danil Vilkhovskiy</dc:creator>
      <pubDate>Thu, 26 Nov 2026 10:22:43 +0000</pubDate>
      <link>https://dev.to/softenq/llm-gateway-on-litellm-4-failure-classes-your-health-probe-will-never-catch-1oip</link>
      <guid>https://dev.to/softenq/llm-gateway-on-litellm-4-failure-classes-your-health-probe-will-never-catch-1oip</guid>
      <description>&lt;p&gt;When multiple AI agents, developer assistants, and data pipelines depend on a single LiteLLM proxy in front of cloud providers and local GPU models, outages rarely look like HTTP 502s.&lt;/p&gt;

&lt;p&gt;In production, our gateway kept answering &lt;code&gt;/health&lt;/code&gt; with &lt;code&gt;200 OK&lt;/code&gt; while:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The router rejected &lt;strong&gt;39% of generation requests&lt;/strong&gt; over a 24-hour window (&lt;code&gt;92%&lt;/code&gt; in the worst half hour in gateway logs).&lt;/li&gt;
&lt;li&gt;A provider silently routed an existing model name to a newer version—no errors appeared, yet our downstream scorer pass rate dropped from &lt;strong&gt;10–11% to 5.9%&lt;/strong&gt;, then &lt;strong&gt;~3%&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Gateway cost accounting logged &lt;strong&gt;61% of actual official provider spend&lt;/strong&gt; because manual rates masked updated off-peak/peak pricing (making per-key budgets &lt;strong&gt;1.65× softer&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;Passing OpenAI-compatible &lt;code&gt;chat_template_kwargs: {"thinking": false}&lt;/code&gt; returned HTTP 200—while still burning &lt;strong&gt;146 reasoning tokens&lt;/strong&gt; on DeepSeek V4 and truncating short outputs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the diagnostic breakdown and the outcome-based checks we put in place. &lt;em&gt;(Full postmortem and reference table: &lt;a href="https://www.softenq.com/cases/llm-gateway-silent-failures/" rel="noopener noreferrer"&gt;Softenq Engineering Case Study&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Cooldowns &amp;amp; Daily Token Caps Hidden Behind Green Probes
&lt;/h2&gt;

&lt;p&gt;In LiteLLM, callers request a logical model group, and the router picks a deployment, retries on failure, and puts noisy deployments into cooldown.&lt;/p&gt;

&lt;p&gt;To prevent exhausted daily-quota models from spinning every minute, we had set &lt;code&gt;allowed_fails: 1&lt;/code&gt; and &lt;code&gt;cooldown_time: 3600&lt;/code&gt; on single-deployment groups without fallbacks. While LiteLLM's design normally avoids cooling down single-deployment groups, when &lt;code&gt;allowed_fails&lt;/code&gt; is explicitly configured (fixed upstream later in LiteLLM &lt;a href="https://github.com/BerriAI/litellm/pull/48644" rel="noopener noreferrer"&gt;PR #48644&lt;/a&gt; / LTS &lt;code&gt;1.108.1&lt;/code&gt; &lt;a href="https://github.com/BerriAI/litellm/pull/50136" rel="noopener noreferrer"&gt;PR #50136&lt;/a&gt;), one transient provider &lt;code&gt;500&lt;/code&gt; disabled the entire group for an hour with &lt;code&gt;"No deployments available for selected model"&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;At night, the daily token cap configured inside the gateway returned the &lt;strong&gt;exact same error string&lt;/strong&gt;, and our end-to-end probe stayed green because it hit a different model.&lt;/p&gt;

&lt;h3&gt;
  
  
  Outcome-Based Alert Rule (Prometheus + Grafana)
&lt;/h3&gt;

&lt;p&gt;Resource headroom alerts ("daily pool 90% full") do not measure whether callers succeed. Instead, alert on the &lt;strong&gt;failed-request share&lt;/strong&gt; across the gateway:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;llm-gateway-failure-share&lt;/span&gt;
  &lt;span class="na"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;C&lt;/span&gt;
  &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;refId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;A&lt;/span&gt;
    &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="c1"&gt;# Share of failed requests over 1h; suppresses denominator noise below ~1 failure per 5m
&lt;/span&gt;      &lt;span class="na"&gt;expr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="s"&gt;(sum(rate(litellm_proxy_failed_requests_metric_total[1h])) &amp;gt; 0.003)&lt;/span&gt;
        &lt;span class="s"&gt;/ clamp_min(sum(rate(litellm_proxy_total_requests_metric_total[1h])), 0.001)&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;refId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;C&lt;/span&gt;
    &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;threshold&lt;/span&gt;
      &lt;span class="na"&gt;expression&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;B&lt;/span&gt;
      &lt;span class="na"&gt;conditions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;evaluator&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s"&gt;type:&lt;/span&gt; &lt;span class="s"&gt;gt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;params:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;15m&lt;/span&gt;
  &lt;span class="na"&gt;noDataState&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;OK&lt;/span&gt;
  &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;severity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;warning&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We updated router settings (&lt;code&gt;allowed_fails&lt;/code&gt; raised, cooldown shortened to &lt;code&gt;10s&lt;/code&gt;, automatic retry on &lt;code&gt;429&lt;/code&gt;), separated quota enforcement to the limiter, and locked these invariants in pytest configuration tests so config generators cannot revert them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Measured impact:&lt;/strong&gt; Over the next 30 days (&lt;code&gt;5 Oct – 4 Nov 2026&lt;/code&gt;), upstream providers produced &lt;code&gt;3.9%&lt;/code&gt; &lt;code&gt;5xx&lt;/code&gt;/timeouts, yet only &lt;strong&gt;&lt;code&gt;0.34%&lt;/code&gt;&lt;/strong&gt; of consumer requests failed. Across &lt;code&gt;158&lt;/code&gt; of &lt;code&gt;163&lt;/code&gt; high-error hours (&lt;code&gt;&amp;gt;= 10%&lt;/code&gt; upstream errors), consumers saw &lt;strong&gt;zero rejections (97%)&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Silent Model Version Swaps Under an Unchanged Name
&lt;/h2&gt;

&lt;p&gt;Providers occasionally move an existing model identifier to a new release without raising errors. When a downstream pipeline filters incoming materials using LLM scores, a minor scale shift breaks fixed score thresholds completely.&lt;/p&gt;

&lt;p&gt;Paired rescoring of &lt;strong&gt;668 items&lt;/strong&gt; sampled evenly across pre-change score buckets showed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rank ordering stayed nearly identical (&lt;strong&gt;Spearman ρ &lt;code&gt;0.81–0.96&lt;/code&gt;&lt;/strong&gt; across five feeds).&lt;/li&gt;
&lt;li&gt;Absolute scores shifted downward by &lt;strong&gt;&lt;code&gt;0.8–1.6&lt;/code&gt; points&lt;/strong&gt;, collapsing pass rates from &lt;code&gt;10–11%&lt;/code&gt; to &lt;code&gt;~3%&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Single canary items miss subtle shifts (&lt;code&gt;9 → 8&lt;/code&gt; still passes a threshold of &lt;code&gt;7&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; Recalibrate thresholds via paired rescoring and monitor &lt;strong&gt;daily pass-share deviation against the 14-day median&lt;/strong&gt;, rather than trusting a single synthetic prompt.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Stale Spend Accounting &amp;amp; Hidden Health-Check Costs
&lt;/h2&gt;

&lt;p&gt;Explicit pricing fields in LiteLLM &lt;code&gt;model_list&lt;/code&gt; override the built-in cost map—and remain static when a provider introduces off-peak discounts or updates tiers. Because our config carried pre-change numbers, tracked gateway spend covered only &lt;strong&gt;&lt;code&gt;61%&lt;/code&gt;&lt;/strong&gt; of official pricing.&lt;/p&gt;

&lt;p&gt;Instead of relying on unsynced static tables or letting background health checks ping metered deployments (see &lt;a href="https://github.com/BerriAI/litellm/issues/49089" rel="noopener noreferrer"&gt;LiteLLM issue #49089&lt;/a&gt;), we:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Replaced static rates with a &lt;strong&gt;28-day traffic-weighted blend&lt;/strong&gt; matching official provider billing.&lt;/li&gt;
&lt;li&gt;Added a CI configuration test asserting every deployed price lies strictly inside &lt;code&gt;(off_peak, peak)&lt;/code&gt; official bounds and stays identical across aliases.&lt;/li&gt;
&lt;li&gt;Disabled background self-probes on daily-quota/metered routes.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  4. Perimeters (&lt;code&gt;private/*&lt;/code&gt;) &amp;amp; Ignored Model Flags
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fail-closed isolation:&lt;/strong&gt; Sensitive internal groups under &lt;code&gt;private/*&lt;/code&gt; must carry &lt;strong&gt;zero cloud fallbacks or aliases&lt;/strong&gt;, pointing exclusively to private/internal GPU addresses—enforced in configuration tests so restricted data never spills outward during local outages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify flags on live usage tokens:&lt;/strong&gt; Sending &lt;code&gt;chat_template_kwargs: {"thinking": false}&lt;/code&gt; (used by vLLM/SGLang) to DeepSeek V4 returned HTTP 200 while producing &lt;code&gt;146&lt;/code&gt; reasoning tokens; switching to the provider-native &lt;code&gt;thinking: {"type": "disabled"}&lt;/code&gt; cut live reasoning tokens to &lt;code&gt;0&lt;/code&gt; (&lt;code&gt;0–0.3%&lt;/code&gt; across disabling consumers in logs).&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Built and documented by &lt;a href="https://www.softenq.com/" rel="noopener noreferrer"&gt;Softenq&lt;/a&gt; — enterprise software engineering, self-hosted AI/RAG systems, and observability audits. Read the complete engineering case study with verification tables and code at &lt;a href="https://www.softenq.com/cases/llm-gateway-silent-failures/" rel="noopener noreferrer"&gt;&lt;code&gt;https://www.softenq.com/cases/llm-gateway-silent-failures/&lt;/code&gt;&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>llm</category>
      <category>observability</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
