<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="https://thakicloud.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://thakicloud.github.io/" rel="alternate" type="text/html" /><updated>2026-07-02T23:32:47+09:00</updated><id>https://thakicloud.github.io/feed.xml</id><title type="html">Thaki Cloud Tech Blog | ThakiCloud | 다키클라우드 기술 블로그</title><subtitle>Thaki Cloud (ThakiCloud, 다키클라우드, thaki cloud, THAKI CLOUD, ثاكي كلاود)는 AI/ML Engineering, LLMOps, DevOps 분야의 최신 기술과 실무 경험을 공유하는 전문 기술 블로그입니다. 머신러닝 모델 운영, 쿠버네티스, 클라우드 인프라, AI 엔지니어링 커리어, 인공지능 기술 블로그, 다키클라우드 개발 팀의 깊이 있는 인사이트를 제공합니다. مدونة تقنية متخصصة في هندسة الذكاء الاصطناعي والحوسبة السحابية.</subtitle><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;nil, &quot;bio&quot;=&gt;nil, &quot;location&quot;=&gt;&quot;Seoul, Korea&quot;, &quot;email&quot;=&gt;&quot;info@thakicloud.co.kr&quot;, &quot;uri&quot;=&gt;nil, &quot;home&quot;=&gt;nil, &quot;links&quot;=&gt;[{&quot;label&quot;=&gt;&quot;Website&quot;, &quot;icon&quot;=&gt;&quot;fas fa-fw fa-link&quot;, &quot;url&quot;=&gt;&quot;https://thakicloud.co.kr&quot;}, {&quot;label&quot;=&gt;&quot;GitHub&quot;, &quot;icon&quot;=&gt;&quot;fab fa-fw fa-github&quot;, &quot;url&quot;=&gt;&quot;https://github.com/thakicloud&quot;}]}</name><email>info@thakicloud.co.kr</email></author><entry xml:lang="ar"><title type="html">التوجيه نحو النموذج الفائز في كل مهمة: قياس حقيقي لخفض تكلفة أتمتة الوكلاء 44 مرة باستخدام النماذج مفتوحة الأوزان</title><link href="https://thakicloud.github.io/ar/agentops/open-weight-agent-cost-routing/" rel="alternate" type="text/html" title="التوجيه نحو النموذج الفائز في كل مهمة: قياس حقيقي لخفض تكلفة أتمتة الوكلاء 44 مرة باستخدام النماذج مفتوحة الأوزان" /><published>2026-07-02T00:00:00+09:00</published><updated>2026-07-02T00:00:00+09:00</updated><id>https://thakicloud.github.io/ar/agentops/open-weight-agent-cost-routing</id><content type="html" xml:base="https://thakicloud.github.io/ar/agentops/open-weight-agent-cost-routing/"><![CDATA[<p><img src="/assets/images/open-weight-agent-cost-routing-hero.png" alt="صورة مجردة لتدفق المهام عبر منشور ضوئي ينقسم إلى مسارات تكلفة متعددة" /></p>

<p>حين يفتح معظم الفرق فاتورة تشغيل وكلائهم، يقعون في الوهم ذاته: “وكلاؤنا يجرون استدلالاً معقداً، إذاً لا بد من استخدام أفضل النماذج في قمة الهرم.” غير أن فحص حركة البيانات الفعلية يكشف صورة مختلفة تماماً. الغالبية العظمى من الطلبات تتمحور حول تحويل اللغة الطبيعية إلى استدعاءات API، وتصنيف السجلات، وربط خطوط الأنابيب، وتلخيص النتائج، وهي مهام متكررة لا تستلزم استدلالاً على مستوى عالمي. ومع ذلك، حين تُعالَج كلها بنماذج حدود مميزة، فإن الفريق يدفع ثمن مواصفات فائضة عن الحاجة.</p>

<p>يوثق هذا المقال قياساً حقيقياً لرصد هذا الهدر ثم التخلص منه. أجرينا تجارب عملية لتحويل طلبات تشغيل حقيقية إلى استدعاءات أدوات باستخدام نموذج مفتوح الأوزان (Gemma 4)، وتحققنا من الجودة، ثم حسبنا إلى أي مدى تنخفض التكاليف عند توجيه كل مهمة إلى النموذج المناسب لها عبر Paxis CostRouter، مستخدمين رموزاً مميزة حقيقية وأسعاراً فعلية. الخلاصة مباشرة: انخفضت التكلفة على نفس عبء العمل بما يصل إلى 44 مرة مقارنة بنماذج الحدود المميزة.</p>

<h2 id="ما-هذا-النهج">ما هذا النهج</h2>

<p>الفكرة الجوهرية بسيطة. بدلاً من معالجة جميع مهام الوكيل بنموذج واحد، يُوجَّه كل نوع من المهام إلى درجة مختلفة من النماذج بحسب طبيعته. الاستدلال المعقد واتخاذ القرار يذهبان إلى نماذج الحدود المميزة، وتوليد الشيفرة يذهب إلى نماذج مفتوحة الأوزان متخصصة في البرمجة، واستدعاء الأدوات وتنفيذ خطوط الأنابيب يذهبان إلى نماذج مفتوحة الأوزان من الفئة العاملة، والاستخراج والتصنيف الضخم يذهبان إلى الفئة الاقتصادية الأرخص. إن أرسلت كل مهمة إلى النموذج الأنسب لها، حافظت على الجودة وخففت الفاتورة.</p>

<p>لكي ينجح هذا النهج، لا بد أن يصح أمران: أولاً، أن تكون النماذج مفتوحة الأوزان قادرة فعلاً على أداء الجزء الأكبر من مهام الوكيل. وثانياً، أن يتولى المنصة عملية التوجيه تلقائياً دون أن يضطر الفريق إلى اختيار النموذج يدوياً في كل مرة. يثبت ما يلي هذين الأمرين بالتجربة والتكوين الفعلي.</p>

<pre><code class="language-mermaid">flowchart TB
    A[طلب مهمة الوكيل] --&gt; B{تصنيف نوع المهمة}
    B --&gt;|استدلال واتخاذ قرار عالي المستوى| C[نماذج الحدود المميزة]
    B --&gt;|توليد الشيفرة| D[نماذج مفتوحة الأوزان - فئة البرمجة]
    B --&gt;|استدعاء أدوات وخطوط أنابيب| E[نماذج مفتوحة الأوزان - فئة الوكلاء&lt;br/&gt;Gemma 4]
    B --&gt;|استخراج وتصنيف ضخم| F[نماذج مفتوحة الأوزان - الفئة الاقتصادية]
    C --&gt; G[بوابة السياسة + سجل التدقيق]
    D --&gt; G
    E --&gt; G
    F --&gt; G
    G --&gt; H[إرجاع النتيجة + تسجيل التكلفة]
</code></pre>

<h2 id="التثبيت-والتكامل">التثبيت والتكامل</h2>

<p>بدأنا بالتحقق من قدرة النماذج مفتوحة الأوزان على أداء المهمة الجوهرية للوكيل، وهي تحويل الطلبات اللغوية الطبيعية إلى استدعاءات أدوات منظمة. كان الهدف التحقق من Gemma 4 بحجم 26 مليار معامل عبر واجهة برمجة تطبيقات مُدارة. صُممت التجربة باستخدام المكتبات القياسية فقط (urllib) دون أي تبعيات إضافية.</p>

<p>المهمة التي أسندناها إلى الوكيل هي مخطط أدوات لخط أنابيب عمليات سحابية. حددنا خمس أدوات: الاستعلام عن المقاييس، وإعادة تشغيل حاويات Pods، وتجميع التكاليف، وتوسيع عمليات النشر، وتدوير الأسرار، ثم طلبنا من الوكيل تحليل طلب لغوي طبيعي وإخراج JSON واحد يتضمن الأداة الصحيحة والمعاملات الإلزامية.</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">TOOL_SPEC</span> <span class="o">=</span> <span class="sh">"""</span><span class="s">You are an operations automation agent. Convert the user request into a single tool-call JSON.
Output only the JSON object, with no explanation or markdown fences.

Available tools and required parameters:
- query_metrics: {metric, window_days, threshold?, region?}
- restart_pods: {region, selector, only_failed(bool)}
- aggregate_cost: {group_by, month, service?}
- scale_deployment: {name, region, replicas}
- rotate_secret: {name, namespace}

