<?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: Ven Iyer</title>
    <description>The latest articles on DEV Community by Ven Iyer (@veniyer).</description>
    <link>https://dev.to/veniyer</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3789866%2F2bb92981-9781-4d5f-80fe-22359055a33e.png</url>
      <title>DEV Community: Ven Iyer</title>
      <link>https://dev.to/veniyer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/veniyer"/>
    <language>en</language>
    <item>
      <title>I stopped calling GPT-4 for the same classification task 10,000 times</title>
      <dc:creator>Ven Iyer</dc:creator>
      <pubDate>Tue, 24 Feb 2026 15:58:25 +0000</pubDate>
      <link>https://dev.to/veniyer/i-stopped-calling-gpt-4-for-the-same-classification-task-10000-times-43b6</link>
      <guid>https://dev.to/veniyer/i-stopped-calling-gpt-4-for-the-same-classification-task-10000-times-43b6</guid>
      <description>&lt;p&gt;I kept running into the same pattern building internal tools: calling an LLM API thousands of times with the same prompt template, just swapping in different text.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Classify this contract clause&lt;/li&gt;
&lt;li&gt;Route this support ticket&lt;/li&gt;
&lt;li&gt;Categorize this log line&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Same task. Different input. Over and over.&lt;/p&gt;

&lt;p&gt;Two problems kept coming up:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sensitivity.&lt;/strong&gt; For teams handling contracts, patient records, or internal logs, sending that data to a third-party API isn't always an option.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cost.&lt;/strong&gt; At scale, you're paying per-token for what is essentially structured pattern matching.&lt;/p&gt;

&lt;p&gt;So I built an open-source CLI that trains a small local text classifier from labeled examples. You give it ~50 input/output pairs, it trains a ~230KB model on your machine, and you run inference locally. No network calls, ever.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it looks like
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; expressible

expressible distill init clause-detector
&lt;span class="nb"&gt;cd &lt;/span&gt;clause-detector
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add some labeled examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;expressible distill add &lt;span class="nt"&gt;--file&lt;/span&gt; ./labeled-clauses.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The JSON is just an array of &lt;code&gt;{ "input": "...", "output": "..." }&lt;/code&gt; objects — 50 or so pairs.&lt;/p&gt;

&lt;p&gt;Train:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;expressible distill train
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Training Complete
  Samples              87
  Validation accuracy  93.2%
  Time elapsed         2.8s

✓ Model saved to model/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;expressible distill run &lt;span class="s2"&gt;"Either party may terminate this Agreement at any time
  for any reason by providing 90 days written notice"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;"output"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"termination-for-convenience"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"confidence"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.94&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;That ran locally. No API call. The text never left the machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works under the hood
&lt;/h2&gt;

&lt;p&gt;Distill uses &lt;a href="https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2" rel="noopener noreferrer"&gt;all-MiniLM-L6-v2&lt;/a&gt;, a sentence embedding model that runs locally. It converts text into 384-dimensional vectors that capture semantic meaning. A small two-layer neural network trained on your labeled examples learns to map those vectors to your categories.&lt;/p&gt;

&lt;p&gt;The embedding model downloads once (~80MB) and is cached. Everything after that is fully offline.&lt;/p&gt;

&lt;p&gt;No Python. No GPU. No Docker. Just Node.js 18+.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it works well and where it doesn't
&lt;/h2&gt;

&lt;p&gt;This was important for me to document honestly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Works well (80–95% accuracy):&lt;/strong&gt; Topic and domain classification — tasks where the categories are &lt;em&gt;about&lt;/em&gt; different things. Support tickets about billing vs shipping. News about sports vs politics. Contract clauses about indemnification vs non-compete.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Struggles (44–50% accuracy):&lt;/strong&gt; Sentiment and tone. "This camera takes amazing photos" and "This camera takes terrible photos" produce nearly identical embedding vectors — same topic, same structure. The model can't tell them apart because the embeddings capture what text is &lt;em&gt;about&lt;/em&gt;, not how it &lt;em&gt;evaluates&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;This is a fundamental limitation of the embedding approach, and I documented it openly in the &lt;a href="https://github.com/expressibleai/expressible-cli/blob/main/docs/benchmarks.md" rel="noopener noreferrer"&gt;benchmarks&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benchmarks
&lt;/h2&gt;

&lt;p&gt;All benchmarks use 50 training examples — roughly 30 minutes of labeling work:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;Accuracy&lt;/th&gt;
&lt;th&gt;Data Source&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Support ticket routing (4 categories)&lt;/td&gt;
&lt;td&gt;95.0%&lt;/td&gt;
&lt;td&gt;Synthetic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Content moderation (3 categories)&lt;/td&gt;
&lt;td&gt;90.0%&lt;/td&gt;
&lt;td&gt;Synthetic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;News categorization (5 categories)&lt;/td&gt;
&lt;td&gt;88.0%&lt;/td&gt;
&lt;td&gt;Synthetic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;20 Newsgroups (5 categories)&lt;/td&gt;
&lt;td&gt;80.0%&lt;/td&gt;
&lt;td&gt;Public dataset&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AG News (4 categories)&lt;/td&gt;
&lt;td&gt;64.0%&lt;/td&gt;
&lt;td&gt;Public dataset&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The public dataset results use real-world text from datasets with 120,000+ entries — we only used 50 training samples from each. AG News improves to 80% with 100 samples.&lt;/p&gt;

&lt;p&gt;You can reproduce every number:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/expressibleai/expressible-cli.git
&lt;span class="nb"&gt;cd &lt;/span&gt;expressible-cli
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npx tsx tests/harness/run.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The review-retrain loop
&lt;/h2&gt;

&lt;p&gt;This is where it gets practical. After training, you can review predictions through a local web UI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;expressible distill review
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Correct mistakes, approve good results, then retrain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;expressible distill retrain
&lt;span class="c"&gt;# → Previous accuracy: 89% → New accuracy: 94%&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your accuracy improves iteratively as you catch edge cases the model gets wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to use this instead of an LLM
&lt;/h2&gt;

&lt;p&gt;This is &lt;strong&gt;not&lt;/strong&gt; a replacement for LLMs. It's specifically for the repetitive, pattern-based subset of LLM calls — the ones where the same prompt template processes different data every time.&lt;/p&gt;

&lt;p&gt;If your task requires reasoning, creativity, or open-ended generation, use an LLM. If you're classifying thousands of inputs into the same N categories, a 230KB local model might be enough.&lt;/p&gt;

&lt;h2&gt;
  
  
  Everything stays local
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Training data never leaves your filesystem&lt;/li&gt;
&lt;li&gt;The embedding model runs locally&lt;/li&gt;
&lt;li&gt;Trained models are files you own&lt;/li&gt;
&lt;li&gt;Zero telemetry, zero analytics, zero phone-home&lt;/li&gt;
&lt;li&gt;Export to standalone &lt;code&gt;inference.js&lt;/code&gt; + model files for production&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/expressibleai/expressible-cli" rel="noopener noreferrer"&gt;github.com/expressibleai/expressible-cli&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Benchmarks:&lt;/strong&gt; &lt;a href="https://github.com/expressibleai/expressible-cli/blob/main/docs/benchmarks.md" rel="noopener noreferrer"&gt;docs/benchmarks.md&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;License:&lt;/strong&gt; Apache 2.0&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Still early. I'd genuinely appreciate feedback on the approach — especially if you've tried similar embedding + classifier patterns in your own workflows, or if multi-label classification would be useful for your use case.&lt;/p&gt;

</description>
      <category>cli</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
