<?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: Disha Patel</title>
    <description>The latest articles on DEV Community by Disha Patel (@dishapatel8).</description>
    <link>https://dev.to/dishapatel8</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%2F3960685%2Ff4c6e07f-1feb-4cc5-b93d-47de885c5855.png</url>
      <title>DEV Community: Disha Patel</title>
      <link>https://dev.to/dishapatel8</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dishapatel8"/>
    <language>en</language>
    <item>
      <title>I Benchmarked 4 Lightweight Transformers for Fault Detection. Here's What Survived.</title>
      <dc:creator>Disha Patel</dc:creator>
      <pubDate>Sun, 31 May 2026 03:36:34 +0000</pubDate>
      <link>https://dev.to/dishapatel8/i-benchmarked-4-lightweight-transformers-for-fault-detection-heres-what-survived-n0g</link>
      <guid>https://dev.to/dishapatel8/i-benchmarked-4-lightweight-transformers-for-fault-detection-heres-what-survived-n0g</guid>
      <description>&lt;p&gt;Everyone talks about deploying ML on edge devices. Very few people show what happens when you actually try.&lt;/p&gt;

&lt;p&gt;I ran a full benchmark of four lightweight transformer models - &lt;strong&gt;DistilBERT, MobileBERT, TinyBERT-6L, and TinyBERT-4L&lt;/strong&gt; — against traditional ML baselines on three real-world fault detection datasets.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Setup
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NASA C-MAPSS&lt;/strong&gt;: Turbofan engine degradation (20,631 samples, 15% failure rate)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SECOM&lt;/strong&gt;: Semiconductor manufacturing (1,567 samples, 6.6% failure rate)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UCI Predictive Maintenance&lt;/strong&gt;: Industrial machine failure (10,000 samples, 3.4% failure rate)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All experiments ran on a T4 GPU with consistent hyperparameters.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Results
&lt;/h2&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;F1&lt;/th&gt;
&lt;th&gt;Size&lt;/th&gt;
&lt;th&gt;CPU Latency&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;XGBoost&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;87.9%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.5 MB&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.002 ms&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TinyBERT-4L&lt;/td&gt;
&lt;td&gt;87.8%&lt;/td&gt;
&lt;td&gt;55 MB&lt;/td&gt;
&lt;td&gt;18 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DistilBERT&lt;/td&gt;
&lt;td&gt;87.6%&lt;/td&gt;
&lt;td&gt;255 MB&lt;/td&gt;
&lt;td&gt;138 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  MobileBERT: The Surprise Failure
&lt;/h2&gt;

&lt;p&gt;MobileBERT — specifically designed for mobile deployment — scored &lt;strong&gt;0% F1 on every dataset&lt;/strong&gt;. It predicted the majority class for every sample across all configurations.&lt;/p&gt;

&lt;p&gt;“Designed for mobile” does not mean “works for your use case.”&lt;/p&gt;




&lt;h2&gt;
  
  
  The Adaptive Pipeline
&lt;/h2&gt;

&lt;p&gt;The most promising result came from combining models:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Quantized &lt;strong&gt;TinyBERT-4L&lt;/strong&gt; handles confident predictions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DistilBERT&lt;/strong&gt; steps in only for uncertain cases&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;87.6% F1&lt;/strong&gt; with &lt;strong&gt;97.9%&lt;/strong&gt; of samples handled by the lightweight model&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;19.5 ms average latency&lt;/strong&gt; instead of 138 ms&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Start with XGBoost&lt;/strong&gt; for tabular data — a 0.5MB model beating 255MB transformers is hard to ignore.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TinyBERT-4L is the edge sweet spot&lt;/strong&gt; — smallest transformer with near-best accuracy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quantize aggressively&lt;/strong&gt; — INT8 cuts size significantly with minimal loss.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use adaptive pipelines&lt;/strong&gt; — route easy predictions through small models, escalate only when needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Class imbalance is still unsolved&lt;/strong&gt; — SECOM remained extremely difficult across all models.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;All code and results:&lt;br&gt;
&lt;a href="https://github.com/disha8611/edge-fault-detection-benchmark" rel="noopener noreferrer"&gt;https://github.com/disha8611/edge-fault-detection-benchmark&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Previous research on LLM-based anomaly detection:&lt;br&gt;
&lt;a href="https://arxiv.org/abs/2604.12218" rel="noopener noreferrer"&gt;https://arxiv.org/abs/2604.12218&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Disha Patel — Software Engineer &amp;amp; ML Researcher. I write about engineering, on-device ML, and building systems that work in the real world.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Tags
&lt;/h2&gt;

&lt;h1&gt;
  
  
  machinelearning #ai #python #benchmark
&lt;/h1&gt;

</description>
      <category>datascience</category>
      <category>deeplearning</category>
      <category>machinelearning</category>
      <category>performance</category>
    </item>
  </channel>
</rss>