Output schema: {</span><span class="sh">"</span><span class="s">tool</span><span class="sh">"</span><span class="s">: </span><span class="sh">"</span><span class="s">&lt;name&gt;</span><span class="sh">"</span><span class="s">, </span><span class="sh">"</span><span class="s">params</span><span class="sh">"</span><span class="s">: { ... }}</span><span class="sh">"""</span>

<span class="k">def</span> <span class="nf">call</span><span class="p">(</span><span class="n">prompt</span><span class="p">):</span>
    <span class="n">body</span> <span class="o">=</span> <span class="p">{</span>
        <span class="sh">"</span><span class="s">contents</span><span class="sh">"</span><span class="p">:</span> <span class="p">[{</span><span class="sh">"</span><span class="s">role</span><span class="sh">"</span><span class="p">:</span> <span class="sh">"</span><span class="s">user</span><span class="sh">"</span><span class="p">,</span>
                      <span class="sh">"</span><span class="s">parts</span><span class="sh">"</span><span class="p">:</span> <span class="p">[{</span><span class="sh">"</span><span class="s">text</span><span class="sh">"</span><span class="p">:</span> <span class="n">TOOL_SPEC</span> <span class="o">+</span> <span class="sh">"</span><span class="se">\n\n</span><span class="s">Request: </span><span class="sh">"</span> <span class="o">+</span> <span class="n">prompt</span><span class="p">}]}],</span>
        <span class="sh">"</span><span class="s">generationConfig</span><span class="sh">"</span><span class="p">:</span> <span class="p">{</span><span class="sh">"</span><span class="s">temperature</span><span class="sh">"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> <span class="sh">"</span><span class="s">maxOutputTokens</span><span class="sh">"</span><span class="p">:</span> <span class="mi">1024</span><span class="p">},</span>
    <span class="p">}</span>
    <span class="c1"># call gemma-4-26b-a4b-it via generateContent, capture latency, tokens, and output
</span></code></pre></div></div>

<p>اصطدمنا هنا بمشكلة عملية تستحق التنبيه. ينتج Gemma 4 رموزاً مميزة للتفكير قبل الإجابة النهائية، وحين يُحدد سقف الإخراج بـ 256 رمزاً تنقطع مرحلة التفكير وتأتي النتيجة الأخيرة فارغة. بمجرد رفع السقف إلى 1024 وتصفية الأجزاء التي تحمل علامة <code class="language-plaintext highlighter-rouge">thought</code> واستخراج الإجابة الفعلية فقط، عمل النموذج بصورة صحيحة. هذا خطأ شائع يغفل عنه كثيرون عند دمج النماذج مفتوحة الأوزان في خطوط الأنابيب، ولهذا آثرنا توثيقه بكود قياسي فعلي.</p>

<p>أما جانب المنصة فتتولاه كتالوج نماذج Paxis. تتيح Paxis إدارة النموذج المستخدم من أي مزود في ملف تعريفي واحد (<code class="language-plaintext highlighter-rouge">models.yaml</code>) يتضمن سعر الإدخال والإخراج لكل رمز مميز إلى جانب الدرجة، وهو الأساس الذي يقوم عليه التوجيه.</p>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># models.yaml: tier and actual cost per token are the basis for routing (USD / 1M tokens)</span>
<span class="pi">-</span> <span class="na">id</span><span class="pi">:</span> <span class="s">claude-opus-4-8</span>      <span class="c1"># premium</span>
  <span class="na">tier</span><span class="pi">:</span> <span class="s">premium</span>
  <span class="na">costInput</span><span class="pi">:</span> <span class="m">5.0</span>
  <span class="na">costOutput</span><span class="pi">:</span> <span class="m">25.0</span>
<span class="pi">-</span> <span class="na">id</span><span class="pi">:</span> <span class="s">claude-sonnet-5</span>      <span class="c1"># standard (default)</span>
  <span class="na">tier</span><span class="pi">:</span> <span class="s">standard</span>
  <span class="na">costInput</span><span class="pi">:</span> <span class="m">3.0</span>
  <span class="na">costOutput</span><span class="pi">:</span> <span class="m">15.0</span>
<span class="c1"># Add open-weight providers (Ollama, vLLM, etc.) with the same schema</span>
<span class="c1"># and CostRouter will automatically route tasks to the matching tier.</span>
</code></pre></div></div>

<p>حين تصل مهمة جديدة، يحدد CostRouter درجتها ويختار أرخص نموذج مؤهل من الكتالوج. بمجرد إضافة مزودي النماذج مفتوحة الأوزان بالمخطط ذاته، تتدفق مهام استدعاء الأدوات والمعالجة الضخمة تلقائياً إلى الفئة الاقتصادية الأرخص، دون أن يحتاج الفريق إلى اتخاذ أي قرار يدوي في كل مرة.</p>

<h2 id="نتائج-التجربة-الفعلية">نتائج التجربة الفعلية</h2>

<p>قدمنا ستة طلبات تشغيل حقيقية إلى Gemma 4 وقيّمنا النتائج مباشرة بمعيارين: هل الإخراج JSON صالح، وهل يتضمن الأداة الصحيحة مع المعاملات الإلزامية كاملة؟</p>

<table>
  <thead>
    <tr>
      <th>المقياس</th>
      <th>النتيجة</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>نسبة JSON الصالح</td>
      <td>6/6 (100%)</td>
    </tr>
    <tr>
      <td>مطابقة المخطط (الأداة + المعاملات الإلزامية)</td>
      <td>6/6 (100%)</td>
    </tr>
    <tr>
      <td>متوسط وقت الاستجابة</td>
      <td>15.3 ثانية (نقطة نهاية مجانية مشتركة، تشمل رموز التفكير)</td>
    </tr>
    <tr>
      <td>متوسط رموز الإدخال</td>
      <td>155</td>
    </tr>
    <tr>
      <td>متوسط رموز الإخراج</td>
      <td>33 (الإجابة النهائية)</td>
    </tr>
    <tr>
      <td>متوسط رموز التفكير</td>
      <td>514</td>
    </tr>
  </tbody>
</table>

<p>نجحت الحالات الست جميعها في تحديد الأداة الصحيحة واستكمال المعاملات الإلزامية كاملة. على سبيل المثال، للطلب “أظهر العقد التي تجاوزت فيها نسبة استخدام GPU 80% خلال الأيام السبعة الماضية” أنتج النموذج:</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="nl">"tool"</span><span class="p">:</span><span class="w"> </span><span class="s2">"query_metrics"</span><span class="p">,</span><span class="w"> </span><span class="nl">"params"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="nl">"metric"</span><span class="p">:</span><span class="w"> </span><span class="s2">"gpu_utilization"</span><span class="p">,</span><span class="w"> </span><span class="nl">"window_days"</span><span class="p">:</span><span class="w"> </span><span class="mi">7</span><span class="p">,</span><span class="w"> </span><span class="nl">"threshold"</span><span class="p">:</span><span class="w"> </span><span class="mi">80</span><span class="p">}}</span><span class="w">
</span></code></pre></div></div>

<p>كان <code class="language-plaintext highlighter-rouge">threshold</code> معاملاً اختيارياً في المخطط، لكن النموذج استخلص قيمة “80%” من الطلب ووضعها في موضعها الصحيح. وللطلب “زد نسخ نشر inference-api في منطقة ap-northeast إلى 6”، ربط <code class="language-plaintext highlighter-rouge">scale_deployment</code> بالاسم والمنطقة وعدد النسخ بدقة تامة. هذا قياس نظيف يثبت أن نماذج مفتوحة الأوزان قادرة فعلاً على أداء المهمة الجوهرية لأتمتة الوكلاء، وهي استدعاء الأدوات وتنفيذ خطوط الأنابيب.</p>

<p>متوسط 15.3 ثانية قُيس على نقطة نهاية مشتركة مجانية تشمل رموز التفكير. في بيئة خدمة ذاتية أو معالجة دفعية، ينخفض هذا الرقم بشكل ملحوظ. المهم هنا ليس الكمون المطلق بل الحقيقة الأساسية: الجودة لم تتراجع.</p>

<p>الآن نصل إلى التكلفة. انطلاقاً من ملف تعريف الرموز المميزة المقاسة، افترضنا أن كل مهمة تستهلك 1000 رمز إدخال و300 رمز إخراج وهو سيناريو واقعي لجولة واحدة تشمل موجه النظام ومخطط الأدوات والسياق، مع أسطول وكلاء يعالج 10000 مهمة يومياً على مدى 30 يوماً. استخدمنا أسعار نماذج الحدود من <code class="language-plaintext highlighter-rouge">models.yaml</code> الفعلي في Paxis، وأسعاراً تقديرية تمثيلية للاستدلال المُدار بالنماذج مفتوحة الأوزان في منتصف عام 2026.</p>

<p><img src="/assets/images/open-weight-agent-cost-routing-results.png" alt="مخطط مقارنة تكلفة API الشهرية حسب الفئة" /></p>

<table>
  <thead>
    <tr>
      <th>الفئة</th>
      <th>التكلفة لكل مهمة</th>
      <th>التكلفة الشهرية (10 آلاف/يوم - 30 يوم)</th>
      <th>المقارنة بالمميزة</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>حدود مميزة</td>
      <td>$0.0125</td>
      <td>$3,750</td>
      <td>المرجع</td>
    </tr>
    <tr>
      <td>حدود قياسية</td>
      <td>$0.0075</td>
      <td>$2,250</td>
      <td>أرخص 1.7 مرة</td>
    </tr>
    <tr>
      <td>حدود اقتصادية</td>
      <td>$0.0020</td>
      <td>$600</td>
      <td>أرخص 6.2 مرة</td>
    </tr>
    <tr>
      <td>نماذج مفتوحة الأوزان مُدارة (مستوى Gemma)</td>
      <td>$0.000285</td>
      <td>$86</td>
      <td>أرخص 43.9 مرة</td>
    </tr>
    <tr>
      <td>نماذج مفتوحة الأوزان اقتصادية</td>
      <td>$0.00007</td>
      <td>$21</td>
      <td>أرخص 178.6 مرة</td>
    </tr>
  </tbody>
</table>

<p>نفس عبء العمل يكلف $3,750 شهرياً مع النماذج المميزة، مقابل $86 شهرياً مع نماذج مفتوحة الأوزان من مستوى Gemma، أي فارق يبلغ نحو 44 مرة. وكما أثبتت التجربة، بلغت جودة هذه الفئة مفتوحة الأوزان في مهام استدعاء الأدوات 100%. بمعنى آخر، هذا التوفير لم يأتِ على حساب الجودة بل من إزالة المواصفات الفائضة عن الحاجة. قد تتفاوت أسعار النماذج مفتوحة الأوزان بحسب المزود وما إذا كانت ذاتية الاستضافة أم مُدارة، لذلك أشرنا إليها صراحةً بوصفها تقديرية، إلا أن الاتجاه الجوهري، أي وفورات تغير رتبة كاملة، يبقى راسخاً.</p>

<h2 id="الدلالات-التطبيقية-لمنتجات-thakicloud">الدلالات التطبيقية لمنتجات ThakiCloud</h2>

<p>يتقاطع هذا النمط تقاطعاً دقيقاً مع تصميم Paxis، السحابة الأصيلة للوكلاء من ThakiCloud. تتعامل Paxis مع المهارات والأدوات والسياسات وسجلات التدقيق بوصفها موارد أولى، تماماً كما تتعامل السحابة التقليدية مع الخوادم والشبكات. يعمل CostRouter فوق هذه البنية بوصفه الطبقة التي تختار النموذج الملائم لكل مهمة.</p>

<ul>
  <li><strong>التوجيه حسب المهمة وظيفة أساسية.</strong> يمثل <code class="language-plaintext highlighter-rouge">models.yaml</code> مصدر الحقيقة الوحيد لتحديد المزود والنموذج. بمجرد تسجيل مزودي النماذج مفتوحة الأوزان بالمخطط ذاته، تتدفق مهام استدعاء الأدوات والمعالجة الضخمة تلقائياً إلى الفئة الأرخص. يبقى النموذج القياسي هو الافتراضي، ولا يُستدعى المميز إلا باختيار صريح، مما يمنع التوجيه المفرط من الوقوع بالخطأ.</li>
  <li><strong>العزل والحوكمة مدمجان.</strong> بصرف النظر عن الفئة الموجه إليها، تمر النتائج جميعها عبر بوابة السياسة وسجل التدقيق. استخدام نموذج أرخص لا يعني إرخاء الرقابة. بل على العكس، يُسجَّل النموذج والرموز المميزة والتكلفة لكل مهمة، مما يتيح تحديد أي المهام تستنزف فئة مكلفة دون مبرر وإعادة توجيهها لاحقاً.</li>
  <li><strong>التوافق مع متطلبات الاستضافة الذاتية والسيادة الرقمية.</strong> يمكن تشغيل النماذج مفتوحة الأوزان على GPU داخلي، مما يتيح للعملاء الذين لا يمكنهم إخراج البيانات خارجياً تحقيق التوفير والتحكم في آن واحد. تدير منصة ai-platform في ThakiCloud هذه الفئة مفتوحة المصدر بصورة متعددة المستأجرين عبر جدولة GPU المبنية على Kueue وخدمة vLLM، مما يعني أن الكفاءة البنية التحتية لـ ai-platform تدعم كفاءة التوجيه الاقتصادي في Paxis.</li>
</ul>

<p>خلاصة القول، الرهان الحقيقي ليس “استخدم نماذج أرخص”، بل “استخدم النموذج الفائز في كل مهمة.” معظم مهام الوكيل تندرج في استدعاء الأدوات وتنفيذ خطوط الأنابيب، وهي في معظمها لا تتجاوز طاقة النماذج مفتوحة الأوزان.</p>

<h2 id="القيود-والحجج-المضادة">القيود والحجج المضادة</h2>

<p>لهذا النهج حدود واضحة لا يمكن إغفالها.</p>

<p>في المهام التي تستلزم استدلالاً بالغ التعقيد أو معرفة موسوعية واسعة، لا تزال النماذج مفتوحة الأوزان تقصر عن نماذج الحدود. لذلك يجب أن يكون التوجيه “إلى النماذج مفتوحة الأوزان حيث تتفوق” لا “إلى النماذج مفتوحة الأوزان في كل مكان.” القرارات الصعبة تبقى حكراً على الفئة المميزة. إذا أسأ المرء تصميم التوجيه وأرسل مهاماً صعبة إلى فئات رخيصة، فستعود التكاليف محمولةً بأخطاء جودة لا بوفورات.</p>

<p>يصبح تصنيف أنواع المهام بحد ذاته نقطة فشل محتملة. أي خطأ في التصنيف يعني خطأً في التوجيه. لهذا لا بد من مراقبة مستمرة لنتائج التصنيف والجودة الفعلية، مع حلقة مراجعة دورية لإعادة توجيه أنواع المهام التي تتراكم فيها الأخطاء من الفئات الرخيصة إلى مستويات أعلى.</p>

<p>أسعار النماذج مفتوحة الأوزان في هذا المقال تقديرية. تتغير الأرقام المطلقة بحسب ما إذا كانت عبر API مُدار أم استضافة ذاتية، وبحسب المزود. بيد أن أسعار نماذج الحدود المستخدمة هنا حقيقية، والجودة المقاسة فعلية، مما يجعل استنتاج “الوفورات بمقدار رتبة كاملة” صامداً بصرف النظر. ننصح بإعادة هذا الحساب بأسعار بيئتك الفعلية.</p>

<p>أخيراً، الكمون. خمس عشرة ثانية على نقطة نهاية مشتركة مجانية تُعدّ ثقيلة لواجهات مستخدم حوارية آنية. أما خطوط الأنابيب الدفعية والأتمتة في الخلفية فلا تعاني من هذا الأمر. لكن إن كانت الجلسة تنتظر المستخدم، فلا بد من خدمة ذاتية تتحكم في الكمون، أو توجيه تلك المرحلة تحديداً إلى فئة أسرع.</p>

<h2 id="المصادر">المصادر</h2>

<ul>
  <li>كود التجربة وسجلات النتائج: تجربة Gemma 4 لاستدعاء الأدوات (6/6 نجاح) موثقة في سجلات قياسية حقيقية ضمن <code class="language-plaintext highlighter-rouge">outputs/blog-impl/open-weight-agent-cost-routing/</code>.</li>
  <li>أسعار نماذج الحدود: Paxis <code class="language-plaintext highlighter-rouge">models.yaml</code> (costInput/costOutput، USD لكل مليون رمز مميز).</li>
  <li>أسعار النماذج مفتوحة الأوزان: تقديرات تمثيلية للاستدلال المُدار في منتصف عام 2026 [تقديري].</li>
</ul>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;nil, &quot;bio&quot;=&gt;nil, &quot;location&quot;=&gt;&quot;Seoul, Korea&quot;, &quot;email&quot;=&gt;&quot;info@thakicloud.co.kr&quot;, &quot;uri&quot;=&gt;nil, &quot;home&quot;=&gt;nil, &quot;links&quot;=&gt;[{&quot;label&quot;=&gt;&quot;Website&quot;, &quot;icon&quot;=&gt;&quot;fas fa-fw fa-link&quot;, &quot;url&quot;=&gt;&quot;https://thakicloud.co.kr&quot;}, {&quot;label&quot;=&gt;&quot;GitHub&quot;, &quot;icon&quot;=&gt;&quot;fab fa-fw fa-github&quot;, &quot;url&quot;=&gt;&quot;https://github.com/thakicloud&quot;}]}</name><email>info@thakicloud.co.kr</email></author><category term="agentops" /><category term="open-weight" /><category term="cost-optimization" /><category term="model-routing" /><category term="agent-automation" /><category term="gemma4" /><category term="tool-calling" /><summary type="html"><![CDATA[معظم أعباء عمل أتمتة الوكلاء لا تتطلب استدلالاً عالياً بقدر ما تتطلب استدعاء أدوات وتنفيذ خطوط أنابيب. نجحنا في تحويل طلبات تشغيل حقيقية إلى استدعاءات أدوات باستخدام Gemma 4 بنسبة نجاح 6/6، ثم حسبنا التكلفة الفعلية عند توجيه كل مهمة إلى نموذج مفتوح الأوزان عبر Paxis CostRouter، بالرموز المميزة الحقيقية والأسعار الفعلية.]]></summary></entry><entry xml:lang="ar"><title type="html">Qwen3.6-27B بصيغة NVFP4: اقتصاد الخدمة على GPU واحدة من Blackwell</title><link href="https://thakicloud.github.io/ar/llmops/qwen3-6-27b-nvfp4-vllm-blackwell/" rel="alternate" type="text/html" title="Qwen3.6-27B بصيغة NVFP4: اقتصاد الخدمة على GPU واحدة من Blackwell" /><published>2026-07-02T00:00:00+09:00</published><updated>2026-07-02T00:00:00+09:00</updated><id>https://thakicloud.github.io/ar/llmops/qwen3-6-27b-nvfp4-vllm-blackwell</id><content type="html" xml:base="https://thakicloud.github.io/ar/llmops/qwen3-6-27b-nvfp4-vllm-blackwell/"><![CDATA[<h2 id="نظرة-عامة">نظرة عامة</h2>

<p>إذا أمكنك خدمة نموذج من فئة 27B على GPU واحدة وبدقة شبه خالية من الخسارة، يتغير اقتصاد الاستدلال في البيئات المحلية. تعيد نقطة التحقق nvidia/Qwen3.6-27B-NVFP4 تكميم Qwen3.6-27B إلى نوع بيانات NVFP4 ليعمل على vLLM حديث دون أي إعداد إضافي. هذه هي خلفية إعلان مشروع vLLM أن نقطة التحقق هذه جاهزة للاستدلال على وحدات Blackwell.</p>

<p>الجوهر ليس مجرد “التخفيض إلى 4 بت” بل <strong>ما الذي خُفّض وما الذي بقي</strong>. يشرّح هذا المقال تصميم الدقة المختلطة في إعادة تكميم NVFP4، ويعرض كيفية خدمته فعليًا عبر vLLM، ثم يستعرض ماذا يعني ذلك لبنية تكلفة خدمة GPU متعددة المستأجرين في ThakiCloud ai-platform. وحيثما يلزم القياس، نُشير إليه بصدق.</p>

<h2 id="ما-هذا">ما هذا</h2>

<p>NVFP4 صيغة عائمة بأربع بتات تخفض عدد البتات لكل معامِل من 16 إلى 4، فتقلّص متطلبات القرص وذاكرة GPU بنحو 2.5 مرة. لكن التصميم الفعلي لـ nvidia/Qwen3.6-27B-NVFP4 لا يسحق كل شيء إلى 4 بت. فإعادة تكميم NVIDIA ModelOpt <strong>تخفض طبقات MLP الخطية فقط إلى NVFP4 (W4A16)، مع إبقاء طبقات الانتباه الخطية وذاكرة KV بصيغة FP8.</strong> ونتيجة لذلك تتّسع نحو 22GB من الأوزان على GPU واحدة من Blackwell. وتُبلّغ NVIDIA بأن هذا التكوين شبه خالٍ من الخسارة في الدقة مقارنةً بخط أساس FP8.</p>

<p>لهذا الاختيار المختلط سبب. فطبقات MLP تحمل الحصة الطاغية من المعامِلات، فوفر الذاكرة فيها كبير وتتحمّل التخفيض إلى 4 بت نسبيًّا. أما الانتباه وذاكرة KV فحساسان للجودة في السياقات الطويلة، فيبقيان بصيغة FP8 حفاظًا على الدقة. المبدأ: “خفّض الجزء الأثقل بأشد قدر، وأبقِ الجزء الأكثر حساسية بتحفّظ”.</p>

<pre><code class="language-mermaid">flowchart TB
    A[أوزان Qwen3.6-27B الأصلية FP16] --&gt; B[إعادة تكميم NVIDIA ModelOpt]
    B --&gt; C[طبقات MLP الخطية&lt;br/&gt;NVFP4 W4A16]
    B --&gt; D[طبقات الانتباه الخطية&lt;br/&gt;تبقى FP8]
    B --&gt; E[ذاكرة KV&lt;br/&gt;تبقى FP8]
    C --&gt; F[نحو 22GB من الأوزان]
    D --&gt; F
    E --&gt; F
    F --&gt; G[تُحمَّل على GPU واحدة من Blackwell]
    G --&gt; H[vLLM يكتشف تلقائيًا&lt;br/&gt;quantization modelopt]
    H --&gt; I[نقطة استدلال متوافقة مع OpenAI]
</code></pre>

<p>مقارنةً بتكميم موحّد إلى 4 بت (مثل W4 عبر كل الطبقات)، يلتقط هذا النهج معظم وفر الذاكرة مع الدفاع عن الجودة بإبقاء الطبقات الحساسة بصيغة FP8. وضبط مقايضة الوفر مقابل الدقة لكل طبقة هو الميزة الفارقة لإعادة تكميم NVFP4.</p>

<h2 id="التثبيت-والخدمة">التثبيت والخدمة</h2>

<p>يكتشف vLLM تكميم ModelOpt تلقائيًّا من نقطة التحقق، فلا حاجة صارمة لتمرير راية تكميم. لكنك تحتاج vLLM حديثًا يدعم NVFP4/W4A16، وتوصي NVIDIA بإصدار nightly أو بناء من المصدر يتضمن دعم ModelOpt. شغّل صورة nightly عبر Docker وقدّم الخدمة كالتالي.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># vLLM حديث بدعم NVFP4/ModelOpt (صورة nightly)</span>
docker run <span class="nt">--gpus</span> all <span class="nt">-p</span> 8000:8000 <span class="se">\</span>
  vllm/vllm-openai:nightly <span class="se">\</span>
  vllm serve nvidia/Qwen3.6-27B-NVFP4 <span class="se">\</span>
    <span class="nt">--port</span> 8000 <span class="se">\</span>
    <span class="nt">--quantization</span> modelopt <span class="se">\</span>
    <span class="nt">--max-model-len</span> 262144 <span class="se">\</span>
    <span class="nt">--reasoning-parser</span> qwen3
</code></pre></div></div>

<p>تستخدم <code class="language-plaintext highlighter-rouge">--max-model-len 262144</code> السياق الطويل لعائلة Qwen3.6 كما هو، وتتولى <code class="language-plaintext highlighter-rouge">--reasoning-parser qwen3</code> تحليل رموز الاستدلال. والنقطة متوافقة مع OpenAI، فتتصل بها العملاء القائمة دون تغيير.</p>

<h2 id="نتائج-التجربة">نتائج التجربة</h2>

<p>بصراحة: تفترض نقطة التحقق هذه GPU من فئة Blackwell، والبيئة التي كُتب فيها هذا المقال لا تملك هذا العتاد، لذا <strong>لم نتمكن من إعادة إنتاجها محليًّا.</strong> ومن ثم فالأرقام أدناه ليست قياساتنا بل أرقام أبلغت بها مصادر عامة، مقتبسة كما هي مع الإسناد.</p>

<ul>
  <li>تُبلّغ NVIDIA بأن تكوين NVFP4 المُعاد تكميمه <strong>شبه خالٍ من الخسارة</strong> في الدقة مقارنةً بخط أساس FP8 (بحسب بطاقة النموذج).</li>
  <li>حجم الأوزان نحو <strong>22GB</strong>، يتّسع على GPU واحدة من Blackwell (بحسب بطاقة النموذج).</li>
  <li>يُبلّغ أحد المعايير الخارجية (loFT LLC) بنحو <strong>190 tok/s من إنتاجية التوليد</strong> بتكوين NVFP4+MTP على RTX PRO 6000 Blackwell Max-Q مزدوجة. وهذا قياس خارجي بدرجة [تقديري]، لا قيمة بيئتنا.</li>
</ul>

<p>ما أمكننا التحقق منه هو حقائق مسار الخدمة. فكون vLLM يكتشف تكميم ModelOpt تلقائيًّا، وأن التكوين مختلط الدقة (MLP بصيغة NVFP4 والانتباه وKV بصيغة FP8)، وأن نحو 22GB من الأوزان تتّسع على GPU واحدة من Blackwell، كلها مؤكدة في بطاقة النموذج العامة ووصفة vLLM. أما الإنتاجية والكمون الفعليان فيبقيان مسألة تُقاس حين يتوفر العتاد.</p>

<h2 id="الأثر-على-منتجات-thakicloud">الأثر على منتجات ThakiCloud</h2>

<p>ما يجعل نقطة التحقق هذه مثيرة للاهتمام ليس أرقام المعايير نفسها بل <strong>تحول اقتصاد الخدمة</strong>. تُخدِّم ThakiCloud ai-platform النماذج عبر بيئات عملاء متنوعة على K8s وKueue، وGPU دومًا أغلى مورد. فإذا أمكن لنموذج من فئة 27B أن يتّسع على GPU واحدة، وبشكل شبه خالٍ من الخسارة، فأنت تخفض إشغال GPU لكل مستأجر وتستطيع استضافة مزيد من النماذج أو مزيد من المستأجرين على العتاد نفسه.</p>

<p>من منظور تعدد المستأجرين، يتضاعف هذا الوفر. فحين ينزل نموذج من GPU إلى واحدة، تكاد فتحات الخدمة المتزامنة في العنقود تتضاعف. وضمن تخصيص GPU المستند إلى Kueue، يُترجم ذلك مباشرةً إلى طوابير انتظار أقصر وتقاسم عادل أسهل بين المستأجرين. ويهم ذلك خاصةً العملاء ذوي المتطلبات المحلية والسيادية القوية، لأن عدد وحدات GPU الواجب شراؤها يقل، فينخفض حاجز الاستثمار الأولي وتكلفة التشغيل.</p>

<p>كما يتوافق تصميم الدقة المختلطة مع فلسفتنا التشغيلية. فبدل خفض الدقة عشوائيًّا، يتماشى نهج إبقاء الأجزاء الحساسة للجودة وخفض الأجزاء الثقيلة فقط بقوة مع هدف “كفاءة التكلفة والجودة معًا”. ولهذا، عند تبني نقطة تحقق مكمَّمة جديدة على ai-platform، نراجع لا درجة المعيار فحسب بل أي طبقات عُوملت بأي دقة. وإعادة تكميم NVFP4 حالة مرجعية جيدة لتلك المراجعة، وحالما نؤمّن إنتاجية مقاسة نخطط لمقال متابعة عن ملف تكلفتها وجودتها في مكدس الخدمة لدينا.</p>

<h2 id="الحدود-والاعتراضات">الحدود والاعتراضات</h2>

<p>أولًا، الاعتماد على العتاد صارخ. فمنفعة NVFP4 تبلغ ذروتها على وحدات GPU من جيل Blackwell، ولا ينبغي للأجيال الأسبق توقع الكفاءة نفسها. وجاذبية الخدمة على GPU واحدة لا تصمد إلا على فرض تأمين Blackwell. وفي بيئة يكون فيها توريد GPU نفسه هو عنق الزجاجة، لا تتحول “GPU واحدة تكفي” فورًا إلى وفر في التكلفة.</p>

<p>ثانيًا، “شبه خالٍ من الخسارة” حكاية عن متوسطات المعايير. ففي مجالات محددة أو سياقات طويلة أو مهام حساسة للدقة كالأرقام والشيفرة، قد يظهر انخفاض جودة طفيف مقابل خط أساس FP8. وينبغي تأكيد قرار تبني NVFP4 بتقييم على عبء العمل الفعلي الذي ستخدمه، لا بأرقام بطاقة النموذج الموجزة.</p>

<p>ثالثًا، رقم الإنتاجية في هذا المقال ليس قياسنا. فالمعايير الخارجية تعتمد بشدة على تكوين العتاد (RTX PRO 6000 مزدوجة، واستخدام MTP من عدمه) وعلى حجم الدفعة وطول السياق، لذا تبقى قيمة عنقودنا الفعلية غير محددة حتى نقيسها مباشرةً. وتبلغ خلاصة هذا المقال فقط “الخدمة على GPU واحدة بصيغة NVFP4 تملك إمكان تحويل اقتصاد الخدمة”؛ أما “كم tok/s في بيئتنا” فمسألة تُقال بعد تحقق منفصل.</p>

<h2 id="المصادر">المصادر</h2>

<ul>
  <li>nvidia/Qwen3.6-27B-NVFP4 بطاقة النموذج، Hugging Face (<a href="https://huggingface.co/nvidia/Qwen3.6-27B-NVFP4">https://huggingface.co/nvidia/Qwen3.6-27B-NVFP4</a>)</li>
  <li>Qwen/Qwen3.6-27B، vLLM Recipes (<a href="https://recipes.vllm.ai/Qwen/Qwen3.6-27B">https://recipes.vllm.ai/Qwen/Qwen3.6-27B</a>)</li>
  <li>Measuring Qwen3.6-27B NVFP4+MTP on vLLM، loFT LLC (<a href="https://loftllc.dev/en/docs/tech/llm-research/qwen3-6-27b-nvfp4-mtp-vllm-benchmark/">https://loftllc.dev/en/docs/tech/llm-research/qwen3-6-27b-nvfp4-mtp-vllm-benchmark/</a>)</li>
</ul>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;nil, &quot;bio&quot;=&gt;nil, &quot;location&quot;=&gt;&quot;Seoul, Korea&quot;, &quot;email&quot;=&gt;&quot;info@thakicloud.co.kr&quot;, &quot;uri&quot;=&gt;nil, &quot;home&quot;=&gt;nil, &quot;links&quot;=&gt;[{&quot;label&quot;=&gt;&quot;Website&quot;, &quot;icon&quot;=&gt;&quot;fas fa-fw fa-link&quot;, &quot;url&quot;=&gt;&quot;https://thakicloud.co.kr&quot;}, {&quot;label&quot;=&gt;&quot;GitHub&quot;, &quot;icon&quot;=&gt;&quot;fab fa-fw fa-github&quot;, &quot;url&quot;=&gt;&quot;https://github.com/thakicloud&quot;}]}</name><email>info@thakicloud.co.kr</email></author><category term="llmops" /><category term="vllm" /><category term="nvfp4" /><category term="quantization" /><category term="blackwell" /><category term="model-serving" /><summary type="html"><![CDATA[أعادت NVIDIA تكميم Qwen3.6-27B إلى NVFP4 ليُخدَم على GPU واحدة من Blackwell عبر vLLM مباشرةً. نفكّك كيف تُوائم الدقة المختلطة (MLP بصيغة NVFP4 والانتباه وذاكرة KV بصيغة FP8) نموذجًا بحجم 27B ضمن نحو 22GB، وماذا يعني ذلك لاقتصاد خدمة GPU متعددة المستأجرين في ThakiCloud ai-platform.]]></summary></entry><entry xml:lang="ar"><title type="html">الذاكرة الإجرائية لدى الوكيل: ما وراء استرجاع المطالبات</title><link href="https://thakicloud.github.io/ar/research/agent-procedural-memory-beyond-retrieval/" rel="alternate" type="text/html" title="الذاكرة الإجرائية لدى الوكيل: ما وراء استرجاع المطالبات" /><published>2026-07-02T00:00:00+09:00</published><updated>2026-07-02T00:00:00+09:00</updated><id>https://thakicloud.github.io/ar/research/agent-procedural-memory-beyond-retrieval</id><content type="html" xml:base="https://thakicloud.github.io/ar/research/agent-procedural-memory-beyond-retrieval/"><![CDATA[<h2 id="نظرة-عامة">نظرة عامة</h2>

<p>من يُشغّل عملاء LLM لفترات طويلة يصطدم بالعقبة نفسها مراراً. يعيد الوكيل الاستدلال من الصفر في كل مرة، ويتلمس طريقه من جديد عبر إجراء سبق أن حلّه في الأسبوع الماضي. الحل الشائع هو دفع المهارات المستخدمة بكثرة كاملةً داخل المطالبة. غير أن هذا الأسلوب هشّ لسببين. أولاً، كلما زاد عدد المهارات ازداد استهلاك نافذة السياق، فتقلّ المساحة المتبقية للمهمة نفسها. ثانياً، تنكسر قوالب المطالبات بسهولة عند أي تغيّر طفيف في الظرف.</p>

<p>تعيد أبحاث ذاكرة الوكلاء الحديثة النظر في هذه المشكلة من زاوية <strong>الذاكرة الإجرائية (procedural memory)</strong>. فكما تحمل الذاكرة الإجرائية عند الإنسان حركات ماهرة تُنفَّذ دون وعي، مثل ركوب الدراجة، تختزل الذاكرة الإجرائية لدى الوكيل إجراءات تنفيذ المهام المتكررة في صورة قابلة لإعادة الاستخدام. جوهر هذا التوجه هو نقل المعرفة الإجرائية إلى <strong>ما وراء استرجاع المطالبات</strong>، أي إلى بنية منفصلة للتخزين والاسترجاع والتحديث، بل والانتقال إلى سياسات عصبية داخل بارامترات النموذج نفسه.</p>

<p>تستعرض هذه المقالة خريطة هذا التحول بالاعتماد على أبحاث موثّقة، وتُختتم بربط هذا التوجه البحثي بأسلوب Paxis، السحابة الأصيلة للوكلاء (Agent-Native Cloud) التابعة لـThakiCloud، التي تتعامل مع المهارات بوصفها موارد من الدرجة الأولى وتُجسّد بذلك هذا التوجه البحثي عملياً.</p>

<h2 id="ما-هي-الذاكرة-الإجرائية">ما هي الذاكرة الإجرائية</h2>

<p>من منظور معرفي، تُقسَّم الذاكرة عادة إلى ثلاثة أنواع: الذاكرة الدلالية (semantic) التي تحفظ الحقائق، والذاكرة العرضية (episodic) التي تحفظ الأحداث، والذاكرة الإجرائية (procedural) التي تحفظ الطرق. وفي أدبيات الوكلاء، تتولى الذاكرة الإجرائية مسؤولية الإجابة عن سؤال “كيف يُنفَّذ الأمر”، إذ تُجرّد تسلسلات الحركة المعقّدة إلى أنماط قابلة لإعادة الاستخدام، بما يتيح التنفيذ دون تخطيط من الصفر في كل مرة.</p>

<p>المشكلة أن هذه المعرفة الإجرائية توجد حالياً، في معظم الوكلاء، في واحد من ثلاثة أشكال: إما مكتوبة يدوياً، أو محشورة في قوالب مطالبات هشّة، أو متشابكة ضمنياً في بارامترات النموذج بتكلفة تحديث باهظة. وما تستهدفه الأبحاث هو رفع هذه المعرفة إلى مرتبة <strong>كائن من الدرجة الأولى قابل للتعلّم والتحديث</strong>.</p>

<pre><code class="language-mermaid">flowchart TB
    A[مسارات التنفيذ السابقة] --&gt; B[استخلاص الإجراء&lt;br/&gt;Build]
    B --&gt; C{شكل التخزين}
    C --&gt; D[غير بارامتري&lt;br/&gt;نص برمجي]
    C --&gt; E[بارامتري&lt;br/&gt;سياسة عصبية]
    D --&gt; F[الاسترجاع والاختيار&lt;br/&gt;Retrieval]
    E --&gt; F
    F --&gt; G[تنفيذ المهمة]
    G --&gt; H[التحديث وفق التغذية الراجعة&lt;br/&gt;إضافة وتعديل وحذف Update]
    H --&gt; B
</code></pre>

<h2 id="ما-وراء-استرجاع-المطالبات-فصل-التخزين-والاسترجاع-والتحديث">ما وراء استرجاع المطالبات: فصل التخزين والاسترجاع والتحديث</h2>

<p>أبرز الأبحاث التي تناولت هذا التوجه بشكل مباشر هي <strong>Memp: Exploring Agent Procedural Memory</strong> (arXiv 2508.06433). يضع Memp الذاكرة الإجرائية كهدف تحسين من الدرجة الأولى، ويقطّر المسارات السابقة إلى طبقتين: تعليمات دقيقة خطوة بخطوة من جهة، وإجراءات عالية المستوى أشبه بنص برمجي من جهة أخرى. كما يفصل حلقة الذاكرة إلى ثلاث مراحل هي <strong>البناء (build) والاسترجاع (retrieval) والتحديث (update)</strong>. وفي مرحلة التحديث، تُضاف العناصر أو تُعدَّل أو تُحذف وفق التغذية الراجعة من التنفيذ.</p>

<p>تكمن أهمية هذا الفصل في كونه مختلفاً جذرياً عن أسلوب حشو المهارات داخل المطالبة. ففي أسلوب المطالبة، يندمج التخزين والاسترجاع في خطوة واحدة، ويكاد مفهوم التحديث ينعدم. أما فصل المراحل الثلاث فيجعل من توقيت إدراج الإجراء أو إزالته، وما ينبغي تصحيحه من الإخفاقات، هدفاً تصميمياً صريحاً. وتشير المصادر إلى أن الاتجاه العام لهذا التوجه يمكن تلخيصه بالانتقال <strong>من قوالب صريحة غير بارامترية إلى سياسات عصبية بارامترية ضمنية</strong> (مسح الذاكرة في Foundation Agents، arXiv 2602.06052). أي أن التوجه يتجاوز مرحلة تخزين الإجراء نصياً واسترجاعه، نحو صهر الخبرة داخل سياسة النموذج نفسها.</p>

<h2 id="لماذا-يهم-هذا-الآن-صعوبة-التقييم">لماذا يهم هذا الآن: صعوبة التقييم</h2>

<p>لم يُفهم بعد بشكل كافٍ ما إذا كانت الذاكرة الإجرائية تُنتج فعلاً مهارات صالحة للاستخدام. والبحث الذي يستهدف هذه الفجوة هو <strong>Managing Procedural Memory in LLM Agents</strong> (arXiv 2606.23127)، الذي يقترح معياراً بعنوان <strong>AFTER</strong>. يتألف هذا المعيار من 382 مهمة مؤسسية واقعية موزعة على 6 أدوار وظيفية، و22 مهارة إجرائية، ويقيس مدى قابلية انتقال المهارات عبر المهام والأدوار وبنية النماذج الأساسية.</p>

<p>السؤال الذي يطرحه هذا المعيار هو الجوهر: هل يصلح الإجراء المتعلَّم في موقف معيّن لموقف آخر؟ وهل تبقى المهارة صالحة عند تغيير النموذج؟ فبمجرد تبنّي الذاكرة الإجرائية، نحتاج إلى وسيلة لقياس “هل هذه المهارة قابلة لإعادة الاستخدام فعلاً”، لأن المهارة التي لا تنتقل، حتى لو امتلكت بنية تخزين واسترجاع وتحديث كاملة، لا تختلف في النهاية عن قالب مطالبة باهظ التكلفة.</p>

<h2 id="دلالات-التطبيق-على-منتجات-thakicloud">دلالات التطبيق على منتجات ThakiCloud</h2>

<p>يتخذ هذا التوجه البحثي شكله العملي بالكامل في <strong>Paxis</strong> التابعة لـThakiCloud. Paxis سحابة أصيلة للوكلاء (Agent-Native Cloud) تتعامل مع <strong>المهارات والأدوات والسياسات وسجلات التدقيق</strong> بوصفها موارد من الدرجة الأولى. وهنا تُعد بيئة المهارات (Skill Harness) بمثابة الذاكرة الإجرائية الإنتاجية فعلياً.</p>

<ul>
  <li><strong>المقابل العملي للبناء والاسترجاع والتحديث</strong>: تختار بيئة مهارات Paxis أكثر من 960 مهارة عبر BM25 (الاسترجاع)، وتنفّذها ضمن صناديق رمل معزولة، وتحسّنها عبر حلقة تطوّر ذاتي (التحديث). وبذلك يتجسّد فصل المراحل الثلاث الذي طرحه Memp في صورة نظام تشغيلي فعلي.</li>
  <li><strong>بنية تتجاوز استرجاع المطالبات</strong>: بدلاً من حشو المهارات في المطالبة في كل مرة، يجري استدعاء مهارات موثّقة انتقائياً، مما يوفّر ميزانية السياق ويحافظ على اتساق الإجراء. وهذا يتطابق تماماً مع التوجه الذي تناولته هذه المقالة تحت عنوان “ما وراء استرجاع المطالبات”.</li>
  <li><strong>التقييم والتدقيق</strong>: تدير Paxis مفهوم “القابلية للانتقال” الذي شدّد عليه معيار AFTER من خلال بوابات السياسات وسجلات التدقيق. وبما أن كل مهارة تُتتبَّع من حيث توقيت اختيارها وما نفّذته، يبقى أساس بيانات واضح للتمييز بين الإجراءات القابلة لإعادة الاستخدام وتلك غير القابلة لذلك.</li>
</ul>

<p>من منظور البنية التحتية، فإن ai-platform هي التي تسند تنفيذ هذه المهارات. ولأن الوكيل ينفّذ المهارات فوق جدولة GPU عبر Kueue وخدمة متعددة المستأجرين، فإن تكلفة تنفيذ الذاكرة الإجرائية تتحول مباشرة إلى مسألة كفاءة في الخدمة. وبذلك يشكّل تقديم الخدمة منخفض التكلفة (ai-platform) الركيزة التي تسند جدوى الوكلاء الاقتصادية (Paxis).</p>

<h2 id="القيود-والاعتراضات">القيود والاعتراضات</h2>

<p>لنقل الذاكرة الإجرائية إلى سياسات عصبية بارامترية ثمن واضح. فالنصوص البرمجية يمكن للبشر قراءتها وتعديلها، أما الإجراءات المنصهرة داخل البارامترات فيصعب تدقيقها وتحديثها. إذ يصعب معرفة ما المخزَّن فعلياً، كما يصعب انتقاء الإجراءات الخاطئة وحذفها. وفي البيئات التي تكون فيها قابلية التفسير أمراً جوهرياً، مثل البيئات الخاضعة للتنظيم أو ذات السيادة الرقمية، يتحول هذا الغموض مباشرة إلى مخاطرة.</p>

<p>كذلك ليس أسلوب الاسترجاع غير البارامتري حلاً شاملاً. فقد يستدعي الاسترجاع إجراءات خاطئة، وقد تتدهور جودة الاختيار كلما اتسع المستودع. وكما تُظهر معايير مثل AFTER، لا تزال قابلية انتقال المهارات في مرحلة تحقق مبكرة، ولا ضمان أن الإجراء الناجح في مجال معيّن سينجح في مجال آخر. الذاكرة الإجرائية اتجاه واعد يجنّب الوكيل البدء من ورقة بيضاء في كل مرة، لكن نضج شكل التخزين وجودة الاسترجاع وسلامة التحديث ومنهجية التقييم معاً هو ما يجعلها أصلاً موثوقاً في الاستخدام العملي.</p>

<h2 id="المصادر">المصادر</h2>

<ul>
  <li><a href="https://arxiv.org/abs/2508.06433">Memp: Exploring Agent Procedural Memory (arXiv 2508.06433)</a></li>
  <li><a href="https://arxiv.org/abs/2606.23127">Managing Procedural Memory in LLM Agents: Control, Adaptation, and Evaluation (arXiv 2606.23127)</a></li>
  <li><a href="https://arxiv.org/abs/2602.06052">Rethinking Memory Mechanisms of Foundation Agents in the Second Half: A Survey (arXiv 2602.06052)</a></li>
</ul>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;nil, &quot;bio&quot;=&gt;nil, &quot;location&quot;=&gt;&quot;Seoul, Korea&quot;, &quot;email&quot;=&gt;&quot;info@thakicloud.co.kr&quot;, &quot;uri&quot;=&gt;nil, &quot;home&quot;=&gt;nil, &quot;links&quot;=&gt;[{&quot;label&quot;=&gt;&quot;Website&quot;, &quot;icon&quot;=&gt;&quot;fas fa-fw fa-link&quot;, &quot;url&quot;=&gt;&quot;https://thakicloud.co.kr&quot;}, {&quot;label&quot;=&gt;&quot;GitHub&quot;, &quot;icon&quot;=&gt;&quot;fab fa-fw fa-github&quot;, &quot;url&quot;=&gt;&quot;https://github.com/thakicloud&quot;}]}</name><email>info@thakicloud.co.kr</email></author><category term="research" /><category term="agent-memory" /><category term="procedural-memory" /><category term="llm-agents" /><category term="skills" /><category term="agent-skills" /><summary type="html"><![CDATA[إدراج المهارات ضمن المطالبة (Prompt) الموجهة إلى الوكيل يستهلك مساحة السياق وينكسر بسهولة. تنقل الأبحاث الحديثة الذاكرة الإجرائية من قوالب المطالبات إلى بنية تفصل بين البناء والاسترجاع والتحديث، بل وتتجه إلى سياسات عصبية بارامترية. تستعرض هذه المقالة خريطة هذا التحول بالتركيز على Memp ومعيار AFTER، وتبين كيف تجسّد بيئة المهارات (Skill Harness) في Paxis التابعة لـThakiCloud هذا التوجه عملياً.]]></summary></entry><entry xml:lang="ar"><title type="html">مهارات أكثر، وكلاء أسوأ: تظليل المهارات وعنق زجاجة الاختيار</title><link href="https://thakicloud.github.io/ar/research/agent-skill-shadowing-library-selection/" rel="alternate" type="text/html" title="مهارات أكثر، وكلاء أسوأ: تظليل المهارات وعنق زجاجة الاختيار" /><published>2026-07-02T00:00:00+09:00</published><updated>2026-07-02T00:00:00+09:00</updated><id>https://thakicloud.github.io/ar/research/agent-skill-shadowing-library-selection</id><content type="html" xml:base="https://thakicloud.github.io/ar/research/agent-skill-shadowing-library-selection/"><![CDATA[<h2 id="نظرة-عامة">نظرة عامة</h2>

<p>يبدو أن منح الوكيل مزيدًا من المهارات ينبغي أن يجعله أكثر كفاءة، لكن الأبحاث الحديثة تُبلّغ بالعكس. فكلما كبرت مكتبة المهارات، قد ينخفض فعليًا معدل نجاح الوكيل في المهام نفسها. تواجه الورقة arXiv 2605.24050 بعنوان “More Skills, Worse Agents?” هذه المفارقة مباشرة، وتُبلّغ بأن معدل اجتياز المهام يتراجع بنسبة تصل إلى 21% عند التوسع من مجموعة صغيرة من المهارات المفيدة إلى مكتبة من 202 مهارة.</p>

<p>هذه حقيقة تشغيلية لا فضول أكاديمي. فسحابة ThakiCloud الموجَّهة للوكلاء Paxis تُدير بالفعل أكثر من 960 مهارة، وعليها أن تقرر في كل طلب أيها تُحمِّل. إضافة المهارات سهلة، أما انتقاء المهارة الصحيحة من مكتبة متضخمة فيزداد صعوبة باطراد. يستخدم هذا المقال تظليل المهارات عدسةً لتسمية عنق الزجاجة هذا، ثم يوضح كيف يمنعه Skill Harness في Paxis عمليًا عبر الاسترجاع وبوابة امتناع، مدعومًا بقياسات حقيقية.</p>

<h2 id="ما-هو-تظليل-المهارات">ما هو تظليل المهارات</h2>

<p>تتيح مكتبة المهارات لوكيل نموذج اللغة تحميل تعليمات خاصة بالمهمة عند الطلب. والهدف تمكين مستخدم غير خبير من حل مهام في مجاله بلغة طبيعية دون معرفة أي المهارات موجودة أو كيف تعمل داخليًا. تبدأ المشكلة كلما كبرت المكتبة.</p>

<p>المساهمة الجوهرية في arXiv 2605.24050 هي تفكيك تراجع الأداء إلى أثرين. الأول هو <strong>تظليل المهارات (skill shadowing)</strong>: مع كبر المكتبة تتصادم المهارات المتشابهة في وصفها فيختار الوكيل المهارة الخاطئة أكثر. والثاني هو <strong>عبء السياق (context overhead)</strong>: تملأ أوصاف المهارات السياق فتتدهور جودة التنفيذ حتى حين يكون الاختيار صحيحًا.</p>

<p>خلاصة الورقة تخالف الحدس. فالمُسبِّب الرئيسي ليس السياق المنتفخ بل <strong>اختيار المهارة الخاطئة نفسه</strong>. بعبارة أخرى، عنق الزجاجة ليس “على النموذج قراءة نصوص كثيرة” بل “لا يستطيع النموذج انتقاء المهارة الصحيحة بين أوصاف متشابهة”. هذا التشخيص يغيّر الاستجابة. فضغط السياق وحده لا يكفي؛ نحتاج خطوة استرجاع تُضيّق المرشحين وتختار بدقة من البداية.</p>

<pre><code class="language-mermaid">flowchart TB
    A[طلب المستخدم] --&gt; B{حجم مكتبة المهارات}
    B --&gt;|مهارات مفيدة قليلة| C[اختيار المهارة الصحيحة]
    B --&gt;|توسّع إلى مئات| D[تصادم أوصاف المهارات المتشابهة]
    D --&gt; E[تظليل المهارات&lt;br/&gt;ازدياد الاختيار الخاطئ]
    D --&gt; F[عبء السياق&lt;br/&gt;تدهور التنفيذ رغم صحة الاختيار]
    E --&gt; G[تراجع معدل الاجتياز حتى 21 بالمئة]
    F --&gt; G
    C --&gt; H[الاسترجاع يُضيّق المرشحين أولًا]
    G -.تشخيص.-&gt; H
    H --&gt; I[بوابة الامتناع ترفض المهارات منخفضة الدرجة]
    I --&gt; J[التنفيذ في صندوق رمل معزول]
</code></pre>

<p>يتطابق هذا المسار تمامًا مع مشكلة واجهناها من قبل. فحشو قائمة المهارات كاملةً في المُوجِّه ينهار لحظة تجاوز العدد بضع مئات. وبدل تكبير المكتبة بلا نهاية، لا بد من التحول إلى استرجاع المرشحين الأعلى فقط لكل طلب.</p>

<h2 id="لماذا-يهم-هذا-الآن">لماذا يهم هذا الآن</h2>

<p>مشكلة الحجم لا تقتصر على ورقة واحدة. فمعيار SkillRet (arXiv 2605.05726) الصادر في الفترة نفسها يجمع 17,810 مهارة وكيل عامة في معيار استرجاع واسع النطاق منظَّم ضمن تصنيف من مستويين يضم 6 فئات رئيسية و18 فئة فرعية. صارت المهارات تتراكم بمقياس عشرات الآلاف، وأصبح استرجاع المهارة الصحيحة من هذا المجمع مسألة بحثية قائمة بذاتها.</p>

<p>باختصار، تتسع فجوة بين وتيرة إضافة المجتمعات للمهارات والقدرة على اختيارها بدقة. تُظهر أبحاث التظليل كميًّا أن هذه الفجوة تتحول إلى خسارة أداء حقيقية، بينما توفر معايير مثل SkillRet مسطرة مشتركة لقياسها. وكلاهما يشير إلى وصفة عملية واحدة: <strong>عاملْ الاسترجاع والاختيار كمسألتين من الدرجة الأولى، منفصلتين عن تكبير المكتبة.</strong></p>

<h2 id="الأثر-على-منتجات-thakicloud">الأثر على منتجات ThakiCloud</h2>

<p>يتطابق اتجاه هذا البحث تمامًا مع تصميم يُطبّقه Skill Harness في Paxis بالفعل. فـ Paxis هي سحابة ThakiCloud الموجَّهة للوكلاء وتعامل المهارات كموارد من الدرجة الأولى. وبدل دفع قائمة المهارات كاملةً في كل طلب، تُضيّق المرشحين إلى الأعلى مطابقةً عبر استرجاع BM25 المعجمي وتُحمّل هؤلاء فقط. هذا هو خط الدفاع الأول ضد تظليل المهارات. فحين تنكمش مجموعة المرشحين من مئات إلى قلة، ينكمش معها مجال تصادم الأوصاف المتشابهة.</p>

<p>خط الدفاع الثاني هو <strong>بوابة الامتناع (abstain gate)</strong>. فحين تقل أعلى درجة استرجاع عن عتبة معيّنة، لا تُفرض أي مهارة، بل يتحول الطلب إلى المعالجة الأصلية. وإذا كان جوهر تظليل المهارات هو “انتقاء مهارة خاطئة معقولة عند عدم اليقين”، فبوابة الامتناع هي الآلية التي تمنع تلك المطابقة غير المؤكدة حتميًّا في الشيفرة. فبدل الوثوق بحكم النموذج على “الغموض”، تملك عتبةُ الدرجة القرار.</p>

<p>تُظهر قياسات Skill Harness الفعلية أن التصميم يعمل. ففي معيارنا الداخلي SRA (63 حالة) بلغ Recall@5 نسبة 82.2%، وبلغت الدقة المُبوَّبة مع تطبيق بوابة الامتناع 66.7%، وبلغ Top-1 نسبة 40.0%، وكانت الهلوسة (اختلاق مهارة غير موجودة للمطابقة) 0%. وتحديدًا فإن الهلوسة 0% أثر مباشر لبوابة الامتناع: فمهما كبرت المكتبة، لا تختلق مهارة غائبة ولا تفرض مطابقة دون العتبة.</p>

<p>يعلو ذلك التنفيذُ المعزول في صندوق رمل، وبوابات السياسة، وسجلات التدقيق في Paxis. فحتى لو اختير أحيانًا مهارة خاطئة، يجري تنفيذها في بيئة معزولة ويُسجَّل كل فعل في سجل التدقيق. وحتى حين لا يزول تظليل المهارات كليًّا، يُحتوى مداه عند حدود التنفيذ. هكذا يُمنع عنق الزجاجة الذي يشخّصه البحث (فشل الاختيار) وخطره اللاحق (التنفيذ الخاطئ) في ثلاث طبقات: الاسترجاع والبوابة والعزل.</p>

<h2 id="الحدود-والاعتراضات">الحدود والاعتراضات</h2>

<p>للبحث ولتصميمنا حدود واضحة. أولًا، نسبة التراجع 21% في arXiv 2605.24050 قيمة ضمن إعداد محدد (مكتبة من 202 مهارة) وتتباين كثيرًا بحسب جودة أوصاف المهارات وتداخلها ومجال المهمة. فإذا وُصفت المهارات جيدًا وحُفظت من التداخل، تقلّ نسبة التراجع عند المقياس نفسه. الدرس الدقيق ليس “لا تُضِف مهارات” بل “أدِر جودة الوصف والاسترجاع معًا”.</p>

<p>ثانيًا، استرجاع BM25 المعجمي ليس دواءً لكل داء. فمع الاستعلامات بمصطلحات كورية صرفة تفتقر إلى مفردات توسعة إنجليزية، قد يعجز عن إظهار المهارة الصحيحة، ونسبة Top-1 البالغة 40.0% في معيارنا تترك مجالًا واسعًا للتحسين. وثمة تعزيزات مثل مجاميع التضمين مطروحة، لكن هل تبرر التخلي عن حتمية إشارة واحدة وكلفتها المنخفضة فمسألة منفصلة. وقبل تثقيل الاسترجاع، غالبًا ما يمنح تحسين أوصاف المهارات نفسها المكسب الأكبر.</p>

<p>ثالثًا، تختزل بوابة الامتناع إلى مسألة ضبط عتبة. فعتبة عالية جدًّا تستبعد مهارات مفيدة وتضر بالتغطية، وعتبة منخفضة جدًّا تعجز عن منع التظليل. ونتيجة الهلوسة 0% ثمرة عتبة مضبوطة بحذر، وتأتي بكلفة إغفال بعض المطابقات المشروعة. في النهاية، إدارة مكتبة مهارات ليست سؤال “كم نُكبّرها” بل “كيف نوازن بين الاسترجاع والبوابة وجودة الوصف”، وأبحاث التظليل تحذير كمّي بأن هذا التوازن يبدأ بالاختلال عند مقياس أصغر مما تتوقع.</p>

<h2 id="المصادر">المصادر</h2>

<ul>
  <li>More Skills, Worse Agents? Skill Shadowing Degrades Performance When Expanding Skill Libraries, arXiv 2605.24050 (<a href="https://arxiv.org/abs/2605.24050">https://arxiv.org/abs/2605.24050</a>)</li>
  <li>SkillRet: A Large-Scale Benchmark for Skill Retrieval in LLM Agents, arXiv 2605.05726 (<a href="https://arxiv.org/abs/2605.05726">https://arxiv.org/abs/2605.05726</a>)</li>
</ul>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;nil, &quot;bio&quot;=&gt;nil, &quot;location&quot;=&gt;&quot;Seoul, Korea&quot;, &quot;email&quot;=&gt;&quot;info@thakicloud.co.kr&quot;, &quot;uri&quot;=&gt;nil, &quot;home&quot;=&gt;nil, &quot;links&quot;=&gt;[{&quot;label&quot;=&gt;&quot;Website&quot;, &quot;icon&quot;=&gt;&quot;fas fa-fw fa-link&quot;, &quot;url&quot;=&gt;&quot;https://thakicloud.co.kr&quot;}, {&quot;label&quot;=&gt;&quot;GitHub&quot;, &quot;icon&quot;=&gt;&quot;fab fa-fw fa-github&quot;, &quot;url&quot;=&gt;&quot;https://github.com/thakicloud&quot;}]}</name><email>info@thakicloud.co.kr</email></author><category term="research" /><category term="agent-skills" /><category term="skill-retrieval" /><category term="llm-agents" /><category term="skill-shadowing" /><category term="paxis" /><summary type="html"><![CDATA[تُظهر أبحاث حديثة أن أداء الوكيل قد يتراجع كلما كبرت مكتبة المهارات. تُفكّك الورقة arXiv 2605.24050 هذا التراجع إلى تظليل المهارات وعبء السياق، وتجد أن عنق الزجاجة الحقيقي هو اختيار المهارة الخاطئة لا حجم السياق. نستعرض كيف يمنع Skill Harness في Paxis من ThakiCloud ذلك عمليًا عبر استرجاع BM25 وبوابة امتناع، مع أرقام قياس حقيقية.]]></summary></entry><entry xml:lang="ar"><title type="html">كيف تتعلم البنية الداخلية لنماذج LLM بشكل منهجي: من التوكنة إلى تحسين الاستدلال</title><link href="https://thakicloud.github.io/ar/technique/llm-internals-learning-path/" rel="alternate" type="text/html" title="كيف تتعلم البنية الداخلية لنماذج LLM بشكل منهجي: من التوكنة إلى تحسين الاستدلال" /><published>2026-07-02T00:00:00+09:00</published><updated>2026-07-02T00:00:00+09:00</updated><id>https://thakicloud.github.io/ar/technique/llm-internals-learning-path</id><content type="html" xml:base="https://thakicloud.github.io/ar/technique/llm-internals-learning-path/"><![CDATA[<h2 id="نظرة-عامة">نظرة عامة</h2>

<p>عندما تشغّل خدمة LLM لفترة طويلة، تصل إلى نقطة غريبة. تنشر vLLM، وتراقب استخدام GPU، وتضبط حجم الدفعات (batch size)، لكنك في لحظة ما لا تستطيع أن تشرح بجملة واحدة “لماذا يستهلك هذا الطلب هذا القدر من KV Cache”، أو “ما الذي يقلّصه GQA بالضبط ليوفّر عرض النطاق الترددي للذاكرة”. تعرف كيف تستخدم الأدوات، لكن المبادئ التي تقوم عليها تبقى ضبابية. هذه الفجوة تجعل التحسين يعتمد على الحدس، وتمنعك من استنتاج السبب الجذري عندما يحدث عطل.</p>

<p>المصدر التعليمي <a href="https://github.com/amitshekhariitbhu/llm-internals">amitshekhariitbhu/llm-internals</a> يستهدف هذه المشكلة مباشرة. إنه مستودع تعلّم متدرج يجمع مقالات ومقاطع فيديو بترتيب يبدأ من التوكنة ويمر بالانتباه وبنية الترانسفورمر وKV Cache وصولاً إلى تحسين الاستدلال. المؤلف الأصلي هو Amit Shekhar، وقد رتّب المواضيع بحيث تبني نموذجاً ذهنياً واحداً متماسكاً بدلاً من مجموعة دروس متفرقة وعابرة.</p>

<p>تشغّل ThakiCloud منصة <strong>ai-platform</strong> لتقديم النماذج لعملاء متنوعين فوق Kubernetes. معظم العوامل التي تحدد تكلفة الخدمة وزمن الاستجابة تنبع من هذه البنية الداخلية التي يتناولها هذا المستودع. لذلك، هذا المقال ليس مجرد تعريف بمصدر تعليمي، بل محاولة لتوضيح لماذا يشكّل كل موضوع منها سلاحاً مباشراً لمهندس البنية التحتية.</p>

<h2 id="ما-هو-هذا-المصدر">ما هو هذا المصدر</h2>

<p>llm-internals ليس إطار عمل لتشغيل الكود، بل هو <strong>مسار تعلّم (learning path)</strong>. يتتبع خط الأنابيب الذي يمر به LLM من استقبال المدخل حتى إنتاج التوكن التالي، ويعرض المفاهيم اللازمة في كل مرحلة بترتيب مدعوم بمصادر خارجية. جوهر المستودع هو تصميم المنهج نفسه: “ما الذي يجب فهمه، وبأي ترتيب، حتى تكتمل الصورة الكاملة”.</p>

<p>المواضيع الرئيسية التي يغطيها المستودع تتبع التدفق التالي.</p>

<pre><code class="language-mermaid">flowchart TB
    A[النص المدخل] --&gt; B[التوكنة&lt;br/&gt;BPE Byte Pair Encoding]
    B --&gt; C[التضمين&lt;br/&gt;تحويل التوكن إلى متجه]
    C --&gt; D[الانتباه&lt;br/&gt;Query Key Value]
    D --&gt; E[كتلة الترانسفورمر&lt;br/&gt;الانتباه + FFN بشكل متكرر]
    E --&gt; F[KV Cache&lt;br/&gt;تسريع التوليد]
    E --&gt; G[MoE&lt;br/&gt;توجيه الخبراء]
    D --&gt; H[GQA&lt;br/&gt;مشاركة رؤوس KV]
    F --&gt; I[تحسين الاستدلال&lt;br/&gt;كفاءة الخدمة]
    G --&gt; I
    H --&gt; I
</code></pre>

<p>أهمية هذا الترتيب تكمن في أن المواضيع اللاحقة لا يمكن فهمها دون المواضيع السابقة. فـ KV Cache لا يكتسب معناه إلا بعد فهم ما هما Key وValue في الانتباه، وGQA لا يظهر معناه إلا بعد فهم بنية الرؤوس في الانتباه متعدد الرؤوس، أي “ما الذي يتم مشاركته بالضبط”. قيمة هذا المستودع لا تكمن في عمق كل مصدر على حدة، بل في هذا الترتيب الذي لا يكسر سلسلة الاعتماد بين المفاهيم.</p>

<h2 id="استعراض-المواضيع-الأساسية">استعراض المواضيع الأساسية</h2>

<h3 id="التوكنة-نقطة-البداية-لكل-شيء">التوكنة: نقطة البداية لكل شيء</h3>

<p>لا يتعامل LLM مباشرة مع الحروف أو الكلمات، بل يعالج النص على شكل توكنات. تستخدم معظم النماذج الحديثة عائلة BPE (Byte Pair Encoding)، وهي طريقة تدمج بشكل متكرر أزواج البايتات الأكثر تكرراً معاً لبناء المفردات. قد تبدو التوكنة أمراً بسيطاً، لكنها من منظور الخدمة عامل تكلفة مباشر. نفس الجملة يمكن أن يختلف عدد توكناتها اختلافاً كبيراً باختلاف اللغة والمُرمِّز (tokenizer)، وعدد التوكنات ينعكس مباشرة على استهلاك KV Cache وحجم العمليات الحسابية. ظاهرة استهلاك اللغات غير الإنجليزية مثل الكورية والعربية عدداً أكبر من التوكنات مقارنة بالإنجليزية هي نقطة يجب مراعاتها بالضرورة عند احتساب تكلفة الخدمة.</p>

<h3 id="الانتباه-query-وkey-وvalue">الانتباه: Query وKey وValue</h3>

<p>قلب الترانسفورمر هو الانتباه الذاتي (self-attention). يُسقَط كل توكن إلى ثلاثة متجهات. Query يمثل “ما الذي أبحث عنه”، وKey يمثل “ما الذي أقدّمه”، وValue يمثل “المحتوى الفعلي الذي سيُنقل”. يُحسب مقياس الانتباه عبر الضرب الداخلي بين Query وKey، ثم يمرّ عبر عملية القياس (scaling) والدالة softmax لإنتاج مجموع مرجّح لـ Value.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Attention(Q, K, V) = softmax( (Q · Kᵀ) / √d_k ) · V
</code></pre></div></div>

<p>هذه المعادلة بسيطة في ظاهرها، لكن حقيقة أن عملية الانتباه تنمو بمعدل O(n²) بالنسبة لطول التسلسل n هي ما ينتج عنه كل عمليات التحسين اللاحقة. من هنا تبدأ الإجابة عن سبب ارتفاع تكلفة السياقات الطويلة، وسبب حساسية بنية الخدمة لطول السياق.</p>

<h3 id="كتلة-الترانسفورمر-وkv-cache">كتلة الترانسفورمر وKV Cache</h3>

<p>الترانسفورمر هو بنية من طبقات متعددة، تجمع كل طبقة منها الانتباه مع شبكة تغذية أمامية (FFN). في التوليد ذاتي الانحدار (autoregressive)، يُنتج التوكن واحداً تلو الآخر، وإعادة حساب Key وValue لكل التوكنات السابقة في كل خطوة يمثل هدراً كبيراً. <strong>KV Cache</strong> يخزّن قيم Key وValue التي حُسبت سابقاً ويعيد استخدامها، مما يرفع سرعة التوليد.</p>

<p>المشكلة هي أن هذه الذاكرة المؤقتة تستهلك ذاكرة كبيرة. يتناسب حجم الذاكرة المؤقتة تقريباً مع <code class="language-plaintext highlighter-rouge">2 × عدد الطبقات × عدد رؤوس KV × أبعاد الرأس × طول التسلسل × حجم الدفعة</code>. السياقات الطويلة وكثرة الطلبات المتزامنة تضخّم هذه القيمة بشكل انفجاري. هذا هو بالضبط الضغط البنيوي الذي يجعل تقنية PagedAttention في vLLM تدير KV Cache على شكل صفحات لتقليل التجزئة.</p>

<h3 id="moe-وgqa-تغييرات-بنيوية-لأجل-الكفاءة">MoE وGQA: تغييرات بنيوية لأجل الكفاءة</h3>

<p><strong>مزيج الخبراء (Mixture of Experts، MoE)</strong> يقسّم شبكة FFN إلى عدة “خبراء”، ويقوم موجّه (router) بتفعيل جزء فقط من الخبراء لكل توكن. إجمالي عدد المعاملات كبير، لكن حجم العمليات الحسابية الفعلي لكل توكن يصبح صغيراً. في المقابل، يفرض هذا على الخدمة تحديات جديدة: التوازي بين الخبراء، وعدم توازن التوجيه، وتوزيع الذاكرة.</p>

<p><strong>الانتباه المُجمَّع الاستعلام (Grouped-Query Attention، GQA)</strong> هو حل وسط بين الانتباه متعدد الرؤوس (MHA) والانتباه متعدد الاستعلامات (MQA). في MHA، يملك كل رأس Key وValue خاصين به، بينما في MQA تشترك جميع الرؤوس في Key وValue واحد. أما GQA فيجمّع الرؤوس في عدد قليل من المجموعات، وتشترك كل مجموعة في KV خاص بها. والنتيجة أن <strong>حجم KV Cache وعرض النطاق الترددي للذاكرة ينخفضان</strong> بينما يبقى فقدان الجودة عند حدّه الأدنى. فهم GQA يوضّح لماذا تعتمد النماذج مفتوحة الأوزان الحديثة هذه البنية، ولماذا تختلف موازنة الذاكرة عند الخدمة تبعاً لذلك.</p>

<h2 id="لماذا-تهم-هذه-المعرفة-مهندس-البنية-التحتية">لماذا تهم هذه المعرفة مهندس البنية التحتية</h2>

<p>المواضيع أعلاه ليست موضع فضول أكاديمي، بل هي السبب المباشر لتكلفة الخدمة. فهم معادلة حجم KV Cache يتيح توقّع كيف يصطدم عدد الطلبات المتزامنة وطول السياق بذاكرة GPU. وفهم GQA يفسّر لماذا يستطيع بعض النماذج معالجة عدد أكبر من الطلبات على نفس GPU. وفهم MoE يسمح بالاستعداد لسبب تعقيد الجدولة الناتج عن التوزيع المتوازي للخبراء.</p>

<p>على النقيض، غياب هذه المعرفة يعني أنك ستكتفي، عند حدوث عطل، بملاحظة عرض “نفدت الذاكرة” فقط، وتكرر الاستجابة المكلفة المتمثلة في تقليل حجم الدفعة عشوائياً أو إضافة المزيد من وحدات GPU. المهندس الذي يعرف البنية الداخلية يملك رافعات أدق: ترقيم KV Cache، وسقف طول السياق، والتكميم (quantization)، واختيار نماذج تعتمد GQA.</p>

<h2 id="تطبيقات-على-منتجات-thakicloud">تطبيقات على منتجات ThakiCloud</h2>

<p>تقدّم منصة <strong>ai-platform</strong> من ThakiCloud استدلالاً قائماً على vLLM لعدة مستأجرين فوق Kubernetes وجدولة GPU عبر Kueue. تنعكس البنية الداخلية التي استعرضناها في هذا المقال مباشرة على رافعات التشغيل الفعلية.</p>

<ul>
  <li><strong>KV Cache</strong>: استناداً إلى PagedAttention ومعادلة حجم KV Cache، نحدّد سقف طول السياق وميزانية التزامن لكل مستأجر. توقّع استهلاك الذاكرة المؤقتة يتيح رفع الإنتاجية دون الإفراط في حجز ذاكرة GPU.</li>
  <li><strong>GQA والتكميم</strong>: من أجل استيعاب عدد أكبر من الطلبات على نفس العتاد، نُعطي الأولوية في المراجعة للنماذج مفتوحة الأوزان التي تعتمد GQA، وندمج ذلك مع التكميم بهدف تحقيق تكلفة خدمة منخفضة في البيئات المحلية (on-premise) والسيادية.</li>
  <li><strong>خدمة MoE</strong>: نراعي مسبقاً أن نماذج MoE التي تحتاج توازياً بين الخبراء تتطلب معاملة خاصة في تصميم طوابير Kueue وتوزيع العُقد.</li>
</ul>

<p>من منظور الوكلاء الذكيين (agents)، فإن <strong>Paxis</strong>، السحابة الأصيلة للوكلاء (Agent-Native Cloud) من ThakiCloud، توفّر بيئة مواتية لتراكم هذه المعرفة الداخلية كأصل جماعي للفريق. بما أن Paxis تتعامل مع المهارات (skills) كموارد من الدرجة الأولى، يمكن تحويل قرارات متكررة مثل “حساب ميزانية KV Cache” إلى مهارة موثّقة يُعاد استخدامها داخل بيئة معزولة (sandbox) وتُتبَّع عبر سجل تدقيق. هذا يوفّر قناة لتحويل خبرة الخدمة، التي غالباً ما تظل معرفة ضمنية لدى مهندس بعينه، إلى معرفة إجرائية على مستوى المؤسسة.</p>

<h2 id="القيود-ووجهات-النظر-المضادة">القيود ووجهات النظر المضادة</h2>

<p>أكبر نقطة ضعف في هذا المصدر هي القدر المشترك بين جميع المستودعات المُنسَّقة (curation repos). بما أنه يعتمد على ربط مدونات ومقاطع فيديو خارجية، فإن الروابط قد تصبح قديمة أو تختفي، كما توجد فوارق في المستوى والعمق بين المصادر المختلفة. ولا يوجد ضمان بأن التغيرات المعمارية الأحدث (مثل أشكال جديدة من الانتباه) ستنعكس فوراً في المستودع.</p>

<p>كذلك، لا تزال هناك فجوة بين فهم المفهوم والتشغيل الفعلي. حفظ معادلة حجم KV Cache عن ظهر قلب لا يعني بالضرورة الحصول فوراً على الإنتاجية الفعلية على GPU معين. القياس الفعلي، وتحليل الأداء (profiling)، والضبط الخاص بكل حمل عمل تتطلب خبرة تشغيلية منفصلة. هذا المسار التعليمي ذو قيمة كبيرة كنقطة انطلاق لبناء نموذج ذهني دقيق، لكنه ليس بحد ذاته خط النهاية لتحسين الخدمة. لا بد أن تتبعه بالضرورة مرحلة التحقق فوق حركة مرور فعلية بعد استيعاب المبادئ.</p>

<h2 id="المصادر">المصادر</h2>

<ul>
  <li><a href="https://github.com/amitshekhariitbhu/llm-internals">amitshekhariitbhu/llm-internals (GitHub)</a></li>
  <li>التغريدة الأصلية المُوصية: Dan Kornas, “Stop learning LLM internals from random one-off tutorials”</li>
</ul>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;nil, &quot;bio&quot;=&gt;nil, &quot;location&quot;=&gt;&quot;Seoul, Korea&quot;, &quot;email&quot;=&gt;&quot;info@thakicloud.co.kr&quot;, &quot;uri&quot;=&gt;nil, &quot;home&quot;=&gt;nil, &quot;links&quot;=&gt;[{&quot;label&quot;=&gt;&quot;Website&quot;, &quot;icon&quot;=&gt;&quot;fas fa-fw fa-link&quot;, &quot;url&quot;=&gt;&quot;https://thakicloud.co.kr&quot;}, {&quot;label&quot;=&gt;&quot;GitHub&quot;, &quot;icon&quot;=&gt;&quot;fab fa-fw fa-github&quot;, &quot;url&quot;=&gt;&quot;https://github.com/thakicloud&quot;}]}</name><email>info@thakicloud.co.kr</email></author><category term="technique" /><category term="llm-internals" /><category term="transformer" /><category term="kv-cache" /><category term="mixture-of-experts" /><category term="gqa" /><category term="llm-inference" /><summary type="html"><![CDATA[إذا كنت تشغّل LLM في الإنتاج ولا تستطيع أن تشرح لماذا يستهلك KV Cache هذا القدر من الذاكرة، أو ما الذي يوفره GQA بالضبط، فإن التحسين يصبح مجرد تخمين. مستودع amitshekhariitbhu/llm-internals هو مسار تعلّم يربط التوكنة، ومعادلة الانتباه، وكتلة الترانسفورمر، وKV Cache، وMoE، وGQA في تسلسل واحد متماسك. نستعرض هنا لماذا يشكل كل موضوع منها سلاحاً مباشراً لمهندس البنية التحتية.]]></summary></entry><entry xml:lang="en"><title type="html">Route Every Task to Its Winning Model: How We Cut Agent Automation Costs 44x with Open-Weight Models</title><link href="https://thakicloud.github.io/en/agentops/open-weight-agent-cost-routing/" rel="alternate" type="text/html" title="Route Every Task to Its Winning Model: How We Cut Agent Automation Costs 44x with Open-Weight Models" /><published>2026-07-02T00:00:00+09:00</published><updated>2026-07-02T00:00:00+09:00</updated><id>https://thakicloud.github.io/en/agentops/open-weight-agent-cost-routing</id><content type="html" xml:base="https://thakicloud.github.io/en/agentops/open-weight-agent-cost-routing/"><![CDATA[<p><img src="/assets/images/open-weight-agent-cost-routing-hero.png" alt="Abstract image of a task flow passing through a prism and splitting into multiple cost lanes" /></p>

<p>Most teams that open their agent billing statement share the same misconception: “Our agents do a lot of hard reasoning, so we need the top-tier model.” Look at actual production traffic, though, and the picture is different. The overwhelming majority of requests are repetitive work: translating natural language into API calls, classifying logs, chaining pipeline steps, summarizing results. None of that requires world-class reasoning. Running all of it through a frontier premium model means paying a premium price for capability you are not using.</p>

<p>This post documents how we measured that waste and eliminated it. We ran real production requests through an open-weight model (Gemma 4) as structured tool calls to validate quality, then used Paxis CostRouter to calculate exactly how far costs drop when each task is routed to the right model tier. The short answer: the same workload that costs one amount on a frontier premium model costs about 44 times less on a managed open-weight tier.</p>

<h2 id="what-this-approach-does">What This Approach Does</h2>

<p>The core idea is straightforward. Rather than sending every agent task to a single model, you route each task to a different model tier based on its nature. Hard reasoning and judgment go to the frontier premium. Code generation goes to an open-weight model strong at code. Tool calls and pipeline execution go to an open-weight agent tier. High-volume extraction and classification go to the cheapest economy tier. Sending each task to the model that wins at it preserves quality while shrinking the bill.</p>

<p>Two things need to be true for this to work. First, open-weight models must genuinely handle a meaningful share of agent tasks. Second, the routing must happen automatically at the platform level, not by a human picking a model for every request. The sections below confirm each with an experiment and a real configuration.</p>

<pre><code class="language-mermaid">flowchart TB
    A[Agent task request] --&gt; B{Classify task type}
    B --&gt;|Reasoning and judgment, top tier| C[Frontier premium]
    B --&gt;|Code generation| D[Open-weight code tier]
    B --&gt;|Tool calls and pipelines| E[Open-weight agent tier&lt;br/&gt;Gemma 4]
    B --&gt;|Extraction, classification, bulk| F[Open-weight economy]
    C --&gt; G[Policy gate + audit log]
    D --&gt; G
    E --&gt; G
    F --&gt; G
    G --&gt; H[Return result + log cost]
</code></pre>

<h2 id="setup-and-integration">Setup and Integration</h2>

<p>The first question was whether an open-weight model can handle the real core task of an agent: converting a natural-language request into a structured tool call. We tested Gemma 4 26B via a managed API. The experiment was written with no external dependencies, just the standard library (urllib).</p>

<p>We gave the model a tool schema for a cloud operations pipeline: five tools covering metric queries, pod restarts, cost aggregation, deployment scaling, and secret rotation. The instruction was to receive a natural-language request and output exactly one JSON object with the correct tool name and all required parameters.</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">TOOL_SPEC</span> <span class="o">=</span> <span class="sh">"""</span><span class="s">You are an operations automation agent. Convert user requests into a single tool-call JSON object.
Output only the JSON object, no explanation or markdown fences.

