<?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: he fangsheng</title>
    <description>The latest articles on DEV Community by he fangsheng (@he_fangsheng_23597e192e87).</description>
    <link>https://dev.to/he_fangsheng_23597e192e87</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%2F4063608%2Fd2605e5d-bcd2-48b6-86ac-89c8cf23e4ee.png</url>
      <title>DEV Community: he fangsheng</title>
      <link>https://dev.to/he_fangsheng_23597e192e87</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/he_fangsheng_23597e192e87"/>
    <language>en</language>
    <item>
      <title>Vector RAG can't fix long-context state tracking (33 runs, zero variance)</title>
      <dc:creator>he fangsheng</dc:creator>
      <pubDate>Wed, 05 Aug 2026 06:56:54 +0000</pubDate>
      <link>https://dev.to/he_fangsheng_23597e192e87/vector-rag-cant-fix-long-context-state-tracking-33-runs-zero-variance-23e4</link>
      <guid>https://dev.to/he_fangsheng_23597e192e87/vector-rag-cant-fix-long-context-state-tracking-33-runs-zero-variance-23e4</guid>
      <description>&lt;p&gt;There are two different things a model forgets over a long document, and conflating them is why the problem never gets solved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Forgetting the text it wrote.&lt;/strong&gt; RAG fixes this. The text is in the index; retrieve it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Forgetting derived state.&lt;/strong&gt; RAG cannot fix this. After a key changes hands five times across fifty chapters, "who holds it now" is in no passage. Retrieve "black key" and you get five mutually contradictory excerpts, none of which is the current value — because the current value was never written down anywhere.&lt;/p&gt;

&lt;p&gt;The second one is what actually breaks long-form work, and it is structurally not a retrieval problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  The benchmark
&lt;/h2&gt;

&lt;p&gt;Ground truth by construction — the world spec comes first, prose is generated from it, so nothing is hand-annotated. 95k-character baseline, the model continues five chapters and writes state back as explicit fields. Graded field by field.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Arm (qwen-plus, 11 runs each)&lt;/th&gt;
&lt;th&gt;State accuracy&lt;/th&gt;
&lt;th&gt;sd&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;bare model&lt;/td&gt;
&lt;td&gt;75.0%&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;vector RAG&lt;/td&gt;
&lt;td&gt;75.0%&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;state machine&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;98.9%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The zero is the interesting part. Across 33 runs at two baseline lengths, neither control arm ever moved off 75.0%. Same two fields wrong every time. That is a wall, not a gradient.&lt;/p&gt;

&lt;p&gt;And stretching the baseline from 20k to 95k characters made the gap &lt;em&gt;wider&lt;/em&gt; (92.5% → 98.9%) — RAG is precisely the technique that should improve with more context.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;The model never emits a finished artifact. It emits a semantic transaction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"operation"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"append_scene"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"state_changes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"object"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"obj:black-key"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"field"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"holder"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"from"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"char:lin-zheng"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"to"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"char:shen-yan"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"assertions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"zhao-qi-alive"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A deterministic compiler validates it and bounces failures back with evidence. Constraints are data, not code — six general predicates (&lt;code&gt;equals&lt;/code&gt;, &lt;code&gt;not_equals&lt;/code&gt;, &lt;code&gt;contains&lt;/code&gt;, &lt;code&gt;not_contains&lt;/code&gt;, &lt;code&gt;range&lt;/code&gt;, &lt;code&gt;unchanged&lt;/code&gt;), which is why the same compiler drives a narrative world and a sales dataset unmodified.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trade-offs
&lt;/h2&gt;

&lt;p&gt;Prose consistency is statistically indistinguishable from RAG (p=0.99, p=0.34). It costs 25% more tokens. Cross-model validation is still running — I pulled the single-run numbers off the README after ten runs revealed the control arms are bimodal on that model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node compiler/selftest.mjs   &lt;span class="c"&gt;# 27 checks across two domains, no deps, no build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/dongsheng123132/2origin" rel="noopener noreferrer"&gt;https://github.com/dongsheng123132/2origin&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>rag</category>
    </item>
    <item>
      <title>Four Windows bugs that only exist on your customers’ machines</title>
      <dc:creator>he fangsheng</dc:creator>
      <pubDate>Wed, 05 Aug 2026 06:52:43 +0000</pubDate>
      <link>https://dev.to/he_fangsheng_23597e192e87/four-windows-bugs-that-only-exist-on-your-customers-machines-iab</link>
      <guid>https://dev.to/he_fangsheng_23597e192e87/four-windows-bugs-that-only-exist-on-your-customers-machines-iab</guid>
      <description>&lt;p&gt;I ship a Windows installer that sets up Claude Code / Codex CLI / ClawX / Hermes for non-technical users in China. Over ~14 months of real customer machines I collected a pile of failure modes that basically never show up on a developer's laptop, and open-sourced them as a case library.&lt;/p&gt;

&lt;p&gt;A few that cost me the most hours:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Self-update silently did nothing on any machine whose install path contained Chinese characters. The updater wrote a .bat in UTF-8; cmd.exe parses it as GBK. No error, no log, exit code useless (a self-deleting .bat always returns 1).&lt;/li&gt;
&lt;li&gt;An app-wide crash from a one-line helper: tail() sliced a String by byte offset, hit a multi-byte character, panicked — and the release profile is panic=abort, so the whole GUI vanished with no dialog.&lt;/li&gt;
&lt;li&gt;"The model is listed in /v1/models" is not the same as "the model answers". Two model ids that enumerated fine returned 0/4 and 503 respectively.&lt;/li&gt;
&lt;li&gt;taskkill /IM Claude.exe, intended to close the Claude desktop app, also kills every Claude Code CLI session on the box — same image name.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Repo (MIT, no telemetry, nothing to install): &lt;a href="https://github.com/dongsheng123132/u-rescue" rel="noopener noreferrer"&gt;https://github.com/dongsheng123132/u-rescue&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The product itself is closed-source and Windows-only, so I'm not pitching it here — the cases are the useful part. Corrections welcome, especially if you've hit the GBK/UTF-8 one on a different toolchain.&lt;/p&gt;

</description>
      <category>debugging</category>
      <category>programming</category>
      <category>software</category>
    </item>
  </channel>
</rss>
