<?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: Anish Shrestha</title>
    <description>The latest articles on DEV Community by Anish Shrestha (@anyesh).</description>
    <link>https://dev.to/anyesh</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%2F202575%2F3ff44b38-0271-4c86-9438-14b0ada88277.png</url>
      <title>DEV Community: Anish Shrestha</title>
      <link>https://dev.to/anyesh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anyesh"/>
    <language>en</language>
    <item>
      <title>J-space in practice: using Anthropic's Jacobian lens to decide what an LLM can forget</title>
      <dc:creator>Anish Shrestha</dc:creator>
      <pubDate>Wed, 29 Jul 2026 12:07:06 +0000</pubDate>
      <link>https://dev.to/anyesh/j-space-in-practice-using-anthropics-jacobian-lens-to-decide-what-an-llm-can-forget-14h1</link>
      <guid>https://dev.to/anyesh/j-space-in-practice-using-anthropics-jacobian-lens-to-decide-what-an-llm-can-forget-14h1</guid>
      <description>&lt;p&gt;Anthropic published &lt;a href="https://transformer-circuits.pub/2026/workspace/index.html" rel="noopener noreferrer"&gt;Verbalizable Representations Form a Global Workspace in Language Models&lt;/a&gt; on July 6, and the vocabulary it introduced is suddenly everywhere: J-space, the Jacobian lens, a global workspace inside Claude. Most of the discussion so far is about interpretability and alignment auditing, which is fair, since that is what the paper is about. I had a narrower and more mercenary question: can the workspace tell an inference runtime which parts of the KV cache it is safe to throw away?&lt;/p&gt;

&lt;p&gt;Three days after the paper landed, the first pre-registered gate on that question passed. As of this week the signal has replicated on three models and ships inside &lt;a href="https://github.com/Anyesh/EVOKE" rel="noopener noreferrer"&gt;EVOKE&lt;/a&gt;, my KV cache memory manager built on a forked llama.cpp. This post covers what J-space is, why it makes a good KV cache eviction signal, the numbers across Qwen2.5-7B, Qwen3-8B, and Qwen3-4B, and the caveat that comes with them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frh1hfff9leh8ua2rp18x.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frh1hfff9leh8ua2rp18x.gif" alt="Animation of the two-stage pipeline: the Jacobian lens sweeps a session's KV blocks assigning workspace scores at prefill, then under a 25% cache budget the workspace policy keeps the planted fact and answers the turn-14 probe while SnapKV evicts it and fails" width="720" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What J-space is, in one paragraph
&lt;/h2&gt;

&lt;p&gt;The Jacobian lens is the instrument and J-space is the phenomenon. The lens isolates directions in a model's residual stream that encode a token the model could verbalize next, and those directions form a low-dimensional workspace: roughly 10% of activation variance, concentrated in the middle layers, carrying whatever the model is "holding in mind" at each position. Anthropic's headline application is alignment auditing, reading reasoning the model never voices. What makes independent work possible is that they released &lt;a href="https://github.com/anthropics/jacobian-lens" rel="noopener noreferrer"&gt;companion code&lt;/a&gt; under Apache-2.0 along with fitted lens matrices for open Qwen models on &lt;a href="https://huggingface.co/neuronpedia/jacobian-lens" rel="noopener noreferrer"&gt;Hugging Face&lt;/a&gt;, so anyone can apply the lens to an open-weights model on a single GPU.&lt;/p&gt;

&lt;h2&gt;
  
  
  The systems problem: KV cache eviction
&lt;/h2&gt;

&lt;p&gt;Every long-running LLM session eventually outgrows its KV cache budget. An agent session in a coding harness crosses tens of thousands of cached tokens within a few turns, and something has to decide which entries stay in GPU memory. The standard answers, H2O and SnapKV, rank cache blocks by accumulated attention history: keep what the model has been attending to, evict the rest. StreamingLLM adds protected sink tokens and a recency window.&lt;/p&gt;

&lt;p&gt;These policies share a structural weakness. They are backward-looking, so they can only rank blocks the model has already used. A fact planted at turn 1 that will matter at turn 14 looks cold the whole time, and it gets evicted exactly when the budget tightens.&lt;/p&gt;

&lt;h2&gt;
  
  
  The hypothesis: workspace content predicts KV reuse
&lt;/h2&gt;

&lt;p&gt;The lens readout suggested a forward-looking alternative. If a position carries workspace content, meaning the model is holding something in mind there, then its KV entries should be disproportionately likely to be read by later reasoning. That is a content signal, computable at prefill time from the residual stream alone, before any attention history exists.&lt;/p&gt;

&lt;p&gt;The offline validation lives in &lt;a href="https://github.com/Anyesh/j-space" rel="noopener noreferrer"&gt;j-space&lt;/a&gt;: lens application, a family of workspace statistics over the readout (kurtosis of block means, transport ratios, energy concentration, computed across layers), block aggregation, eviction simulation, and probe distillation. Because a signal this convenient deserved suspicion, I pre-registered three kill gates before running anything:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fact ranking.&lt;/strong&gt; The best workspace statistic has to beat SnapKV at ranking the task-critical block, by a pre-set AUC margin, or the project dies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Masked eviction.&lt;/strong&gt; With only 25% of the cache retained under the workspace policy, the planted fact has to stay answerable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Probe distillation.&lt;/strong&gt; Applying the full lens at inference time is too expensive, so a ridge probe distilled from the workspace readout has to reproduce the ranking at Spearman 0.8 or better. The deployable artifact is one dot product per position.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Results across three Qwen models
&lt;/h2&gt;

