<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nodecode</title>
    <description>The latest articles on DEV Community by Nodecode (@nodecodeai).</description>
    <link>https://dev.to/nodecodeai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4285608%2Fb4b08f04-e3a3-417d-95eb-20787ecafaeb.png</url>
      <title>DEV Community: Nodecode</title>
      <link>https://dev.to/nodecodeai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nodecodeai"/>
    <language>en</language>
    <item>
      <title>Why 95%-Cached Coding and Security Agents Pay 10x Less on Prefix Caching Than Uncached Sticker Prices</title>
      <dc:creator>Nodecode</dc:creator>
      <pubDate>Sun, 06 Dec 2026 01:05:56 +0000</pubDate>
      <link>https://dev.to/nodecodeai/why-95-cached-coding-and-security-agents-pay-10x-less-on-prefix-caching-than-uncached-sticker-5h8o</link>
      <guid>https://dev.to/nodecodeai/why-95-cached-coding-and-security-agents-pay-10x-less-on-prefix-caching-than-uncached-sticker-5h8o</guid>
      <description>&lt;p&gt;When developers compare LLM APIs, almost everyone sorts by two columns: fresh input price and output price per 1M tokens. For one-shot chat prompts, that table works. For autonomous coding and pentest agents, it predicts the wrong winner almost every time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The real token ratio of an agent loop
&lt;/h2&gt;

&lt;p&gt;In a multi-turn harness (Claude Code, Codex CLI, OpenCode, Strix, PentAGI), every step sends:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The full system prompt and tool schema definitions&lt;/li&gt;
&lt;li&gt;The conversation and tool-call history up to turn &lt;code&gt;N&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;A tiny slice of new tokens (the latest command stdout or file diff)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Across a real 14-minute Claude Code session we measured and published (&lt;a href="https://nodecode.ai/research/claude-code-deepseek" rel="noopener noreferrer"&gt;full token breakdown&lt;/a&gt;), &lt;strong&gt;96.5% of all input tokens were prefix cache hits&lt;/strong&gt;. Fresh input and generated output together were a small fraction of the total context processed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two pricing models on the exact same 95%-cached loop
&lt;/h2&gt;

