<?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: Wane Hong</title>
    <description>The latest articles on DEV Community by Wane Hong (@wane_hong_ff200a8f78f5d46).</description>
    <link>https://dev.to/wane_hong_ff200a8f78f5d46</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%2F4058164%2F504f4482-e2e0-4a84-8bfd-d1aa9632e2b0.png</url>
      <title>DEV Community: Wane Hong</title>
      <link>https://dev.to/wane_hong_ff200a8f78f5d46</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wane_hong_ff200a8f78f5d46"/>
    <language>en</language>
    <item>
      <title>Your agent's failed traces are wasted fine-tuning data</title>
      <dc:creator>Wane Hong</dc:creator>
      <pubDate>Sat, 01 Aug 2026 15:30:57 +0000</pubDate>
      <link>https://dev.to/wane_hong_ff200a8f78f5d46/your-agents-failed-traces-are-wasted-fine-tuning-data-1gej</link>
      <guid>https://dev.to/wane_hong_ff200a8f78f5d46/your-agents-failed-traces-are-wasted-fine-tuning-data-1gej</guid>
      <description>&lt;p&gt;I kept noticing the same thing while building agents: when the agent screws up —&lt;br&gt;
picks the wrong tool, sends bad arguments, over-refuses something harmless — that&lt;br&gt;
failure is genuinely useful. It's a concrete example of my model doing the wrong&lt;br&gt;
thing, which is exactly what I'd want to fine-tune away.&lt;/p&gt;

&lt;p&gt;And then it just... sits in the logs. Buried in LangSmith/Langfuse exports, mixed&lt;br&gt;
with retries and PII and duplicates, annoying enough to clean up that I never did.&lt;/p&gt;

&lt;p&gt;So I made a small tool for it: &lt;strong&gt;&lt;a href="https://github.com/wane528/trace2train" rel="noopener noreferrer"&gt;trace2train&lt;/a&gt;&lt;/strong&gt;.&lt;br&gt;
It's a local CLI (no server, no account) that turns failed agent traces into SFT/DPO&lt;br&gt;
training data. Sharing it here in case it's useful to anyone else, and because I'd&lt;br&gt;
like feedback.&lt;/p&gt;
&lt;h2&gt;
  
  
  The quick version
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;trace2train
&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;trace2train inspect &lt;span class="nt"&gt;--demo&lt;/span&gt;
&lt;span class="go"&gt;
19 traces → 16 failed → 38% dirty (PII/dupes/noise) → 14 trainable

failure types (trainable):
  wrong_tool        8
  bad_args          2
  over_refusal      2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;inspect&lt;/code&gt; is just rules — no LLM, no API key. It tells you how much of your log&lt;br&gt;
is actually usable &lt;em&gt;before&lt;/em&gt; you pay for anything. Then &lt;code&gt;convert&lt;/code&gt; turns the usable&lt;br&gt;
failures into LLaMA-Factory-ready JSONL.&lt;/p&gt;
&lt;h2&gt;
  
  
  A concrete example
&lt;/h2&gt;

&lt;p&gt;Here's a failure from the bundled demo. The agent has a &lt;code&gt;get_weather&lt;/code&gt; tool but&lt;br&gt;
reaches for &lt;code&gt;calculator&lt;/code&gt; instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user:      What's the weather in Berlin?
assistant: [tool_call] calculator(expr="weather Berlin")
tool:      {"error": "invalid expression"}
assistant: I got 42.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;wrong_tool&lt;/code&gt; — and the right fix is obvious from the trace (it should have called&lt;br&gt;
&lt;code&gt;get_weather&lt;/code&gt;). So &lt;code&gt;convert&lt;/code&gt; can turn it into a training pair:&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;"conversations"&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="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;"human"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"What's the weather in Berlin?"&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="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;"gpt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"[tool_call] get_weather(city=&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Berlin&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&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="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;Every record also carries provenance (source trace, original error, why it was&lt;br&gt;
corrected) so the output isn't a black box.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one design choice I actually care about
&lt;/h2&gt;

&lt;p&gt;Most "turn your logs into training data" tools are &lt;em&gt;eager&lt;/em&gt; — they'll happily&lt;br&gt;
generate a confident answer for every failure so the row count looks big.&lt;/p&gt;

&lt;p&gt;trace2train doesn't. It only writes a corrected sample when &lt;strong&gt;the right answer is&lt;br&gt;
actually derivable from the trace.&lt;/strong&gt; If the failure is "did the code pass its&lt;br&gt;
tests?" or "is this fact true?" — things the trace can't confirm — it marks them&lt;br&gt;
&lt;code&gt;skipped&lt;/code&gt; instead of inventing something.&lt;/p&gt;

&lt;p&gt;The reason is simple: a dataset full of confident-but-wrong "corrections" is worse&lt;br&gt;
than no dataset. I'd rather hand you 7 pairs you can trust and 1 honest skip than&lt;br&gt;
8 rows you can't.&lt;/p&gt;

&lt;p&gt;That's the whole personality of the tool, really.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other bits that came from actually using it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;PII redaction, dedup, and eval-set leak filtering are built in&lt;/li&gt;
&lt;li&gt;one LLM call per trace (cheap — DeepSeek by default, any OpenAI-compatible API works)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--review&lt;/code&gt; to approve/reject each sample by hand before it's written&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--resume&lt;/code&gt; so a rate-limited re-run doesn't re-pay for calls you already made&lt;/li&gt;
&lt;li&gt;a health check that warns if your set is 90% one failure type (it'll just overfit)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Inputs today: LangSmith JSONL, a generic messages format, and Langfuse v4 snapshots.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;trace2train
trace2train inspect &lt;span class="nt"&gt;--demo&lt;/span&gt;               &lt;span class="c"&gt;# 30s, no data or key needed&lt;/span&gt;
trace2train convert &lt;span class="nt"&gt;--demo&lt;/span&gt; &lt;span class="nt"&gt;--no-llm&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; out
trace2train review &lt;span class="nt"&gt;-o&lt;/span&gt; out
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Honest status
&lt;/h2&gt;

&lt;p&gt;It's an early v0.1. I've validated it on a small slice of a public dataset and an&lt;br&gt;
end-to-end Langfuse run on synthetic data — that's it. Not a benchmark, not an&lt;br&gt;
accuracy claim. (Pretending otherwise would kind of defeat the whole "don't make&lt;br&gt;
things up" premise.)&lt;/p&gt;

&lt;p&gt;What I'd love feedback on: the failure-detection rules — what am I missing? — and&lt;br&gt;
what trace sources you'd want supported next.&lt;/p&gt;

&lt;p&gt;Repo: &lt;strong&gt;&lt;a href="https://github.com/wane528/trace2train" rel="noopener noreferrer"&gt;https://github.com/wane528/trace2train&lt;/a&gt;&lt;/strong&gt; (MIT). If you try it on real&lt;br&gt;
traces, I'd genuinely like to hear how it went.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>cli</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