Available tools and required parameters:
- query_metrics: {metric, window_days, threshold?, region?}
- restart_pods: {region, selector, only_failed(bool)}
- aggregate_cost: {group_by, month, service?}
- scale_deployment: {name, region, replicas}
- rotate_secret: {name, namespace}

Output schema: {</span><span class="sh">"</span><span class="s">tool</span><span class="sh">"</span><span class="s">: </span><span class="sh">"</span><span class="s">&lt;name&gt;</span><span class="sh">"</span><span class="s">, </span><span class="sh">"</span><span class="s">params</span><span class="sh">"</span><span class="s">: { ... }}</span><span class="sh">"""</span>

<span class="k">def</span> <span class="nf">call</span><span class="p">(</span><span class="n">prompt</span><span class="p">):</span>
    <span class="n">body</span> <span class="o">=</span> <span class="p">{</span>
        <span class="sh">"</span><span class="s">contents</span><span class="sh">"</span><span class="p">:</span> <span class="p">[{</span><span class="sh">"</span><span class="s">role</span><span class="sh">"</span><span class="p">:</span> <span class="sh">"</span><span class="s">user</span><span class="sh">"</span><span class="p">,</span>
                      <span class="sh">"</span><span class="s">parts</span><span class="sh">"</span><span class="p">:</span> <span class="p">[{</span><span class="sh">"</span><span class="s">text</span><span class="sh">"</span><span class="p">:</span> <span class="n">TOOL_SPEC</span> <span class="o">+</span> <span class="sh">"</span><span class="se">\n\n</span><span class="s">Request: </span><span class="sh">"</span> <span class="o">+</span> <span class="n">prompt</span><span class="p">}]}],</span>
        <span class="sh">"</span><span class="s">generationConfig</span><span class="sh">"</span><span class="p">:</span> <span class="p">{</span><span class="sh">"</span><span class="s">temperature</span><span class="sh">"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> <span class="sh">"</span><span class="s">maxOutputTokens</span><span class="sh">"</span><span class="p">:</span> <span class="mi">1024</span><span class="p">},</span>
    <span class="p">}</span>
    <span class="c1"># calls gemma-4-26b-a4b-it generateContent, captures latency, tokens, and output
</span></code></pre></div></div>

<p>We hit one practical issue worth documenting. Gemma 4 generates thinking tokens before its final response. With an output cap of 256, the thinking phase consumed the budget and the final JSON came back empty. Raising the cap to 1024 and filtering out response parts flagged as <code class="language-plaintext highlighter-rouge">thought</code> gave the correct final answer. This is a commonly missed step when integrating open-weight models with thinking output into pipelines, so measuring it directly was worthwhile.</p>

<p>On the platform side, Paxis manages model selection through a single declarative catalog file (<code class="language-plaintext highlighter-rouge">models.yaml</code>). Each model entry carries its input and output price per million tokens and its tier label. Routing decisions are made from this catalog.</p>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># models.yaml: tier and real unit prices drive routing decisions (USD / 1M tokens)</span>
<span class="pi">-</span> <span class="na">id</span><span class="pi">:</span> <span class="s">claude-opus-4-8</span>      <span class="c1"># premium</span>
  <span class="na">tier</span><span class="pi">:</span> <span class="s">premium</span>
  <span class="na">costInput</span><span class="pi">:</span> <span class="m">5.0</span>
  <span class="na">costOutput</span><span class="pi">:</span> <span class="m">25.0</span>
<span class="pi">-</span> <span class="na">id</span><span class="pi">:</span> <span class="s">claude-sonnet-5</span>      <span class="c1"># standard (default)</span>
  <span class="na">tier</span><span class="pi">:</span> <span class="s">standard</span>
  <span class="na">costInput</span><span class="pi">:</span> <span class="m">3.0</span>
  <span class="na">costOutput</span><span class="pi">:</span> <span class="m">15.0</span>
<span class="c1"># Add open-weight providers (Ollama, vLLM, etc.) with the same schema</span>
<span class="c1"># and CostRouter will automatically send task-tier-matched requests to the cheapest eligible model.</span>
</code></pre></div></div>

<p>When a task arrives, CostRouter evaluates its tier and selects the cheapest eligible model from the catalog. Register an open-weight provider using the same schema and tool calls, plus bulk processing work, will flow automatically to the cheaper tier. That is why humans do not need to choose a model for every request.</p>

<h2 id="experiment-results">Experiment Results</h2>

<p>We ran six real production operations requests through Gemma 4 and scored the output directly. The scoring criteria were two: is the output valid JSON, and does it contain the correct tool name and all required parameters.</p>

<table>
  <thead>
    <tr>
      <th>Metric</th>
      <th>Result</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Valid JSON rate</td>
      <td>6/6 (100%)</td>
    </tr>
    <tr>
      <td>Schema match (tool + required params)</td>
      <td>6/6 (100%)</td>
    </tr>
    <tr>
      <td>Average latency</td>
      <td>15.3 s (free shared endpoint, thinking tokens included)</td>
    </tr>
    <tr>
      <td>Average input tokens</td>
      <td>155</td>
    </tr>
    <tr>
      <td>Average output tokens</td>
      <td>33 (final answer)</td>
    </tr>
    <tr>
      <td>Average thinking tokens</td>
      <td>514</td>
    </tr>
  </tbody>
</table>

<p>All six requests produced the correct tool selection with every required parameter filled in. For example, the request “Show me nodes where GPU utilization exceeded 80% over the last 7 days” produced:</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="nl">"tool"</span><span class="p">:</span><span class="w"> </span><span class="s2">"query_metrics"</span><span class="p">,</span><span class="w"> </span><span class="nl">"params"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="nl">"metric"</span><span class="p">:</span><span class="w"> </span><span class="s2">"gpu_utilization"</span><span class="p">,</span><span class="w"> </span><span class="nl">"window_days"</span><span class="p">:</span><span class="w"> </span><span class="mi">7</span><span class="p">,</span><span class="w"> </span><span class="nl">"threshold"</span><span class="p">:</span><span class="w"> </span><span class="mi">80</span><span class="p">}}</span><span class="w">
</span></code></pre></div></div>

<p>The <code class="language-plaintext highlighter-rouge">threshold</code> field is optional in the schema, yet the model read “80%” from the request and populated it correctly. For “Scale the inference-api deployment in ap-northeast to 6 replicas,” the model mapped name, region, and replica count precisely to <code class="language-plaintext highlighter-rouge">scale_deployment</code>. These are unmanipulated measurements confirming that an open-weight model handles the core tasks of agent automation, tool calling and pipeline execution, without quality loss.</p>

<p>The 15.3-second average latency is measured on a free shared endpoint with thinking tokens included. That number drops considerably in a self-hosted or batch processing environment. The key point here is not the absolute latency but that quality did not degrade.</p>

<p>Now for the cost. Using the measured token profile as a starting point, we modeled a realistic single turn at 1,000 input tokens and 300 output tokens (accounting for system prompt, tool schema, and context), run at 10,000 tasks per day for 30 days. Frontier prices come from the actual values in Paxis <code class="language-plaintext highlighter-rouge">models.yaml</code>. Open-weight prices come from representative mid-2026 managed inference estimates.</p>

<p><img src="/assets/images/open-weight-agent-cost-routing-results.png" alt="Bar chart comparing monthly API costs by model tier" /></p>

<table>
  <thead>
    <tr>
      <th>Tier</th>
      <th>Cost per task</th>
      <th>Monthly cost (10k/day, 30 days)</th>
      <th>vs. Premium</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Frontier premium</td>
      <td>$0.0125</td>
      <td>$3,750</td>
      <td>baseline</td>
    </tr>
    <tr>
      <td>Frontier standard</td>
      <td>$0.0075</td>
      <td>$2,250</td>
      <td>1.7x cheaper</td>
    </tr>
    <tr>
      <td>Frontier economy</td>
      <td>$0.0020</td>
      <td>$600</td>
      <td>6.2x cheaper</td>
    </tr>
    <tr>
      <td>Open-weight managed (Gemma-class)</td>
      <td>$0.000285</td>
      <td>$86</td>
      <td>43.9x cheaper</td>
    </tr>
    <tr>
      <td>Open-weight economy</td>
      <td>$0.00007</td>
      <td>$21</td>
      <td>178.6x cheaper</td>
    </tr>
  </tbody>
</table>

<p>The same workload costs $3,750 per month at the frontier premium tier and $86 per month at the Gemma-class open-weight tier. That is roughly a 44x difference. And as the experiment shows, open-weight quality on tool-call tasks was 100%. This saving does not come from degrading quality. It comes from removing overspec. Open-weight unit prices vary by provider and whether you self-host (which is why they are labeled as estimates), but the order-of-magnitude savings direction is solid.</p>

<h2 id="implications-for-thakicloud-products">Implications for ThakiCloud Products</h2>

<p>This pattern fits precisely with how Paxis, ThakiCloud’s Agent-Native Cloud, is designed. Paxis treats skills, tools, policies, and audit logs as first-class resources, the same way traditional cloud treats servers and networks. CostRouter sits on top of that as the layer that picks the right model for each task.</p>

<ul>
  <li><strong>Per-task routing is a first-class feature.</strong> A single <code class="language-plaintext highlighter-rouge">models.yaml</code> is the one source of truth for which provider and model to use. Register an open-weight provider using the same schema and tool calls plus bulk processing work will flow automatically to the cheaper tier. Standard tier is the default and premium requires an explicit selection, so overspec routing cannot happen by accident.</li>
  <li><strong>Isolated execution and governance are built in.</strong> Regardless of which tier a task is sent to, the result passes through the policy gate and audit log. Using a cheaper model does not loosen control. In fact, because every task’s model, token count, and cost are recorded, you can retrospectively identify which task types are using an expensive tier unnecessarily and reroute them.</li>
  <li><strong>The design is compatible with on-premises and sovereign requirements.</strong> Open-weight models can be served on your own GPUs, which lets you control both cost and data residency for customers whose data cannot leave their environment. ThakiCloud’s ai-platform runs this open-weight tier in multi-tenant mode using Kueue-based GPU scheduling and vLLM serving. Efficient serving directly enables agent economics, which means ai-platform’s infrastructure advantage underpins Paxis’s routing economics.</li>
</ul>

<p>The core principle is not “use expensive models less.” It is “route every task to the model that wins at it.” Most agent tasks are tool calls and pipeline execution, and the vast majority of those are well within reach of open-weight models.</p>

<h2 id="limitations-and-counterarguments">Limitations and Counterarguments</h2>

<p>This approach has clear boundaries.</p>

<p>On tasks that require the hardest reasoning and the broadest world knowledge, open-weight models still fall behind frontier. That is why routing must be “open-weight where it wins” and not “open-weight everywhere.” Difficult judgment calls belong at the premium tier. Routing them to a cheap tier because of the cost savings produces quality failures, not savings.</p>

<p>Task-type classification itself becomes a new failure point. If classification is wrong, routing is wrong. That means you need a feedback loop: continuously observe classification results alongside actual quality, and bump task types back to a higher tier if failures start accumulating at the cheaper one.</p>

<p>The open-weight unit prices in the cost table are estimates. Absolute values depend on the provider and whether you self-host. The frontier prices are real, the experiment quality is measured, and the conclusion that savings are order-of-magnitude in scale is robust. We recommend running the same calculation with your own actual unit prices.</p>

<p>Finally, latency. Fifteen seconds on a free shared endpoint is a burden for real-time conversational UX. For batch pipelines and background automation it is fine. For user-facing paths where someone is waiting, you need either self-hosted serving to reduce latency or routing that sends only that segment to a faster tier.</p>

<h2 id="sources">Sources</h2>

<ul>
  <li>Experiment code and result logs: The Gemma 4 tool-call experiment (6/6 success) described in this post is based on measured logs in <code class="language-plaintext highlighter-rouge">outputs/blog-impl/open-weight-agent-cost-routing/</code>.</li>
  <li>Frontier unit prices: Paxis <code class="language-plaintext highlighter-rouge">models.yaml</code> (costInput/costOutput, USD per 1M tokens).</li>
  <li>Open-weight unit prices: Representative mid-2026 managed inference estimates [estimated].</li>
</ul>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;nil, &quot;bio&quot;=&gt;nil, &quot;location&quot;=&gt;&quot;Seoul, Korea&quot;, &quot;email&quot;=&gt;&quot;info@thakicloud.co.kr&quot;, &quot;uri&quot;=&gt;nil, &quot;home&quot;=&gt;nil, &quot;links&quot;=&gt;[{&quot;label&quot;=&gt;&quot;Website&quot;, &quot;icon&quot;=&gt;&quot;fas fa-fw fa-link&quot;, &quot;url&quot;=&gt;&quot;https://thakicloud.co.kr&quot;}, {&quot;label&quot;=&gt;&quot;GitHub&quot;, &quot;icon&quot;=&gt;&quot;fab fa-fw fa-github&quot;, &quot;url&quot;=&gt;&quot;https://github.com/thakicloud&quot;}]}</name><email>info@thakicloud.co.kr</email></author><category term="agentops" /><category term="open-weight" /><category term="cost-optimization" /><category term="model-routing" /><category term="agent-automation" /><category term="gemma4" /><category term="tool-calling" /><summary type="html"><![CDATA[Most agent automation is not top-tier reasoning. It is tool calling and pipeline execution. We ran real production requests through Gemma 4 as structured tool calls, confirmed 6/6 success, then calculated the exact cost of routing each task to an open-weight model tier using Paxis CostRouter, real token counts, and real prices.]]></summary></entry><entry xml:lang="en"><title type="html">Qwen3.6-27B in NVFP4: The Economics of Single-GPU Blackwell Serving</title><link href="https://thakicloud.github.io/en/llmops/qwen3-6-27b-nvfp4-vllm-blackwell/" rel="alternate" type="text/html" title="Qwen3.6-27B in NVFP4: The Economics of Single-GPU Blackwell Serving" /><published>2026-07-02T00:00:00+09:00</published><updated>2026-07-02T00:00:00+09:00</updated><id>https://thakicloud.github.io/en/llmops/qwen3-6-27b-nvfp4-vllm-blackwell</id><content type="html" xml:base="https://thakicloud.github.io/en/llmops/qwen3-6-27b-nvfp4-vllm-blackwell/"><![CDATA[<h2 id="overview">Overview</h2>

<p>If you can serve a 27B-class model on a single GPU with near-lossless accuracy, the economics of on-premises inference change. The nvidia/Qwen3.6-27B-NVFP4 checkpoint re-quantizes Qwen3.6-27B into the NVFP4 data type so it runs on a recent vLLM with no extra configuration. That is the backdrop to the vLLM project announcing this checkpoint is inference-ready on Blackwell GPUs.</p>

<p>The point is not simply “reduced to 4-bit” but <strong>what was reduced and what was kept</strong>. This post dissects the mixed-precision design of the NVFP4 re-quantization, lays out how to actually serve it with vLLM, and then works through what this means for the multi-tenant GPU serving cost structure of ThakiCloud ai-platform. Where measurement is required, we mark it honestly.</p>

<h2 id="what-this-is">What This Is</h2>

<p>NVFP4 is a 4-bit floating-point format that drops bits-per-parameter from 16 to 4, cutting disk and GPU memory requirements by roughly 2.5x. But the actual design of nvidia/Qwen3.6-27B-NVFP4 does not flatten everything to 4-bit. NVIDIA ModelOpt’s re-quantization <strong>lowers only the MLP linear layers to NVFP4 (W4A16), while keeping the attention linear layers and the KV cache in FP8.</strong> As a result, about 22GB of weights fit on a single Blackwell GPU. NVIDIA reports this configuration is near-lossless in accuracy versus the FP8 baseline.</p>

<p>There is a reason for this mixed-precision choice. The MLP layers hold an overwhelming share of the parameters, so their memory savings are large and they tolerate 4-bit relatively well. Attention and the KV cache, by contrast, are sensitive to quality over long contexts, so they stay in FP8 to preserve accuracy. The principle: “cut the heaviest part most aggressively, and keep the most sensitive part conservatively.”</p>

<pre><code class="language-mermaid">flowchart TB
    A[Qwen3.6-27B original FP16 weights] --&gt; B[NVIDIA ModelOpt re-quantization]
    B --&gt; C[MLP linear layers&lt;br/&gt;NVFP4 W4A16]
    B --&gt; D[Attention linear layers&lt;br/&gt;kept in FP8]
    B --&gt; E[KV cache&lt;br/&gt;kept in FP8]
    C --&gt; F[About 22GB weights]
    D --&gt; F
    E --&gt; F
    F --&gt; G[Loads on a single Blackwell GPU]
    G --&gt; H[vLLM auto-detects&lt;br/&gt;quantization modelopt]
    H --&gt; I[OpenAI-compatible inference endpoint]
</code></pre>

<p>Compared to a uniform 4-bit quantization (for example, W4 across all layers), this approach captures most of the memory savings while defending quality by keeping sensitive layers in FP8. Setting the savings-vs-accuracy trade-off per layer is the key differentiator of NVFP4 re-quantization.</p>

<h2 id="installation-and-serving">Installation and Serving</h2>

<p>vLLM auto-detects the ModelOpt quantization from the checkpoint, so you do not strictly need to pass a quantization flag. You do need a recent vLLM with NVFP4/W4A16 support, and NVIDIA recommends nightly or a source build that includes ModelOpt support. Bring up the nightly image with Docker and serve as follows.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Recent vLLM with NVFP4/ModelOpt support (nightly image)</span>
docker run <span class="nt">--gpus</span> all <span class="nt">-p</span> 8000:8000 <span class="se">\</span>
  vllm/vllm-openai:nightly <span class="se">\</span>
  vllm serve nvidia/Qwen3.6-27B-NVFP4 <span class="se">\</span>
    <span class="nt">--port</span> 8000 <span class="se">\</span>
    <span class="nt">--quantization</span> modelopt <span class="se">\</span>
    <span class="nt">--max-model-len</span> 262144 <span class="se">\</span>
    <span class="nt">--reasoning-parser</span> qwen3
</code></pre></div></div>

<p><code class="language-plaintext highlighter-rouge">--max-model-len 262144</code> uses the long context of the Qwen3.6 family as-is, and <code class="language-plaintext highlighter-rouge">--reasoning-parser qwen3</code> handles reasoning-token parsing. The endpoint is OpenAI-compatible, so existing clients attach without change.</p>

<h2 id="experiment-results">Experiment Results</h2>

<p>To be candid: this checkpoint assumes a Blackwell-class GPU, and the environment where this post was written has no such hardware, so we <strong>could not reproduce it locally.</strong> The numbers below are therefore not our measurements but figures reported by public sources, cited as-is with attribution.</p>

<ul>
  <li>NVIDIA reports the NVFP4 re-quantized configuration is <strong>near-lossless</strong> in accuracy versus the FP8 baseline (per the model card).</li>
  <li>The weight size is about <strong>22GB</strong>, fitting on a single Blackwell GPU (per the model card).</li>
  <li>One third-party benchmark (loFT LLC) reports <strong>around 190 tok/s of generation throughput</strong> with an NVFP4+MTP configuration on dual RTX PRO 6000 Blackwell Max-Q. This is an [estimate]-grade external measurement, not our environment’s value.</li>
</ul>

<p>What we could verify are the facts of the serving path. That vLLM auto-detects ModelOpt quantization, that the configuration is mixed-precision (MLP in NVFP4, attention and KV in FP8), and that ~22GB of weights fit on a single Blackwell are all confirmed in the public model card and the vLLM recipe. Actual throughput and latency remain something to measure once the hardware is in hand.</p>

<h2 id="implications-for-thakicloud-products">Implications for ThakiCloud Products</h2>

<p>What makes this checkpoint interesting is less the benchmark numbers themselves and more the <strong>shift in serving economics</strong>. ThakiCloud ai-platform serves models across diverse customer environments on K8s and Kueue, and the GPU is always the most expensive resource. If a 27B-class model can fit on a single GPU, near-losslessly at that, you lower per-tenant GPU occupancy and can host more models, or more tenants, on the same hardware.</p>

<p>From a multi-tenant view, this saving compounds. When a model drops from 2 GPUs to 1, the cluster’s concurrent serving slots nearly double. Under Kueue-based GPU allocation, that translates directly into shorter wait queues and easier fair sharing across tenants. It matters especially for customers with strong on-premises and sovereign requirements, because the sheer number of GPUs to procure falls, lowering the barrier of upfront investment and operating cost.</p>

<p>The mixed-precision design also aligns with our operating philosophy. Rather than lowering precision indiscriminately, the approach of keeping the quality-sensitive parts and aggressively cutting only the heavy parts fits the goal of “cost efficiency and quality at once.” It is why, when adopting a new quantized checkpoint on ai-platform, we review not just the benchmark score but which layers were treated at which precision. NVFP4 re-quantization is a good reference case for that review, and once we secure measured throughput we plan a follow-up post on its cost-quality profile in our serving stack.</p>

<h2 id="limitations-and-counterpoints">Limitations and Counterpoints</h2>

<p>First, the hardware dependency is stark. NVFP4’s benefit is maximized on Blackwell-generation GPUs, and earlier generations should not expect the same efficiency. The appeal of single-GPU serving holds only on the premise that Blackwell was secured. In an environment where GPU procurement itself is the bottleneck, “a single GPU is enough” does not immediately convert into cost savings.</p>

<p>Second, near-lossless is a story about benchmark averages. In specific domains, long contexts, or precision-sensitive tasks like numerics and code, a subtle quality drop versus the FP8 baseline may surface. An NVFP4 adoption decision should be confirmed by evaluation on the actual workload you will serve, not by the model card’s summary figures.</p>

<p>Third, the throughput number in this post is not our measurement. Third-party benchmarks depend heavily on hardware configuration (dual RTX PRO 6000, whether MTP is used) and on batch and context length, so our cluster’s actual value is undetermined until we measure it directly. This post’s conclusion reaches only “NVFP4 single-GPU serving has the potential to shift serving economics”; “how many tok/s in our environment” is a matter to state after separate verification.</p>

<h2 id="sources">Sources</h2>

<ul>
  <li>nvidia/Qwen3.6-27B-NVFP4 model card, Hugging Face (<a href="https://huggingface.co/nvidia/Qwen3.6-27B-NVFP4">https://huggingface.co/nvidia/Qwen3.6-27B-NVFP4</a>)</li>
  <li>Qwen/Qwen3.6-27B, vLLM Recipes (<a href="https://recipes.vllm.ai/Qwen/Qwen3.6-27B">https://recipes.vllm.ai/Qwen/Qwen3.6-27B</a>)</li>
  <li>Measuring Qwen3.6-27B NVFP4+MTP on vLLM, loFT LLC (<a href="https://loftllc.dev/en/docs/tech/llm-research/qwen3-6-27b-nvfp4-mtp-vllm-benchmark/">https://loftllc.dev/en/docs/tech/llm-research/qwen3-6-27b-nvfp4-mtp-vllm-benchmark/</a>)</li>
</ul>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;nil, &quot;bio&quot;=&gt;nil, &quot;location&quot;=&gt;&quot;Seoul, Korea&quot;, &quot;email&quot;=&gt;&quot;info@thakicloud.co.kr&quot;, &quot;uri&quot;=&gt;nil, &quot;home&quot;=&gt;nil, &quot;links&quot;=&gt;[{&quot;label&quot;=&gt;&quot;Website&quot;, &quot;icon&quot;=&gt;&quot;fas fa-fw fa-link&quot;, &quot;url&quot;=&gt;&quot;https://thakicloud.co.kr&quot;}, {&quot;label&quot;=&gt;&quot;GitHub&quot;, &quot;icon&quot;=&gt;&quot;fab fa-fw fa-github&quot;, &quot;url&quot;=&gt;&quot;https://github.com/thakicloud&quot;}]}</name><email>info@thakicloud.co.kr</email></author><category term="llmops" /><category term="vllm" /><category term="nvfp4" /><category term="quantization" /><category term="blackwell" /><category term="model-serving" /><summary type="html"><![CDATA[NVIDIA re-quantized Qwen3.6-27B to NVFP4 so it serves on a single Blackwell GPU with vLLM out of the box. We break down how the mixed precision (MLP in NVFP4, attention and KV cache in FP8) fits a 27B model in about 22GB, and what that means for the multi-tenant GPU serving economics of ThakiCloud ai-platform.]]></summary></entry><entry xml:lang="en"><title type="html">Agent Procedural Memory: Beyond Prompt Retrieval</title><link href="https://thakicloud.github.io/en/research/agent-procedural-memory-beyond-retrieval/" rel="alternate" type="text/html" title="Agent Procedural Memory: Beyond Prompt Retrieval" /><published>2026-07-02T00:00:00+09:00</published><updated>2026-07-02T00:00:00+09:00</updated><id>https://thakicloud.github.io/en/research/agent-procedural-memory-beyond-retrieval</id><content type="html" xml:base="https://thakicloud.github.io/en/research/agent-procedural-memory-beyond-retrieval/"><![CDATA[<h2 id="overview">Overview</h2>

<p>Anyone who has run LLM agents for a while hits the same wall. The agent reasons from scratch every time, fumbling its way back through a procedure it already solved last week. A common fix is to cram frequently used skills straight into the prompt. But this approach is fragile for two reasons. First, as skills accumulate they eat up the context window, leaving less room for the actual task. Second, prompt templates break easily the moment the situation shifts even slightly.</p>

<p>Recent research on agent memory reframes this problem through the lens of <strong>procedural memory</strong>. Just as human procedural memory holds skilled actions that execute without conscious thought, like riding a bike, an agent’s procedural memory compresses the execution steps of recurring tasks into a reusable form. The core shift is moving procedural knowledge <strong>beyond prompt retrieval</strong>, into a separate storage, retrieval, and update architecture, and ultimately into a neural policy embedded in the model’s own parameters.</p>

<p>This post maps that shift through peer-reviewed papers. Since ThakiCloud’s Agent-Native Cloud, Paxis, treats skills as first-class resources in exactly the way this research line points toward, we close by drawing that connection.</p>

<h2 id="what-is-procedural-memory">What Is Procedural Memory</h2>

<p>From a cognitive-science standpoint, memory is commonly split into three kinds: semantic memory for facts, episodic memory for events, and procedural memory for methods. In the agent literature, procedural memory covers the “how”: it abstracts complex action sequences into reusable patterns, so the agent doesn’t have to plan from the ground up every single time.</p>

<p>The trouble is that in most agents today, this procedural knowledge exists in one of three forms: hand-crafted by a person, embedded in a brittle prompt template, or implicitly entangled in the model’s parameters where it is expensive to update. What this research targets is lifting that knowledge into a <strong>learnable, updatable, first-class object</strong>.</p>

<pre><code class="language-mermaid">flowchart TB
    A[Past execution trajectories] --&gt; B[Procedure extraction&lt;br/&gt;Build]
    B --&gt; C{Storage form}
    C --&gt; D[Non-parametric&lt;br/&gt;text scripts]
    C --&gt; E[Parametric&lt;br/&gt;neural policy]
    D --&gt; F[Retrieval and selection&lt;br/&gt;Retrieval]
    E --&gt; F
    F --&gt; G[Task execution]
    G --&gt; H[Feedback-driven update&lt;br/&gt;add, revise, delete Update]
    H --&gt; B
</code></pre>

<h2 id="beyond-prompt-retrieval-separating-build-retrieval-and-update">Beyond Prompt Retrieval: Separating Build, Retrieval, and Update</h2>

<p>The paper that takes this shift on directly is <strong>Memp: Exploring Agent Procedural Memory</strong> (arXiv 2508.06433). Memp treats procedural memory as a first-class optimization target and distills past trajectories into two layers: fine-grained, step-by-step instructions, and higher-level, script-like procedures. It then splits the memory loop into three distinct phases: <strong>build, retrieval, and update</strong>. In the update phase, entries are added, revised, or deleted based on execution feedback.</p>

<p>This separation matters because it is fundamentally different from stuffing skills into a prompt. In the prompt-based approach, storage and retrieval are collapsed into one, and the very concept of “update” barely exists. Once you separate the three phases, when and how a procedure enters or leaves the pool, and what gets fixed after a failure, become explicit design decisions. According to the literature, the broader direction of this shift is summarized as a move <strong>from explicit non-parametric templates toward implicit parametric neural policies</strong> (the Foundation Agents memory survey, arXiv 2602.06052). In other words, the field is moving past storing and retrieving procedures as text, toward folding experience directly into the model’s own policy.</p>

<h2 id="why-this-matters-now-the-evaluation-problem">Why This Matters Now: The Evaluation Problem</h2>

<p>Whether procedural memory actually produces usable skills is still not well understood. The paper aimed at this gap is <strong>Managing Procedural Memory in LLM Agents</strong> (arXiv 2606.23127). It proposes a benchmark called <strong>AFTER</strong>: 382 realistic enterprise tasks spanning 6 job roles, paired with 22 procedural skills, built to measure how well a skill transfers across tasks, roles, and model backbones.</p>

<p>The question this benchmark raises is the crux of the matter. Does a procedure learned in one context hold up in another? Does a skill still work once the underlying model changes? The moment you introduce procedural memory, you need a way to measure whether a given skill is actually reusable. Even with a solid build-retrieve-update architecture in place, a skill that fails to transfer ends up no better than an expensive prompt template.</p>

<h2 id="implications-for-thakiclouds-products">Implications for ThakiCloud’s Products</h2>

<p>This line of research already has a concrete production shape in ThakiCloud’s <strong>Paxis</strong>. Paxis is an Agent-Native Cloud that treats <strong>skills, tools, policies, and audit logs as first-class resources</strong>. Its skill harness is, in effect, procedural memory running in production.</p>

<ul>
  <li><strong>A practical counterpart to build, retrieval, and update</strong>: Paxis’s skill harness selects (retrieves) from more than 960 skills via BM25, executes them in isolated sandboxes, and improves (updates) them through a self-evolution loop. The three-phase separation that Memp proposed shows up here as an operating system.</li>
  <li><strong>An architecture that moves past prompt retrieval</strong>: Instead of stuffing skills into every prompt, Paxis selectively pulls in verified skills, which preserves the context budget while keeping the procedure consistent. This lines up exactly with the “beyond prompt retrieval” direction covered in this post.</li>
  <li><strong>Evaluation and audit</strong>: Paxis manages the “transferability” that the AFTER benchmark emphasizes through policy gates and audit logs. Because which skill was selected, when, and what it did is all tracked, there is a data-backed basis for telling reusable procedures apart from ones that are not.</li>
</ul>

<p>From an infrastructure standpoint, ai-platform underpins this skill execution. Because agents run skills on top of Kueue GPU scheduling and multi-tenant serving, the execution cost of procedural memory feeds directly into serving efficiency. Low-cost serving (ai-platform) is what makes agent economics (Paxis) sustainable.</p>

<h2 id="limitations-and-counterarguments">Limitations and Counterarguments</h2>

<p>Moving procedural memory toward a parametric neural policy comes with a clear cost. A text script can be read and edited by a human, but a procedure folded into parameters is hard to audit and hard to update. It is difficult to inspect what has actually been stored, and just as difficult to pick out and delete a bad procedure. In regulated or sovereign environments where explainability matters, that opacity becomes a risk in its own right.</p>

<p>Non-parametric retrieval is not a silver bullet either. Retrieval can still surface the wrong procedure, and selection quality can degrade as the storage pool grows. As benchmarks like AFTER show, skill transferability is still at an early stage of validation, and there is no guarantee that a procedure that works in one domain will work in another. Procedural memory is a promising direction for keeping agents from starting over from a blank slate every time, but it will only become a trustworthy production asset once storage form, retrieval quality, update safety, and evaluation methodology mature together.</p>

<h2 id="sources">Sources</h2>

<ul>
  <li><a href="https://arxiv.org/abs/2508.06433">Memp: Exploring Agent Procedural Memory (arXiv 2508.06433)</a></li>
  <li><a href="https://arxiv.org/abs/2606.23127">Managing Procedural Memory in LLM Agents: Control, Adaptation, and Evaluation (arXiv 2606.23127)</a></li>
  <li><a href="https://arxiv.org/abs/2602.06052">Rethinking Memory Mechanisms of Foundation Agents in the Second Half: A Survey (arXiv 2602.06052)</a></li>
</ul>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;nil, &quot;bio&quot;=&gt;nil, &quot;location&quot;=&gt;&quot;Seoul, Korea&quot;, &quot;email&quot;=&gt;&quot;info@thakicloud.co.kr&quot;, &quot;uri&quot;=&gt;nil, &quot;home&quot;=&gt;nil, &quot;links&quot;=&gt;[{&quot;label&quot;=&gt;&quot;Website&quot;, &quot;icon&quot;=&gt;&quot;fas fa-fw fa-link&quot;, &quot;url&quot;=&gt;&quot;https://thakicloud.co.kr&quot;}, {&quot;label&quot;=&gt;&quot;GitHub&quot;, &quot;icon&quot;=&gt;&quot;fab fa-fw fa-github&quot;, &quot;url&quot;=&gt;&quot;https://github.com/thakicloud&quot;}]}</name><email>info@thakicloud.co.kr</email></author><category term="research" /><category term="agent-memory" /><category term="procedural-memory" /><category term="llm-agents" /><category term="skills" /><category term="agent-skills" /><summary type="html"><![CDATA[Stuffing skills into an agent's prompt eats context and breaks easily. Recent research is moving procedural memory from prompt templates toward architectures that separate build, retrieval, and update, and further toward parametric neural policies. We map this shift around Memp and the AFTER benchmark, then look at how ThakiCloud Paxis's skill harness puts it into practice.]]></summary></entry><entry xml:lang="en"><title type="html">More Skills, Worse Agents: Skill Shadowing and the Selection Bottleneck</title><link href="https://thakicloud.github.io/en/research/agent-skill-shadowing-library-selection/" rel="alternate" type="text/html" title="More Skills, Worse Agents: Skill Shadowing and the Selection Bottleneck" /><published>2026-07-02T00:00:00+09:00</published><updated>2026-07-02T00:00:00+09:00</updated><id>https://thakicloud.github.io/en/research/agent-skill-shadowing-library-selection</id><content type="html" xml:base="https://thakicloud.github.io/en/research/agent-skill-shadowing-library-selection/"><![CDATA[<h2 id="overview">Overview</h2>

<p>Handing an agent more skills feels like it should make it more capable, but recent research reports the opposite. As a skill library grows, an agent’s success rate on the same tasks can actually fall. arXiv 2605.24050, “More Skills, Worse Agents? Skill Shadowing Degrades Performance When Expanding Skill Libraries,” confronts this paradox head-on and reports that task pass rate drops by up to 21% when scaling from a small set of helpful skills to a 202-skill library.</p>

<p>This is an operational reality, not an academic curiosity. ThakiCloud’s Agent-Native Cloud, Paxis, already manages over 960 skills and must decide, on every request, which of them to load. Adding skills is easy; picking the right one from a swollen library gets steadily harder. This post uses skill shadowing as a lens to name that bottleneck, then shows how the Paxis skill harness blocks it in practice with retrieval and an abstain gate, backed by real measurements.</p>

<h2 id="what-is-skill-shadowing">What Is Skill Shadowing</h2>

<p>A skill library lets an LLM agent load task-specific instructions on demand. The goal is to let a non-expert user solve domain tasks in natural language without knowing which skills exist or how they work internally. The trouble begins as the library grows.</p>

<p>The core contribution of arXiv 2605.24050 is to decompose the performance drop into two effects. The first is <strong>skill shadowing</strong>: as the library grows, similarly described skills collide and the agent picks the wrong skill more often. The second is <strong>context overhead</strong>: skill descriptions fill the context and degrade execution quality even when the selection was correct.</p>

<p>The paper’s conclusion cuts against intuition. The primary culprit is not the bloated context but <strong>the wrong skill selection itself</strong>. In other words, the bottleneck is not “the model has to read too much text” but “the model cannot pick the right skill among lookalike descriptions.” That diagnosis changes the response. Compressing context is not enough; you need a retrieval step that narrows candidates and selects precisely in the first place.</p>

<pre><code class="language-mermaid">flowchart TB
    A[User request] --&gt; B{Skill library size}
    B --&gt;|A few useful skills| C[Relevant skill selected correctly]
    B --&gt;|Scaled to hundreds| D[Similar skill descriptions collide]
    D --&gt; E[Skill shadowing&lt;br/&gt;more wrong-skill selections]
    D --&gt; F[Context overhead&lt;br/&gt;execution degrades even when correct]
    E --&gt; G[Task pass rate falls up to 21 percent]
    F --&gt; G
    C --&gt; H[Retrieval narrows candidates first]
    G -.diagnosis.-&gt; H
    H --&gt; I[Abstain gate rejects low-score skills]
    I --&gt; J[Execute in isolated sandbox]
</code></pre>

<p>This flow overlaps precisely with a problem we already faced. Stuffing the full skill list into the prompt breaks the moment the count passes a few hundred. Instead of endlessly growing the library, you must switch to retrieving only the top candidates per request.</p>

<h2 id="why-this-matters-now">Why This Matters Now</h2>

<p>The scale problem is not confined to one paper. The SkillRet benchmark (arXiv 2605.05726), released around the same time, assembles 17,810 public agent skills into a large-scale retrieval benchmark organized under a two-level taxonomy of 6 major and 18 sub-categories. Skills are now accumulating at the scale of tens of thousands, and retrieving the right one from that pool has become a research problem in its own right.</p>

<p>In short, a gap is opening between the pace at which communities add skills and the ability to select them accurately. The shadowing work shows quantitatively that this gap turns into real performance loss, while benchmarks like SkillRet supply a common yardstick to measure it. Both point to a single practical prescription: <strong>treat retrieval and selection as first-class problems, separate from growing the library.</strong></p>

<h2 id="implications-for-thakicloud-products">Implications for ThakiCloud Products</h2>

<p>This research direction maps exactly onto a design the Paxis skill harness already implements. Paxis is ThakiCloud’s Agent-Native Cloud and treats skills as first-class resources. Rather than pushing the entire skill list on every request, it narrows candidates to the top matches with BM25 lexical retrieval and loads only those. That is the first line of defense against skill shadowing. When the candidate set shrinks from hundreds to a few, the room for lookalike descriptions to collide shrinks with it.</p>

<p>The second line of defense is the <strong>abstain gate</strong>. When the top retrieval score falls below a threshold, no skill is forced; the request falls through to native handling. If the essence of skill shadowing is “picking a plausible wrong skill when unsure,” the abstain gate is the mechanism that deterministically blocks that unsure match in code. Rather than trusting the model to judge “this is ambiguous,” a score threshold owns the decision.</p>

<p>Our skill-retrieval harness’s actual measurements show the design works. On our internal SRA bench (63 cases), Recall@5 was 82.2%, the gated accuracy with the abstain gate applied was 66.7%, Top-1 was 40.0%, and hallucination (inventing a nonexistent skill to match) was 0%. The 0% hallucination in particular is a direct effect of the abstain gate: no matter how large the library grows, it neither fabricates a missing skill nor forces a below-threshold match.</p>

<p>On top of this sit Paxis’s isolated sandbox execution, policy gates, and audit logs. Even if a wrong skill is occasionally selected, its execution happens in an isolated environment and every action is recorded in the audit log. Even when skill shadowing does not vanish entirely, its blast radius is contained at the execution boundary. The bottleneck the research diagnoses (selection failure) and its downstream risk (wrong execution) are blocked in three layers: retrieval, gate, and isolation.</p>

<h2 id="limitations-and-counterpoints">Limitations and Counterpoints</h2>

<p>Both the research and our design have clear limits. First, the 21% drop in arXiv 2605.24050 is a value under a specific setup (a 202-skill library) and varies greatly with the quality and overlap of skill descriptions and the task domain. Describe skills well and keep them from overlapping, and the drop shrinks at the same scale. The precise lesson is not “do not add skills” but “manage description quality and retrieval together.”</p>

<p>Second, BM25 lexical retrieval is not a panacea. For queries in pure Korean terminology that lack English expansion vocabulary, it can fail to surface the right skill, and our bench’s Top-1 of 40.0% leaves plenty of room to improve. Reinforcements like embedding ensembles are on the table, but whether they justify giving up the determinism and low cost of a single signal is a separate call. Before making retrieval heavier, improving the skill descriptions themselves usually yields the larger gain.</p>

<p>Third, the abstain gate reduces to a threshold-tuning problem. Too high, and it excludes useful skills, hurting coverage; too low, and it fails to block shadowing. The 0% hallucination result is a product of a conservatively set threshold, and it comes at the cost of missing some legitimate matches. Ultimately, running a skill library is not a question of “how much to grow it” but of “how to balance retrieval, gate, and description quality,” and the shadowing work is a quantitative warning that this balance starts to wobble at a smaller scale than you would expect.</p>

<h2 id="sources">Sources</h2>

<ul>
  <li>More Skills, Worse Agents? Skill Shadowing Degrades Performance When Expanding Skill Libraries, arXiv 2605.24050 (<a href="https://arxiv.org/abs/2605.24050">https://arxiv.org/abs/2605.24050</a>)</li>
  <li>SkillRet: A Large-Scale Benchmark for Skill Retrieval in LLM Agents, arXiv 2605.05726 (<a href="https://arxiv.org/abs/2605.05726">https://arxiv.org/abs/2605.05726</a>)</li>
</ul>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;nil, &quot;bio&quot;=&gt;nil, &quot;location&quot;=&gt;&quot;Seoul, Korea&quot;, &quot;email&quot;=&gt;&quot;info@thakicloud.co.kr&quot;, &quot;uri&quot;=&gt;nil, &quot;home&quot;=&gt;nil, &quot;links&quot;=&gt;[{&quot;label&quot;=&gt;&quot;Website&quot;, &quot;icon&quot;=&gt;&quot;fas fa-fw fa-link&quot;, &quot;url&quot;=&gt;&quot;https://thakicloud.co.kr&quot;}, {&quot;label&quot;=&gt;&quot;GitHub&quot;, &quot;icon&quot;=&gt;&quot;fab fa-fw fa-github&quot;, &quot;url&quot;=&gt;&quot;https://github.com/thakicloud&quot;}]}</name><email>info@thakicloud.co.kr</email></author><category term="research" /><category term="agent-skills" /><category term="skill-retrieval" /><category term="llm-agents" /><category term="skill-shadowing" /><category term="paxis" /><summary type="html"><![CDATA[Recent work shows agent performance can drop as skill libraries grow. arXiv 2605.24050 decomposes the decline into skill shadowing and context overhead, and finds the real bottleneck is wrong skill selection, not context size. We look at how ThakiCloud Paxis's skill harness blocks this in practice with BM25 retrieval and an abstain gate, with real bench numbers.]]></summary></entry><entry xml:lang="en"><title type="html">How to Systematically Learn LLM Internals: From Tokenization to Inference Optimization</title><link href="https://thakicloud.github.io/en/technique/llm-internals-learning-path/" rel="alternate" type="text/html" title="How to Systematically Learn LLM Internals: From Tokenization to Inference Optimization" /><published>2026-07-02T00:00:00+09:00</published><updated>2026-07-02T00:00:00+09:00</updated><id>https://thakicloud.github.io/en/technique/llm-internals-learning-path</id><content type="html" xml:base="https://thakicloud.github.io/en/technique/llm-internals-learning-path/"><![CDATA[<h2 id="overview">Overview</h2>

<p>If you operate LLM serving long enough, you eventually hit an odd spot. You’ve deployed vLLM, you monitor GPU utilization, you tune batch sizes, and yet you still can’t put into words why a given request occupies this much KV cache, or exactly what GQA trims away to save memory bandwidth. You know how to operate the tools, but the principles underneath stay blurry. That gap forces optimization to run on intuition, and it leaves you unable to reason about root causes when something breaks.</p>

<p>A learning resource that takes this problem head-on is <a href="https://github.com/amitshekhariitbhu/llm-internals">amitshekhariitbhu/llm-internals</a>. It’s a step-by-step repository that strings together blog posts and videos in a deliberate order, starting from tokenization and moving through attention, transformer architecture, KV cache, and inference optimization. The original author is Amit Shekhar, and the topics are arranged to build a single coherent mental model rather than leaving readers with a pile of disconnected one-off tutorials.</p>

<p>ThakiCloud operates ai-platform, which serves models across diverse customer environments on Kubernetes. Most of what determines serving cost and latency traces back to the internals this repository covers. So this post isn’t just a resource pointer: it walks through why each topic becomes a direct, usable weapon for an infrastructure engineer.</p>

<h2 id="what-this-resource-actually-is">What This Resource Actually Is</h2>

<p>llm-internals isn’t a framework you run code with, it’s a <strong>learning path</strong>. It follows the pipeline an LLM goes through from receiving input to producing the next token, presenting the concepts needed at each stage alongside external references, in order. The core value lies in the curriculum design itself: deciding what needs to be understood, and in what sequence, for the full picture to click into place.</p>

<p>The main topics the repository covers follow this flow:</p>

<pre><code class="language-mermaid">flowchart TB
    A[Input text] --&gt; B[Tokenization&lt;br/&gt;BPE Byte Pair Encoding]
    B --&gt; C[Embedding&lt;br/&gt;Tokens to vectors]
    C --&gt; D[Attention&lt;br/&gt;Query Key Value]
    D --&gt; E[Transformer block&lt;br/&gt;Attention + FFN repeated]
    E --&gt; F[KV Cache&lt;br/&gt;Speeds up generation]
    E --&gt; G[MoE&lt;br/&gt;Expert routing]
    D --&gt; H[GQA&lt;br/&gt;KV head sharing]
    F --&gt; I[Inference optimization&lt;br/&gt;Serving efficiency]
    G --&gt; I
    H --&gt; I
</code></pre>

<p>This order matters because later topics don’t make sense without the earlier ones. The KV cache only means something once you know what the Key and Value in attention actually are, and GQA only shows “what’s being shared” once you understand the head structure of multi-head attention. The repository’s value isn’t the depth of any single article, it’s the sequencing that never breaks this dependency chain.</p>

<h2 id="a-closer-look-at-the-core-topics">A Closer Look at the Core Topics</h2>

<h3 id="tokenization-where-everything-starts">Tokenization: Where Everything Starts</h3>

<p>LLMs don’t work directly with letters or words, they process tokens. Most modern models use some variant of BPE (Byte Pair Encoding), which builds a vocabulary by repeatedly merging byte pairs that frequently appear together. Tokenization looks trivial, but from a serving standpoint it’s a direct cost driver. The same sentence can produce very different token counts depending on the language and the tokenizer, and token count directly maps to KV cache occupancy and compute. The fact that non-English text (Korean, Arabic, and similar languages) tends to consume more tokens than English is something you have to account for when estimating serving costs.</p>

<h3 id="attention-query-key-value">Attention: Query, Key, Value</h3>

<p>The heart of the transformer is self-attention. Each token gets projected into three vectors. Query represents “what am I looking for,” Key represents “what do I offer,” and Value represents “what I actually deliver.” The attention score is computed as the dot product of Query and Key, then passed through scaling and softmax to produce a weighted sum over Value.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Attention(Q, K, V) = softmax( (Q · Kᵀ) / √d_k ) · V
</code></pre></div></div>

<p>The formula itself is simple, but the fact that attention computation grows as O(n²) with sequence length n is what gives rise to nearly every optimization technique that follows. This is the origin point for why long context is expensive, and why serving infrastructure is so sensitive to context length.</p>

<h3 id="transformer-blocks-and-the-kv-cache">Transformer Blocks and the KV Cache</h3>

<p>A transformer stacks multiple layers of blocks, each combining attention with a feed-forward network (FFN). In autoregressive generation, tokens are produced one at a time, and recomputing the Key and Value of every prior token at each step would be wasteful. The <strong>KV cache</strong> solves this by storing already-computed Keys and Values and reusing them, which speeds up generation.</p>

<p>The catch is that this cache consumes memory. Cache size scales roughly with <code class="language-plaintext highlighter-rouge">2 × number of layers × number of KV heads × head dimension × sequence length × batch size</code>. Long contexts and many concurrent requests can blow this number up fast. This structural pressure is exactly why vLLM’s PagedAttention manages the KV cache in pages: to reduce fragmentation.</p>

<h3 id="moe-and-gqa-structural-changes-for-efficiency">MoE and GQA: Structural Changes for Efficiency</h3>

<p><strong>Mixture of Experts (MoE)</strong> splits the FFN into multiple experts, and a router activates only a subset of experts per token. Total parameter count is large, but the actual compute per token stays small. In exchange, serving has to deal with new challenges: expert parallelism, routing imbalance, and memory placement.</p>

<p><strong>Grouped-Query Attention (GQA)</strong> is a middle ground between multi-head attention (MHA) and multi-query attention (MQA). In MHA, every head has its own Key/Value; in MQA, all heads share a single Key/Value. GQA groups heads into a handful of clusters and shares KV within each group. The result is a <strong>reduction in KV cache size and memory bandwidth</strong> with minimal quality loss. Understanding GQA clarifies why recent open-weight models adopt this structure, and why it shifts your memory budget at serving time.</p>

<h2 id="why-this-knowledge-matters-for-infrastructure-engineers">Why This Knowledge Matters for Infrastructure Engineers</h2>

<p>None of the topics above are academic curiosities, they are direct causes of serving cost. Understanding the KV cache size formula lets you predict how concurrent request count and context length collide with GPU memory. Understanding GQA lets you explain why one model handles more requests than another on the same GPU. Understanding MoE prepares you for why expert-parallel placement complicates scheduling.</p>

<p>Without this knowledge, the usual response to an incident is to see “out of memory” and repeatedly reach for the expensive fix: cut the batch size blindly, or throw more GPUs at it. An engineer who understands the internals has finer levers available: KV cache paging, context length caps, quantization, and choosing a GQA-based model.</p>

<h2 id="implications-for-thakiclouds-products">Implications for ThakiCloud’s Products</h2>

<p>ThakiCloud’s <strong>ai-platform</strong> delivers multi-tenant, vLLM-based inference on top of Kubernetes and Kueue GPU scheduling. The internals covered in this post translate directly into operational levers.</p>

<ul>
  <li><strong>KV cache</strong>: Using PagedAttention and the KV cache size formula as a basis, we set per-tenant context length caps and concurrency budgets. Predicting cache occupancy lets us push throughput up without over-committing GPU memory.</li>
  <li><strong>GQA and quantization</strong>: To fit more requests on the same hardware, we prioritize open-weight models that adopt GQA, combining it with quantization to target low serving costs in on-premise and sovereign environments.</li>
  <li><strong>MoE serving</strong>: MoE models that require expert parallelism get separate treatment in Kueue queue design and node placement, planned for in advance.</li>
</ul>

<p>From an agent perspective, ThakiCloud’s Agent-Native Cloud, <strong>Paxis</strong>, is well suited to accumulating this kind of internal knowledge as a team asset. Because Paxis treats skills as first-class resources, a recurring judgment call like “compute the KV cache budget” can be hardened into a verified skill, reused inside an isolated sandbox, and tracked through audit logs. It becomes a channel for turning serving know-how, which otherwise tends to live only in individual engineers’ heads, into procedural knowledge the whole organization owns.</p>

<h2 id="limitations-and-counterarguments">Limitations and Counterarguments</h2>

<p>The biggest weakness of this resource is the fate of any curated repository. Because it’s built by stitching together external blog posts and videos, links can go stale or disappear, and the notation and depth vary from source to source. There’s also no guarantee that the latest architectural shifts (new attention variants, for instance) get folded in right away.</p>

<p>There’s also still a gap between conceptual understanding and real-world operation. Memorizing the KV cache formula doesn’t hand you the actual throughput number on a specific GPU. Real benchmarking, profiling, and workload-specific tuning all require separate hands-on experience. This learning path is genuinely valuable as a starting point for building an accurate mental model, but it isn’t, by itself, the endpoint of serving optimization. Understanding the principles has to be followed by validation against real traffic.</p>

<h2 id="sources">Sources</h2>

<ul>
  <li><a href="https://github.com/amitshekhariitbhu/llm-internals">amitshekhariitbhu/llm-internals (GitHub)</a></li>
  <li>Original recommending tweet: Dan Kornas, “Stop learning LLM internals from random one-off tutorials”</li>
</ul>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;nil, &quot;bio&quot;=&gt;nil, &quot;location&quot;=&gt;&quot;Seoul, Korea&quot;, &quot;email&quot;=&gt;&quot;info@thakicloud.co.kr&quot;, &quot;uri&quot;=&gt;nil, &quot;home&quot;=&gt;nil, &quot;links&quot;=&gt;[{&quot;label&quot;=&gt;&quot;Website&quot;, &quot;icon&quot;=&gt;&quot;fas fa-fw fa-link&quot;, &quot;url&quot;=&gt;&quot;https://thakicloud.co.kr&quot;}, {&quot;label&quot;=&gt;&quot;GitHub&quot;, &quot;icon&quot;=&gt;&quot;fab fa-fw fa-github&quot;, &quot;url&quot;=&gt;&quot;https://github.com/thakicloud&quot;}]}</name><email>info@thakicloud.co.kr</email></author><category term="technique" /><category term="llm-internals" /><category term="transformer" /><category term="kv-cache" /><category term="mixture-of-experts" /><category term="gqa" /><category term="llm-inference" /><summary type="html"><![CDATA[If you operate LLMs in production but can't explain why the KV cache eats memory or what GQA actually saves, your optimization work is running on intuition. amitshekhariitbhu/llm-internals is a learning repository that strings together tokenization, the attention formula, transformer blocks, KV cache, MoE, and GQA in a deliberate sequence. This post explains why each topic is a direct weapon for infrastructure engineers.]]></summary></entry></feed>