&lt;p&gt;All three gates passed on all three models, with no hand-tuning on the replications.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Fact-AUC (workspace)&lt;/th&gt;
&lt;th&gt;Fact-AUC (SnapKV)&lt;/th&gt;
&lt;th&gt;Eviction @ 25% budget&lt;/th&gt;
&lt;th&gt;Probe Spearman&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Qwen2.5-7B-Instruct&lt;/td&gt;
&lt;td&gt;0.891&lt;/td&gt;
&lt;td&gt;0.622&lt;/td&gt;
&lt;td&gt;35/36 vs 25/36&lt;/td&gt;
&lt;td&gt;0.959&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Qwen3-8B&lt;/td&gt;
&lt;td&gt;0.865&lt;/td&gt;
&lt;td&gt;0.563&lt;/td&gt;
&lt;td&gt;35/36 vs 14/36&lt;/td&gt;
&lt;td&gt;0.944&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Qwen3-4B&lt;/td&gt;
&lt;td&gt;0.939&lt;/td&gt;
&lt;td&gt;0.541&lt;/td&gt;
&lt;td&gt;36/36 vs 13/36&lt;/td&gt;
&lt;td&gt;0.946&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdoeyae6nxq4pkk2aapdl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdoeyae6nxq4pkk2aapdl.png" alt="Grouped bar chart of fact-AUC on three Qwen models: the workspace signal scores 0.891, 0.865, and 0.939 while SnapKV scores 0.622, 0.563, and 0.541, barely above the 0.5 chance line" width="800" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The eviction column reads: episodes where the planted fact survived eviction and was answered correctly, workspace policy vs SnapKV at the same budget. On Qwen3-4B the workspace policy saturates at 36/36 at every budget tested.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvd8l6tg4fswy6q877sea.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvd8l6tg4fswy6q877sea.png" alt="Grouped bar chart of eviction survival at a 25% cache budget: the workspace policy keeps the fact answerable in 35, 35, and 36 of 36 episodes while SnapKV manages 25, 14, and 13" width="800" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The distilled probe also holds up live. Inside EVOKE's agent bench, the workspace signal passes the fact probe at every cache budget (512, 1024, and 2048 tokens) with recovery disabled, while H2O fails all three budgets and SnapKV passes only at 2048. Measured decode overhead was -0.6%, which is noise; the probe is a dot product per position at prefill, and nothing runs during decode.&lt;/p&gt;

&lt;h2&gt;
  
  
  What transfers and what does not
&lt;/h2&gt;

&lt;p&gt;Here is the caveat, and I think it is the most interesting finding in the project. The winning statistic is model-dependent. On Qwen2.5-7B and Qwen3-8B it is kurtosis of block-mean workspace scores at deep layers (layer 23 and layer 30 respectively). On Qwen3-4B it is a transport-ratio statistic at layer 12 of 36. If I had frozen the 7B statistic and shipped it as "the" signal, the 4B replication would have failed. What transfers is the statistic family plus the automated procedure that selects the winner per model on held-out episodes, not any single magic number.&lt;/p&gt;

&lt;p&gt;The other scope limits are stated plainly in the paper: three models so far, all Qwen; the probes are fit on the benchmark's own episode family; and the task family is long-horizon fact recall. LongBench-style suites and non-Qwen architectures are open work. As far as I can tell this is the first interpretability-derived KV eviction signal, and I would much rather over-state the limits than the result.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it ships: EVOKE v2.0
&lt;/h2&gt;

&lt;p&gt;EVOKE treats the KV cache the way an operating system treats memory. Blocks are evicted under budget pressure and recovered recompute-free through save/restore primitives added to a forked llama.cpp, 20 to 32 times faster than re-prefilling the same tokens. &lt;a href="https://github.com/Anyesh/EVOKE/releases/tag/v2.0" rel="noopener noreferrer"&gt;Version 2.0&lt;/a&gt; adds the workspace probe as a first-class eviction signal alongside live attention capture, harness priority tags, task-focus coherence, and recency, and includes the paper PDF with the full three-model evaluation.&lt;/p&gt;

&lt;p&gt;You can watch the signal work in the &lt;a href="https://huggingface.co/spaces/anish-shrestha/evoke-demo" rel="noopener noreferrer"&gt;live demo on Hugging Face Spaces&lt;/a&gt;, which runs three arms side by side on Qwen3-4B: a plain baseline, EVOKE with its attention scorer, and EVOKE with workspace eviction. There is also a benchmark walkthrough on my &lt;a href="https://anyesh.github.io" rel="noopener noreferrer"&gt;learning lab&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://transformer-circuits.pub/2026/workspace/index.html" rel="noopener noreferrer"&gt;The Anthropic paper&lt;/a&gt;, the primary source on J-space and the Jacobian lens&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/anthropics/jacobian-lens" rel="noopener noreferrer"&gt;anthropics/jacobian-lens&lt;/a&gt;, the official lens code, with fitted matrices at &lt;a href="https://huggingface.co/neuronpedia/jacobian-lens" rel="noopener noreferrer"&gt;neuronpedia/jacobian-lens&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/Anyesh/j-space" rel="noopener noreferrer"&gt;j-space&lt;/a&gt;, the offline validation and probe distillation pipeline behind this post&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/Anyesh/EVOKE" rel="noopener noreferrer"&gt;EVOKE&lt;/a&gt;, the runtime that consumes the signal, plus the &lt;a href="https://huggingface.co/spaces/anish-shrestha/evoke-demo" rel="noopener noreferrer"&gt;demo Space&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you work on KV cache compression, long-context inference, or interpretability and want to poke holes in any of this, the repos are public and the gates were registered before the runs. I would genuinely like to know where it breaks.&lt;/p&gt;

</description>
      <category>jspace</category>
      <category>jacobianlens</category>
      <category>interpretability</category>
      <category>kvcache</category>
    </item>
  </channel>
</rss>