&lt;p&gt;Compare two backends serving 10M total input tokens (&lt;code&gt;9.5M&lt;/code&gt; cached, &lt;code&gt;0.5M&lt;/code&gt; fresh) and &lt;code&gt;100K&lt;/code&gt; output tokens in a sustained tool loop:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Uncached-focused pricing (&lt;code&gt;$0.80 / $0.40 cached / $1.50&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;Cache-optimized pricing (&lt;code&gt;$0.33 / $0.009 cached / $1.32&lt;/code&gt;)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cached input (&lt;code&gt;9.5M&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;$3.80&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;$0.0855&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fresh input (&lt;code&gt;0.5M&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;$0.40&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;$0.1650&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Output (&lt;code&gt;0.1M&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;$0.15&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;$0.1320&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Session total&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;$4.35&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;$0.3825&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On the same workload, prefix cache read pricing swings the bill by &lt;strong&gt;more than 11x&lt;/strong&gt; - even though the fresh-input prices only differed by 2.4x.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three engineering details that keep cache hit rates above 90%
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Keep the prefix byte-identical.&lt;/strong&gt; Injecting a changing timestamp or random UUID at the top of the system prompt invalidates the entire KV prefix on turn 1. Put volatile state at the end of the message array.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use sticky session routing across replicas.&lt;/strong&gt; Round-robin load balancing across stateless GPU workers turns a 95% cache hit rate into a 25% hit rate on a 4-node pool. Route sessions by prefix affinity while draining warm caches gracefully before restarts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never trade tenant isolation for cache hits.&lt;/strong&gt; Shared prefix caches without cryptographic tenant separation risk cross-account timing or prefix side channels. Enforcing a mandatory per-org HMAC &lt;code&gt;cache_salt&lt;/code&gt; in the gateway keeps cache hits high per tenant while guaranteeing zero cross-org KV reuse, paired with a hard 30-minute idle KV eviction timer.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you run authorized security harnesses or long-horizon coding agents on &lt;a href="https://nodecode.ai/abliterated" rel="noopener noreferrer"&gt;abliterated AI models&lt;/a&gt;, benchmark your actual session bill with cache hits turned on rather than comparing uncached list prices. You can inspect live agent-loop cost breakdowns with our &lt;a href="https://nodecode.ai/tools/agent-cost-calculator" rel="noopener noreferrer"&gt;agent cost calculator&lt;/a&gt; or read the &lt;a href="https://nodecode.ai/cyber" rel="noopener noreferrer"&gt;Nodecode Cyber v1 specs&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>devops</category>
      <category>security</category>
    </item>
    <item>
      <title>How Weight Abliteration Cuts LLM Refusals Without Retraining (and Where Agent Loops Still Break)</title>
      <dc:creator>Nodecode</dc:creator>
      <pubDate>Sun, 06 Dec 2026 01:05:53 +0000</pubDate>
      <link>https://dev.to/nodecodeai/how-weight-abliteration-cuts-llm-refusals-without-retraining-and-where-agent-loops-still-break-n0h</link>
      <guid>https://dev.to/nodecodeai/how-weight-abliteration-cuts-llm-refusals-without-retraining-and-where-agent-loops-still-break-n0h</guid>
      <description>&lt;p&gt;Most developers treat "uncensored", "jailbroken", and "abliterated" as interchangeable labels. They are three completely different mechanisms, and picking the wrong one shows up immediately once you run multi-turn security or coding agents.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Jailbreaks&lt;/strong&gt; fight the model at prompt time. They burn context window, break tool-calling JSON schemas, and fail unpredictably across turns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uncensored fine-tunes&lt;/strong&gt; retrain weights with SFT or DPO on filtered datasets. That works on small models, but retraining a 600B+ MoE checkpoint cleanly is expensive and often shifts coding or tool-use behavior.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Weight abliteration&lt;/strong&gt; edits the existing checkpoint directly by projecting out the internal activation direction responsible for refusals, with zero retraining.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We wrote up the full mechanics and tradeoffs in our &lt;a href="https://nodecode.ai/abliterated" rel="noopener noreferrer"&gt;abliterated AI models technical overview&lt;/a&gt;. Below is the engineering view of what happens inside the residual stream and why the inference stack matters just as much as the weights.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What weight orthogonalization actually edits
&lt;/h2&gt;

&lt;p&gt;Arditi et al. (2024, &lt;code&gt;arXiv:2406.11717&lt;/code&gt;) showed that safety refusals in instruction-tuned models are concentrated along a surprisingly low-rank linear subspace in the residual stream:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run a paired set of harmful and harmless prompts through the base model and record residual-stream activations across layers.&lt;/li&gt;
&lt;li&gt;Compute the difference-of-means direction &lt;code&gt;r&lt;/code&gt; separating refused prompts from answered prompts.&lt;/li&gt;
&lt;li&gt;Orthogonalize the weight matrices writing into the residual stream against &lt;code&gt;r&lt;/code&gt; (&lt;code&gt;W' = W - (W r) r^T&lt;/code&gt; for normalized &lt;code&gt;r&lt;/code&gt;), optionally tuned per layer to minimize KL divergence against the base model's token distribution.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Because the edit is baked into the checkpoint weights:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No system-prompt hacks are needed.&lt;/li&gt;
&lt;li&gt;Structured tool calls stay intact.&lt;/li&gt;
&lt;li&gt;Refusals on authorized defensive/offensive tasks (exploit reproduction, Nuclei template generation, malware reverse engineering, static taint auditing) drop from ~90%+ to near zero.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Follow-up work (&lt;code&gt;arXiv:2602.02132&lt;/code&gt;, 2026) showed refusal is not always strictly one vector across every architecture and modality (especially thinking traces and image-embedded prompts), which is why naive one-shot ablation can either leave residual refusals or bruise general reasoning benchmarks. Measuring KL drift and paired capability retention (GPQA, AIME, MMLU-Pro, IFBench) against the exact base checkpoint is the only honest way to verify an edit.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Where abliterated deployments fail in production agent loops
&lt;/h2&gt;

&lt;p&gt;Getting refusal rates down is now the easy half. Running coding and pentest harnesses (Claude Code, Codex CLI, Strix, PentAGI) against an abliterated model exposes three operational failure modes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Prompt-cache economics dominate token cost.&lt;/strong&gt; A 15-minute autonomous agent loop typically runs 85% to 97% cached input tokens as the repo map, system prompt, and tool history replay on every step. A cheap uncached sticker price with expensive cache reads costs far more per task than a tuned prefix-cached backend.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Low concurrency stalls parallel scanners.&lt;/strong&gt; Autonomous security harnesses fan out 20 to 64 parallel sessions. Endpoints capped at 2 to 10 concurrent requests bottleneck the harness long before model speed matters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retention and cache-isolation leaks.&lt;/strong&gt; Sending client source code, internal IPs, or vulnerability PoCs to an API that logs prompts to disk or shares KV cache prefixes across tenants breaks enterprise security policy. Production zero data retention requires memory-only inference (no disk prompt logs, swap disabled, core dumps disabled), per-org &lt;code&gt;cache_salt&lt;/code&gt; isolation on every request, and bounded idle KV cache expiry (30 minutes).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  3. Practical checklist before wiring an abliterated model into a harness
&lt;/h2&gt;

&lt;p&gt;Before pointing Claude Code, Strix, or PentAGI at any hosted or local checkpoint:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check &lt;strong&gt;cached input rate&lt;/strong&gt; alongside fresh input and output rates - run a real 10-turn tool trace and compare total session spend.&lt;/li&gt;
&lt;li&gt;Verify &lt;strong&gt;endpoint compatibility&lt;/strong&gt; (&lt;code&gt;/v1/chat/completions&lt;/code&gt;, &lt;code&gt;/v1/responses&lt;/code&gt;, and &lt;code&gt;/v1/messages&lt;/code&gt; for Anthropic-native agents).&lt;/li&gt;
&lt;li&gt;Confirm &lt;strong&gt;KV cache isolation&lt;/strong&gt; (&lt;code&gt;cache_salt&lt;/code&gt;) and bounded idle eviction rather than relying on a policy sentence alone.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a deeper walkthrough of orthogonalization vs fine-tuning, refusal-vs-KL tradeoffs, and running abliterated DeepSeek V4.1 Flash (&lt;code&gt;nodecode-cyber-v1&lt;/code&gt;) behind OpenAI and Anthropic SDKs, see &lt;a href="https://nodecode.ai/abliterated" rel="noopener noreferrer"&gt;how abliterated AI models work&lt;/a&gt; and the &lt;a href="https://nodecode.ai/docs/cyber" rel="noopener noreferrer"&gt;Cyber v1 documentation&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>security</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
