<?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: Muhammed Shafin P</title>
    <description>The latest articles on DEV Community by Muhammed Shafin P (@hejhdiss).</description>
    <link>https://dev.to/hejhdiss</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%2F3202400%2Fcadd1e3f-cab3-4084-8a09-ebaa09292ff1.png</url>
      <title>DEV Community: Muhammed Shafin P</title>
      <link>https://dev.to/hejhdiss</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hejhdiss"/>
    <language>en</language>
    <item>
      <title>India Is Collapsing — And Why It Affects the Tech Industry</title>
      <dc:creator>Muhammed Shafin P</dc:creator>
      <pubDate>Sun, 08 Mar 2026 12:26:38 +0000</pubDate>
      <link>https://dev.to/hejhdiss/india-is-collapsing-and-why-it-affects-the-tech-industry-1kd7</link>
      <guid>https://dev.to/hejhdiss/india-is-collapsing-and-why-it-affects-the-tech-industry-1kd7</guid>
      <description>&lt;p&gt;&lt;strong&gt;GitHub repo:&lt;/strong&gt; &lt;a href="https://github.com/hejhdiss/Truth-Of-India" rel="noopener noreferrer"&gt;github.com/hejhdiss/Truth-Of-India&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Live site:&lt;/strong&gt; &lt;a href="https://truthofindia.hejhdiss.workers.dev/" rel="noopener noreferrer"&gt;https://truthofindia.hejhdiss.workers.dev/&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;You might be wondering what a collection of investigative articles about Indian politics is doing on a tech platform.&lt;/p&gt;

&lt;p&gt;Fair question. Here is the honest answer: &lt;strong&gt;this affects you directly — if you are a developer, startup founder, investor, or anyone building something in or with India.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  India Shut Down the Internet More Than Any Country on Earth — Five Years Running
&lt;/h2&gt;

&lt;p&gt;India is the world's largest democracy. It is also the world's number one executor of internet shutdowns, five consecutive years in a row. In 2022 alone, India was responsible for &lt;strong&gt;84 of the 187 internet shutdowns recorded globally&lt;/strong&gt; — nearly half the world's total. A peer-reviewed study published in the journal &lt;em&gt;Democratization&lt;/em&gt; found this is not politically neutral: shutdowns are &lt;strong&gt;3.5 times more frequent in BJP-governed states&lt;/strong&gt; than in others.&lt;/p&gt;

&lt;p&gt;Every time the internet goes down in a region, developers lose working hours, remote workers lose income, startups lose transactions, and businesses lose customers. The Kashmir Chamber of Commerce estimated &lt;strong&gt;500,000 people lost their jobs&lt;/strong&gt; during a single 2019 shutdown.&lt;/p&gt;

&lt;p&gt;India's own Parliamentary Standing Committee called this "gross misuse causing untold suffering." The government's response? It told Parliament it does not even keep central records of shutdowns.&lt;/p&gt;

&lt;p&gt;If you are building a product that serves Indian users — or building &lt;em&gt;in&lt;/em&gt; India — this is your infrastructure risk. It is not theoretical. It has a dollar cost: &lt;strong&gt;$184 million in economic damage in 2022 alone&lt;/strong&gt;, and that is a documented undercount.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This Is Being Posted on a Tech Site — And Why It Affects the Industry
&lt;/h2&gt;

&lt;p&gt;Foreign Direct Investment into India fell from $10.1 billion to $353 million in FY2025 — a &lt;strong&gt;96.5% collapse&lt;/strong&gt;. Startup funding dropped 62%. Fintech funding dropped 63%. Indian startups raised $30.4 billion in 2024. Chinese firms raised $845 billion in a comparable period.&lt;/p&gt;

&lt;p&gt;This does not happen in a vacuum. It happens when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tech companies face police raids for refusing government censorship orders&lt;/li&gt;
&lt;li&gt;IIM and IIT directors resign over political interference in academic leadership&lt;/li&gt;
&lt;li&gt;Research funding is redirected to government-approved topics while independent inquiry is defunded&lt;/li&gt;
&lt;li&gt;The rule of law is applied selectively based on political loyalty&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The innovation pipeline — the universities, research labs, and free intellectual environment that produces your next engineer, your next founder, your next breakthrough — is being systematically hollowed out. When the RSS directs PhD thesis topics and university seminars on democracy get cancelled, the damage shows up years later in the talent pool that never existed.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why I Built This — And Why I'm Sharing It Here
&lt;/h2&gt;

&lt;p&gt;I am Muhammed Shafin P, from Malappuram, Kerala. I am not a journalist. I am a developer and an Indian citizen who spent time reading publicly available government data, Supreme Court records, NCRB statistics, and international reporting — and could not look away from what the numbers said.&lt;/p&gt;

&lt;p&gt;I built &lt;a href="https://truthofindia.netlify.app/" rel="noopener noreferrer"&gt;truthofindia.netlify.app&lt;/a&gt; as a simple static site: one &lt;code&gt;index.html&lt;/code&gt;, ten &lt;code&gt;.md&lt;/code&gt; files, deployed on Netlify. The entire repo is open: &lt;a href="https://github.com/hejhdiss/Truth-Of-India" rel="noopener noreferrer"&gt;github.com/hejhdiss/Truth-Of-India&lt;/a&gt;. The architecture is deliberately simple so anyone can fork it, translate it, or mirror it.&lt;/p&gt;

&lt;p&gt;The site covers ten documented topics: farmer suicides, electoral corruption, violence against minorities, children's malnutrition, digital censorship — and yes, Palestine. I included Palestine specifically because a significant number of Indians have been fed a manufactured narrative that frames the conflict as religious rather than political. Many Indians — including many in tech communities — repeat pro-Israel talking points without knowing the documented history of the Nakba, the termination of 200,000 Palestinian work permits after October 7, or the fact that Indian workers were sent to fill those jobs at Netanyahu's personal request to Modi. These are not opinions. They are documented facts in publicly available sources, and Indian citizens deserve to know them.&lt;/p&gt;

&lt;p&gt;India is the world's largest population. What happens to Indian democracy, Indian sovereignty, and Indian civil society does not stay inside India's borders. It shapes global tech supply chains, global startup ecosystems, and global politics.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Am Asking
&lt;/h2&gt;

&lt;p&gt;Nothing expensive. Just this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Read it. Share it. Fork it if you want.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every article has its sources listed. Every claim is verifiable. If you find something wrong, say so — the whole point is that people think for themselves based on actual evidence.&lt;/p&gt;

&lt;p&gt;There are hundreds of millions of Indians — including tens of millions in tech — who have never seen this information laid out in one place, clearly sourced. The BJP's media ecosystem is enormous. This site is small. But the internet is still (for now) on.&lt;/p&gt;

&lt;p&gt;If even a few thousand more people read this and ask harder questions of the people asking for their votes, their taxes, and their silence — that is worth every line of code.&lt;/p&gt;




&lt;h2&gt;
  
  
  Hosting Change — Netlify → Cloudflare Workers
&lt;/h2&gt;

&lt;p&gt;This project was previously hosted on &lt;strong&gt;Netlify&lt;/strong&gt; (free tier). The Netlify deployment served the article &lt;code&gt;.md&lt;/code&gt; files as static assets directly alongside &lt;code&gt;index.html&lt;/code&gt; — the frontend fetched them at runtime using &lt;code&gt;fetch('filename.md')&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The free tier bandwidth limit was hit due to reader traffic, so the site has been migrated to &lt;strong&gt;Cloudflare Workers&lt;/strong&gt; (free tier), which has no bandwidth cap.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Changed for &lt;code&gt;.md&lt;/code&gt; Files
&lt;/h3&gt;

&lt;p&gt;On Netlify, &lt;code&gt;.md&lt;/code&gt; article files (e.g. &lt;code&gt;betrayal-of-palastenians.md&lt;/code&gt;, &lt;code&gt;south-india-vs-rss-brainwash.md&lt;/code&gt;) were deployed as plain static files and fetched directly by the browser.&lt;/p&gt;

&lt;p&gt;On Cloudflare Workers, static files must be explicitly bundled and served through the Worker script. Each &lt;code&gt;.md&lt;/code&gt; file is included as part of the Worker's assets so the &lt;code&gt;fetch()&lt;/code&gt; calls in &lt;code&gt;index.html&lt;/code&gt; continue to work without any changes to the frontend code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Cloudflare
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;No bandwidth limits on the free tier&lt;/li&gt;
&lt;li&gt;Global CDN edge delivery&lt;/li&gt;
&lt;li&gt;Cloudflare's free tier handles high-traffic sites without throttling or suspension&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - Zero config changes needed on the &lt;code&gt;index.html&lt;/code&gt; side — the &lt;code&gt;.md&lt;/code&gt; fetch logic remains identical
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;All articles are based on publicly verifiable sources: NCRB data, Supreme Court records, peer-reviewed research, UN reports, and internationally published journalism. Everything can be checked independently. That is the point.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written by Muhammed Shafin P (hejhdiss) · Malappuram, Kerala · &lt;a href="mailto:hejhdiss@gmail.com"&gt;hejhdiss@gmail.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>startup</category>
      <category>india</category>
      <category>techindustry</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Thinking Transformers: A Transformer That Reasons Before It Speaksking Transformer</title>
      <dc:creator>Muhammed Shafin P</dc:creator>
      <pubDate>Fri, 06 Mar 2026 09:20:09 +0000</pubDate>
      <link>https://dev.to/hejhdiss/thinking-transformer-4ak9</link>
      <guid>https://dev.to/hejhdiss/thinking-transformer-4ak9</guid>
      <description>&lt;p&gt;Most neural language models work the same way: take in a sequence of tokens, run one forward pass, and spit out a prediction. It's fast, it's well understood, and for many tasks it works well. But there's something fundamentally rushed about it — the model has exactly one shot to "think" before it answers, no matter how hard the problem is.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thinking Transformers&lt;/strong&gt; takes a different approach. Before producing any output, the model runs its hidden states through the full transformer stack multiple times — these are called &lt;em&gt;think steps&lt;/em&gt;. Each pass lets the model refine its internal representation, catch contradictions, and build up a richer picture of the input before committing to an answer. The number of think steps is configurable, and crucially, every one of them is part of the computation graph — training uses full Backpropagation Through Time (BPTT) across all think steps and all layers simultaneously. The model doesn't just learn to predict; it learns &lt;em&gt;how&lt;/em&gt; to think.&lt;/p&gt;

&lt;p&gt;Alongside the reasoning loop, the architecture includes a small gated memory bank — a set of persistent slots that are read from and written to at each think step. This gives the model a lightweight working memory that can carry context forward across iterations, something a standard single-pass transformer simply cannot do.&lt;/p&gt;

&lt;p&gt;The whole thing is built from scratch in plain C with no external dependencies beyond &lt;code&gt;libm&lt;/code&gt;. It compiles into a shared library (&lt;code&gt;transformer.so&lt;/code&gt; on Linux/macOS, &lt;code&gt;transformer.dll&lt;/code&gt; on Windows) in a single GCC command. The Python layer wraps this library via &lt;code&gt;ctypes&lt;/code&gt;, exposing a clean, minimal API through two classes: &lt;code&gt;TransformerConfig&lt;/code&gt;, which holds all architecture hyperparameters (vocab size, embedding dimension, number of heads, feed-forward width, layers, sequence length, think steps, memory slots), and &lt;code&gt;ThinkingTransformer&lt;/code&gt;, which is the model itself.&lt;/p&gt;

&lt;p&gt;The Python API is deliberately straightforward. You call &lt;code&gt;model.train_step(tokens, targets, lr)&lt;/code&gt; for a single training iteration — it handles zeroing gradients, running the full BPTT backward pass, and applying an Adam update internally. For more control, &lt;code&gt;zero_grad()&lt;/code&gt;, &lt;code&gt;backward()&lt;/code&gt;, and &lt;code&gt;step()&lt;/code&gt; are all exposed separately. Inference is equally simple: &lt;code&gt;model.generate(prompt, max_new_tokens)&lt;/code&gt; does greedy decoding, while &lt;code&gt;model.generate_with_thinking(prompt)&lt;/code&gt; wraps the prompt in explicit &lt;code&gt;THINK&lt;/code&gt; and &lt;code&gt;PLAN&lt;/code&gt; tokens and returns not just the output tokens but the full reasoning structure and logits. Checkpoints save and load cleanly with &lt;code&gt;model.save(path)&lt;/code&gt; and &lt;code&gt;model.load(path)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Everything — architecture, training, and the reasoning loop — is open source and available at &lt;strong&gt;&lt;a href="https://github.com/hejhdiss/Thinking-Transformers" rel="noopener noreferrer"&gt;https://github.com/hejhdiss/Thinking-Transformers&lt;/a&gt;&lt;/strong&gt;. The project is licensed under GNU GPL v3.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>deeplearning</category>
      <category>llm</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>CodeLearn AI: Learn by Building</title>
      <dc:creator>Muhammed Shafin P</dc:creator>
      <pubDate>Wed, 04 Mar 2026 08:29:01 +0000</pubDate>
      <link>https://dev.to/hejhdiss/codelearn-ai-learn-by-building-9n9</link>
      <guid>https://dev.to/hejhdiss/codelearn-ai-learn-by-building-9n9</guid>
      <description>&lt;p&gt;&lt;a href="https://codelearnai.netlify.app/" rel="noopener noreferrer"&gt;CodeLearn AI&lt;/a&gt; is an innovative, AI-powered educational platform designed to help users master programming through a hands-on, "Learn by Building" approach. Created by developer hejhdiss, the platform integrates modern AI capabilities directly into a coding environment to provide real-time assistance, explanations, and interactive learning tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is CodeLearn AI?
&lt;/h2&gt;

&lt;p&gt;CodeLearn AI is a comprehensive coding playground and tutor that leverages Large Language Models (LLMs) to guide users through the development process. It serves as an all-in-one workspace where you can write code, chat with an AI assistant, and track your learning progress through a gamified interface.&lt;/p&gt;

&lt;p&gt;The platform is highly customizable, allowing users to connect their own AI providers such as OpenAI, Anthropic, Google Gemini, or even local models via Ollama.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AI Chat System:&lt;/strong&gt; Includes a "Global Chat" for general inquiries and "Project Chats" specifically tailored to the context of your current coding project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Integrated Code Editor:&lt;/strong&gt; A built-in editor that supports multiple programming languages and stacks, allowing you to build and manage files within the browser.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Live Preview:&lt;/strong&gt; For web projects (HTML/CSS/JS), the platform offers a real-time preview mode to see your changes instantly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Gamified Learning:&lt;/strong&gt; Tracks your progress using an XP (Experience Points) system, levels, and skill bars that visualize your proficiency in different technologies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AI-Powered Code Analysis:&lt;/strong&gt; Features tools to "Explain" specific files, "Optimize Code," and generate context-aware tips to improve your build.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Interactive Quizzes:&lt;/strong&gt; Automatically generates quizzes based on your code or specific topics to test and reinforce your knowledge.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Modern UI:&lt;/strong&gt; Offers a sleek, responsive interface with both Dark and Light theme options to suit your coding preference.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is it for?
&lt;/h2&gt;

&lt;p&gt;The primary goal of CodeLearn AI is to lower the barrier to entry for new programmers while providing a powerful sandbox for experienced developers to experiment with AI-driven development. It is designed for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Beginners&lt;/strong&gt; who need clear explanations of complex code structures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Students&lt;/strong&gt; who want to test their knowledge via AI-generated quizzes and track their skill growth.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Developers&lt;/strong&gt; looking for a quick, AI-integrated environment to prototype ideas and optimize snippets.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By combining an editor, a chat assistant, and a gamified progression system, CodeLearn AI turns the solitary act of coding into an interactive, guided experience.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>discuss</category>
      <category>learning</category>
      <category>programming</category>
    </item>
    <item>
      <title>Qeltrix V6 — A Practical Guide to Seekable Encrypted Containers</title>
      <dc:creator>Muhammed Shafin P</dc:creator>
      <pubDate>Mon, 02 Mar 2026 07:12:32 +0000</pubDate>
      <link>https://dev.to/hejhdiss/qeltrix-v6-a-practical-guide-to-seekable-encrypted-containers-3fl6</link>
      <guid>https://dev.to/hejhdiss/qeltrix-v6-a-practical-guide-to-seekable-encrypted-containers-3fl6</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Full interactive documentation:&lt;/strong&gt; &lt;a href="https://qeltrix-v6.hejhdiss.workers.dev/" rel="noopener noreferrer"&gt;https://qeltrix-v6.hejhdiss.workers.dev/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What Is Qeltrix V6?
&lt;/h2&gt;

&lt;p&gt;Most encryption tools work the same way they did decades ago. You hand over a file, it gets locked, and to read a single byte of it you must decrypt the whole thing first. Seeking through an encrypted video file meant downloading the entire thing. Extracting a single log entry from a 500 GB encrypted backup meant unpacking the whole archive.&lt;/p&gt;

&lt;p&gt;Qeltrix V6 is a new encrypted container format that throws out that assumption. It is built around one core idea: an encrypted file should behave like a seekable stream, not a locked safe. You should be able to jump to any position, request any byte range, and receive exactly those bytes — decrypted — without the system touching anything else.&lt;/p&gt;

&lt;p&gt;The full technical documentation, CLI reference, Python API guide, deployment patterns, and security analysis live at &lt;a href="https://qeltrix-v6.netlify.app/" rel="noopener noreferrer"&gt;qeltrix-v6.netlify.app&lt;/a&gt;. This article explains the ideas behind it and why they matter.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Core Idea: Independent Blocks
&lt;/h2&gt;

&lt;p&gt;The reason traditional encryption can't be seeked is that it treats the entire file as one object. Decrypt the end of the file and you've necessarily processed everything before it.&lt;/p&gt;

&lt;p&gt;V6 takes a different approach. Every file is split into fixed-size blocks — 1 MB by default — and each block is encrypted &lt;em&gt;independently&lt;/em&gt; with its own unique key, its own IV, its own authentication tag. The blocks are then packed into a &lt;code&gt;.qltx&lt;/code&gt; container with a footer index that maps original byte offsets to block positions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Traditional:  [  one big encrypted blob — all or nothing  ]

Qeltrix V6:   [ Header ] [ Block 0 ] [ Block 1 ] ... [ Block N ] [ Footer/Index ]
                          each block independently encrypted + authenticated
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This changes what seeking costs. Instead of "decrypt everything up to the point you want," the cost becomes "look up the block containing your byte offset in the footer index, decrypt that block, slice out the bytes you need." For a 20 GB video, seeking to the 18-minute mark might decrypt two or three blocks — a few megabytes — instead of gigabytes.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Key Hierarchy
&lt;/h2&gt;

&lt;p&gt;The encryption design uses two layers of keys. Understanding both is important for understanding what V6 actually protects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Master Key (MK)&lt;/strong&gt; is a 32-byte symmetric secret that acts as the root of trust for the entire container. It is never written to disk in plaintext. The container header stores an encrypted copy of it (wrapped with a passphrase-derived key), but that wrapped blob is useless without the passphrase. Every operation that touches the container — packing, unpacking, seeking, serving — requires the caller to supply the MK at runtime.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Content Derived Keys (CDKs)&lt;/strong&gt; are per-block keys derived from the MK using HKDF-SHA256. Each CDK is derived from a combination of the master key, the block's sequential index, a SHA-256 hash of the block's raw content, and a random salt. This dual binding — to both &lt;em&gt;position&lt;/em&gt; and &lt;em&gt;content&lt;/em&gt; — has a meaningful security consequence: two identical blocks at different positions will have different keys, and if a block is moved to a different position without re-encryption, authentication will fail. The system detects it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Passphrase
    ↓  PBKDF2-SHA256
Master Key (MK)
    ↓  HKDF-SHA256 + block_index + data_hash + salt
CDK for Block N                 CDK for Block M
    ↓  AES-256-GCM or ChaCha20-Poly1305
Encrypted Block N               Encrypted Block M
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Critically, compromising one block's CDK reveals nothing about any other block's key. The CDKs are mathematically independent.&lt;/p&gt;




&lt;h2&gt;
  
  
  What the V6-C Metadata Actually Is
&lt;/h2&gt;

&lt;p&gt;Each block in a &lt;code&gt;.qltx&lt;/code&gt; container carries a structure called &lt;strong&gt;V6-C metadata&lt;/strong&gt; alongside the ciphertext. This metadata holds everything needed to independently decrypt and verify that one block:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The per-block IV (nonce for the AEAD cipher)&lt;/li&gt;
&lt;li&gt;The HKDF salt used to derive this block's CDK&lt;/li&gt;
&lt;li&gt;The SHA-256 hash of the block's original (unencrypted) content&lt;/li&gt;
&lt;li&gt;The CDK itself, wrapped (re-encrypted) with the master key&lt;/li&gt;
&lt;li&gt;The cipher identifier (AES-GCM or ChaCha20)&lt;/li&gt;
&lt;li&gt;The original and compressed block sizes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The V6-C metadata is itself encrypted with the master key. This means that without the MK, you can't even learn anything about the block's internal structure — the IV, the salt, and the content hash are all opaque to an observer who doesn't hold the key.&lt;/p&gt;

&lt;p&gt;This is what makes the container format genuinely seekable without compromising security: each block is a self-contained, independently verifiable unit, and the footer index is the table of contents that maps byte offsets to those units.&lt;/p&gt;




&lt;h2&gt;
  
  
  Cipher Choices: AES-256-GCM and ChaCha20-Poly1305
&lt;/h2&gt;

&lt;p&gt;V6 supports two AEAD ciphers, and the choice matters depending on your hardware.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AES-256-GCM&lt;/strong&gt; is the default. On any CPU with AES hardware acceleration (AES-NI instructions, present in virtually all processors manufactured after 2010), it runs at several gigabytes per second. If you're deploying on modern server or desktop hardware, this is almost certainly the right choice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ChaCha20-Poly1305&lt;/strong&gt; is the mobile-friendly alternative. It was designed to be fast in pure software, without hardware acceleration. On IoT devices, older ARM processors, or embedded systems where AES-NI isn't available, ChaCha20 can be meaningfully faster. It provides the same security guarantees — 256-bit keys, 16-byte AEAD authentication tags, identical tamper-detection properties.&lt;/p&gt;

&lt;p&gt;Both ciphers authenticate every block with a 16-byte tag. Any modification to any byte of any block — even flipping a single bit — causes the authentication check to fail and decryption to abort with an error. This tamper-evidence is not a separate step or an add-on; it is baked into the encryption itself.&lt;/p&gt;




&lt;h2&gt;
  
  
  HTTP Range Requests: Seeking Over the Network
&lt;/h2&gt;

&lt;p&gt;The most practically significant feature of V6 is its native HTTP Range Request support. Range Requests are the mechanism that allows you to seek in a YouTube video without buffering from the beginning — your browser sends a request for &lt;code&gt;bytes=50000000-60000000&lt;/code&gt; and the server returns just those bytes with a &lt;code&gt;206 Partial Content&lt;/code&gt; response.&lt;/p&gt;

&lt;p&gt;V6's SeekServer brings this capability to encrypted files. The server receives a Range Request, consults the footer's VFS (Virtual File System) index to identify which blocks cover the requested byte range, fetches and decrypts only those blocks, and returns exactly the requested bytes. The client — a media player, a browser, a download manager — never needs to know about the block structure. It just gets its bytes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Seek cost for a 20 GB encrypted video:

Byte range:     bytes=16,384,000,000–16,385,048,575
Blocks needed:  2  (2 MB of 20 GB read from disk)
Data touched:   0.01% of the container
Response time:  milliseconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The documentation at &lt;a href="https://qeltrix-v6.netlify.app/" rel="noopener noreferrer"&gt;qeltrix-v6.netlify.app&lt;/a&gt; covers the full SeekServer setup, including how to put it behind nginx or Caddy for HTTPS, and how to test it with curl's &lt;code&gt;-H "Range: bytes=X-Y"&lt;/code&gt; flag.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Gateway: Encrypting Live Streams
&lt;/h2&gt;

&lt;p&gt;Beyond static files, V6 includes a &lt;strong&gt;GatewayServer&lt;/strong&gt; — a TCP encryption router that can wrap any stream of data into V6's block-encrypted format in real time. Raw bytes come in one side; authenticated, block-framed V6 ciphertext goes out the other.&lt;/p&gt;

&lt;p&gt;The Gateway runs in one of three topologies:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reflect mode&lt;/strong&gt; is for testing. The gateway encrypts incoming data and sends the V6 stream back to the same sender. Useful for benchmarking and verifying that the encryption pipeline is working.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Router mode&lt;/strong&gt; is the production pattern. A data source sends a raw TCP stream to the gateway; the gateway encrypts it and forwards the V6 stream to a destination. The destination — a storage backend, another service, a relay — receives only ciphertext. Even if the destination is compromised, it has no key.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chained mode&lt;/strong&gt; connects multiple gateways in series. Each gateway wraps the stream with its own master key. Data passing through three gateways is triple-encrypted under three independent keys; compromising any one node doesn't expose the plaintext.&lt;/p&gt;

&lt;p&gt;The GatewayServer uses a thread pool to handle simultaneous connections, with each connection maintaining its own independent block counter and CDK chain. Encryption throughput scales approximately linearly with available CPU cores up to the pool limit.&lt;/p&gt;




&lt;h2&gt;
  
  
  How Parallel Processing Works
&lt;/h2&gt;

&lt;p&gt;Both the packer and the gateway are designed for throughput. Packing a file doesn't encrypt blocks one at a time in sequence — it dispatches block encryption jobs to a &lt;code&gt;ThreadPoolExecutor&lt;/code&gt;, letting multiple blocks be encrypted simultaneously across all available CPU cores. On modern hardware with AES-NI, a well-parallelised V6 pack operation can saturate memory bandwidth rather than CPU compute.&lt;/p&gt;

&lt;p&gt;The same design applies to unpacking and to the gateway. Each worker thread maintains its own state — its own cipher instance, its own block counter, its own CDK derivation — so threads never need to coordinate or synchronise on cryptographic operations. The shared state is limited to the master key, which is read-only after startup.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Makes V6 Useful
&lt;/h2&gt;

&lt;p&gt;The combination of seekable blocks, AEAD authentication, and the HTTP Range Request interface makes V6 a practical building block for a specific set of problems that conventional encryption doesn't handle well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Encrypted video streaming.&lt;/strong&gt; Store video libraries in encrypted &lt;code&gt;.qltx&lt;/code&gt; containers on S3, GCS, or any cloud object store. Serve them with the SeekServer. Users can seek and play. The storage provider sees only ciphertext. CDN nodes can cache and deliver the encrypted blocks without ever holding a key.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Partial restore from encrypted backups.&lt;/strong&gt; Back up large datasets into &lt;code&gt;.qltx&lt;/code&gt; containers. When you need to restore a single file from a 500 GB backup, seek directly to that file's blocks and decrypt only them. No full extraction needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-time encrypted logging.&lt;/strong&gt; Route log streams through the GatewayServer before writing to disk or forwarding to a log aggregator. Logs are stored in V6 format. Analysis tools that hold the key can seek to any time window. Anyone without the key sees ciphertext.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Zero-trust microservice data buses.&lt;/strong&gt; In a microservices environment, service pairs can route their data traffic through V6 gateway pairs. The internal network fabric sees only V6 ciphertext. A compromised internal service cannot read traffic addressed to other services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tamper-evident archival.&lt;/strong&gt; Every block carries a SHA-256 content hash and an AEAD authentication tag. Any modification to any byte of a container — even a single bit flip — causes the affected block's decryption to fail. This makes V6 containers a natural fit for compliance environments (HIPAA, PCI-DSS, SOC 2) where tamper-evidence is a requirement.&lt;/p&gt;




&lt;h2&gt;
  
  
  Capacity Overview
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Block-level overhead (per block):
  Block prefix:     28 bytes
  V6-C metadata:    ~128 bytes (encrypted)
  AEAD tag:         16 bytes
  ──────────────────────────────
  Overhead/block:   ~172 bytes

For 1 MB blocks:
  Overhead ratio:   ~0.017%  (172 bytes / 1,048,576 bytes)

Seek cost (20 GB file, 1 MB blocks):
  Worst case:       2 blocks decrypted (~2 MB read)
  Best case:        1 block decrypted  (~1 MB read)
  Index lookup:     O(1) via footer VFS index

Container index (footer):
  Per-block entry:  ~96 bytes
  1000-block file:  ~96 KB index
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The overhead is low by design. The goal is to make encryption not a performance penalty for seekable access — and for most workloads, the block overhead is negligible compared to the data being stored.&lt;/p&gt;




&lt;h2&gt;
  
  
  The PoC Status: What to Know Before Deploying
&lt;/h2&gt;

&lt;p&gt;V6 is explicitly a &lt;strong&gt;proof of concept&lt;/strong&gt;. The block encryption, CDK derivation, AEAD authentication, gateway architecture, and Range Request support are all production-quality in design. But there are three things that must change before real deployment:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The PBKDF2 salt is hardcoded.&lt;/strong&gt; In the current codebase (&lt;code&gt;cli.py&lt;/code&gt;), the passphrase-to-MK derivation uses a fixed salt (&lt;code&gt;b"QeltrixV6Salt"&lt;/code&gt;). This means two users with the same passphrase derive the same master key, and an attacker could precompute a table of common passphrases. The fix is simple — generate a random 32-byte salt per container and store it in the header — but it hasn't been implemented yet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There is no MK distribution mechanism.&lt;/strong&gt; V6 does not solve the problem of how two nodes (a GatewayServer and a SeekServer, for example) securely share the same master key. That's deliberate — it's a routing component, not a key authority — but it means you need to design this layer yourself. The documentation covers three approaches: ECDH ephemeral key exchange, RSA key encapsulation, and integration with an external KMS (AWS KMS, HashiCorp Vault, etc.).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There is no key rotation.&lt;/strong&gt; A compromised master key exposes all data encrypted under it, past and future, with no re-key mechanism in place. This is the most significant operational gap between the PoC and a production system.&lt;/p&gt;

&lt;p&gt;The full PoC-to-production checklist is in the Security Notes section of the documentation at &lt;a href="https://qeltrix-v6.netlify.app/" rel="noopener noreferrer"&gt;qeltrix-v6.netlify.app&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;The quickest way to try V6 is via PyPI:&lt;br&gt;
&lt;/p&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;qeltrix-v6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pack a file, inspect the container, and unpack it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-m&lt;/span&gt; qeltrix_v6 pack   myfile.mp4 myfile.qltx  &lt;span class="nt"&gt;--passphrase&lt;/span&gt; secret
python &lt;span class="nt"&gt;-m&lt;/span&gt; qeltrix_v6 info   myfile.qltx
python &lt;span class="nt"&gt;-m&lt;/span&gt; qeltrix_v6 unpack myfile.qltx recovered.mp4 &lt;span class="nt"&gt;--passphrase&lt;/span&gt; secret
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Serve it over HTTP with Range Request support:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-m&lt;/span&gt; qeltrix_v6 serve myfile.qltx &lt;span class="nt"&gt;--port&lt;/span&gt; 7621 &lt;span class="nt"&gt;--passphrase&lt;/span&gt; secret
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then seek to any position with any HTTP client that supports range requests — curl, VLC, a browser, ffmpeg. The documentation has full examples for all of these.&lt;/p&gt;

&lt;p&gt;The full CLI reference, Python API documentation, deployment guides, and security analysis are at &lt;a href="https://qeltrix-v6.hejhdiss.workers.dev/" rel="noopener noreferrer"&gt;https://qeltrix-v6.hejhdiss.workers.dev/&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Qeltrix V6 — by Muhammed Shafin P (&lt;a class="mentioned-user" href="https://dev.to/hejhdiss"&gt;@hejhdiss&lt;/a&gt;) · Licensed CC BY-SA 4.0&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>file</category>
      <category>hejhdiss</category>
      <category>programming</category>
    </item>
    <item>
      <title>Qeltrix V6: Rethinking Encrypted Storage for the Streaming Era</title>
      <dc:creator>Muhammed Shafin P</dc:creator>
      <pubDate>Sun, 01 Mar 2026 14:32:05 +0000</pubDate>
      <link>https://dev.to/hejhdiss/qeltrix-v6-rethinking-encrypted-storage-for-the-streaming-era-2cmm</link>
      <guid>https://dev.to/hejhdiss/qeltrix-v6-rethinking-encrypted-storage-for-the-streaming-era-2cmm</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/Qeltrix/Qeltrix-v6" rel="noopener noreferrer"&gt;https://github.com/Qeltrix/Qeltrix-v6&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PyPI&lt;/strong&gt;:&lt;a href="https://pypi.org/project/qeltrix-v6/" rel="noopener noreferrer"&gt;https://pypi.org/project/qeltrix-v6/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;⚠️ Proof-of-concept. Not for production or security-critical use without an independent cryptographic audit.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The Problem with Encryption Today
&lt;/h2&gt;

&lt;p&gt;Most encryption tools work the same way they did decades ago: you hand over a file, it gets locked, and to access any part of it — even a single byte — you must decrypt the entire thing first. Want to stream a 4K video stored securely in the cloud? Download it all. Want to jump to chapter 12 of an encrypted audiobook? Decrypt everything up to that point. This "all-or-nothing" model was acceptable when files were small and bandwidth was cheap. Neither of those things is true anymore.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Qeltrix V6&lt;/strong&gt; is a new kind of encrypted container format that breaks this assumption entirely. It is built from the ground up to behave like a live, seekable stream — meaning you can jump to any point inside an encrypted file and begin reading &lt;em&gt;immediately&lt;/em&gt;, without touching the rest of the data.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Makes V6 Different: Stream-First Architecture
&lt;/h2&gt;

&lt;p&gt;The core idea behind Qeltrix V6 is deceptively simple: instead of encrypting a file as one monolithic blob, V6 splits data into discrete, independently encrypted &lt;strong&gt;blocks&lt;/strong&gt;. Each block carries its own cryptographic identity — its own key, its own nonce, its own integrity tag, and its own metadata. The result is a container that behaves less like a locked safe and more like an encrypted database: you can query exactly the part you need.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Traditional Encryption:
┌─────────────────────────────────────────────┐
│         ONE BIG ENCRYPTED BLOB              │
│  (Must decrypt all to access any part)      │
└─────────────────────────────────────────────┘

Qeltrix V6 Block Architecture:
┌──────────┬──────────┬──────────┬──────────┐
│ Block 0  │ Block 1  │ Block 2  │ Block N  │
│ [Header] │ [V6-C]  │ [V6-C]  │ [Footer] │
│ [MK Env] │ [Data]  │ [Data]  │ [Index]  │
└──────────┴──────────┴──────────┴──────────┘
       ↑ Each block independently seekable and verifiable
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How the System is Organized
&lt;/h2&gt;

&lt;p&gt;Qeltrix V6 uses a &lt;strong&gt;hybrid C + Python architecture&lt;/strong&gt; that gives you the best of both worlds: raw C speed for the heavy structural work, and Python's mature cryptography ecosystem for the security layer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──────────────────────────────────────────────────────────┐
│                    Qeltrix V6 System                     │
│                                                          │
│  ┌─────────────────────┐    ┌──────────────────────────┐ │
│  │  C Shared Library   │    │  Python Crypto Layer     │ │
│  │  (libqeltrix_v6)    │    │                          │ │
│  │                     │    │  ● AES-256-GCM           │ │
│  │  ● Block framing    │◄──►│  ● ChaCha20-Poly1305      │ │
│  │  ● Permutation      │    │  ● HKDF-SHA256 (CDK)     │ │
│  │  ● Header/footer    │    │  ● SHA-256 hashing       │ │
│  │  ● TCP networking   │    │  ● Master key wrapping   │ │
│  │  ● HTTP parsing     │    │  ● Metadata encryption   │ │
│  │  ● Seek math        │    │                          │ │
│  └─────────────────────┘    └──────────────────────────┘ │
│                                                          │
│  ┌───────────────┐  ┌───────────────┐  ┌──────────────┐  │
│  │  pack/unpack  │  │ GatewayServer │  │  SeekServer  │  │
│  │  (container)  │  │ (TCP encrypt) │  │ (HTTP+Range) │  │
│  └───────────────┘  └───────────────┘  └──────────────┘  │
└──────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The C library handles everything that needs to be &lt;em&gt;fast&lt;/em&gt;: splitting data into blocks, framing them for the wire, computing the mathematics of seeking, and managing TCP connections. Python takes care of everything that needs to be &lt;em&gt;correct&lt;/em&gt;: key derivation, AEAD ciphers, and the authentication chain that ensures no one has tampered with your data.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Security Model: Layers All the Way Down
&lt;/h2&gt;

&lt;p&gt;V6 doesn't rely on a single encryption step. It implements a &lt;strong&gt;dual-layer key hierarchy&lt;/strong&gt; that binds every block of data to both its content and its position in the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Security Hierarchy:

  Passphrase / User Credential
         │
         ▼ (PBKDF2 / HKDF)
  ┌─────────────────────┐
  │   Master Key (MK)   │  ← Root of trust; stored encrypted in container header
  └─────────────────────┘
         │
         ▼ (HKDF-SHA256 + block index + data hash + salt)
  ┌─────────────────────┐
  │  Content Derived    │  ← Per-block key, unique to BOTH this block's
  │  Key (CDK)          │    position AND its content
  └─────────────────────┘
         │
         ▼ (AES-256-GCM or ChaCha20-Poly1305 AEAD)
  ┌─────────────────────┐
  │  Encrypted Block    │  ← Authenticated ciphertext; tamper-evident
  │  + V6-C Metadata    │
  └─────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What makes this powerful is the &lt;strong&gt;Content Derived Key (CDK)&lt;/strong&gt;. This per-block key is derived using HKDF and incorporates both the block's sequential index and a SHA-256 hash of its raw content. This means two identical blocks in different positions get different keys, and moving a block to a different position without re-encrypting will cause authentication to fail — the system detects it.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;V6-C metadata&lt;/strong&gt; — which holds the per-block IV, salt, integrity hash, and the wrapped CDK — is itself encrypted with the master key. Even an attacker who intercepts the container cannot learn anything about its internal structure without the master key.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real-Time Seekable Access: How Range Requests Work
&lt;/h2&gt;

&lt;p&gt;The most practically powerful capability of V6 is its native support for &lt;strong&gt;HTTP Range Requests&lt;/strong&gt;. This is the same mechanism that allows you to seek in a YouTube video without buffering from the start. V6 brings this capability to &lt;em&gt;encrypted&lt;/em&gt; files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP Range Request Workflow:

  Client                        SeekServer                    Container
    │                               │                              │
    │  GET /video.qltx              │                              │
    │  Range: bytes=50000000-       │                              │
    │──────────────────────────────►│                              │
    │                               │  1. Parse range header       │
    │                               │  2. Calculate which blocks   │
    │                               │     cover byte 50,000,000    │
    │                               │─────────────────────────────►│
    │                               │  3. Read only those blocks   │
    │                               │◄─────────────────────────────│
    │                               │  4. Decrypt blocks           │
    │                               │  5. Slice to exact range     │
    │  206 Partial Content          │                              │
    │◄──────────────────────────────│                              │
    │  (Only requested bytes)       │                              │
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The container's footer stores a &lt;strong&gt;VFS (Virtual File System) index&lt;/strong&gt; — a table that maps byte ranges in the original file to their corresponding block positions in the container. When a range request arrives, the SeekServer consults this index, fetches only the minimum necessary blocks, decrypts them, and returns exactly the bytes that were requested. A 20 GB encrypted video file can serve a seek to the 18-minute mark in milliseconds.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Gateway: A Full Encryption Router for the Network Layer
&lt;/h2&gt;

&lt;p&gt;Beyond static files, Qeltrix V6 includes a &lt;strong&gt;GatewayServer&lt;/strong&gt; — a standalone TCP encryption router that can wrap any stream of data in V6's block-encrypted format as it moves across the network. This is not a VPN, and it is not a proxy in the traditional sense. It is something more specific and more powerful: a &lt;strong&gt;transparent encryption boundary&lt;/strong&gt; that can be inserted between any two points in a network topology without modifying the applications on either side.&lt;/p&gt;

&lt;p&gt;This capability elevates V6 from a file format to a &lt;strong&gt;network security primitive&lt;/strong&gt; — a building block for constructing encrypted data infrastructure.&lt;/p&gt;




&lt;h3&gt;
  
  
  What the Gateway Actually Does
&lt;/h3&gt;

&lt;p&gt;When data arrives at the GatewayServer over TCP, it does not simply forward it. It performs the full V6 encryption pipeline — in real time, on every byte — before the data leaves the gateway's other side. The receiving end gets a proper V6 block stream: framed, authenticated, and encrypted. If the receiving end is another V6-aware component (such as a storage backend or another gateway), it can verify and decrypt each block independently as it arrives.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The V6 Gateway Processing Pipeline (per connection):

  Incoming raw bytes
         │
         ▼
  ┌──────────────────────────────────────────────────────┐
  │                  GatewayServer                        │
  │                                                       │
  │  ┌─────────────┐                                      │
  │  │ Accumulate  │  Buffer incoming bytes until a full  │
  │  │ into blocks │  block boundary is reached           │
  │  └──────┬──────┘                                      │
  │         │                                             │
  │         ▼                                             │
  │  ┌─────────────┐                                      │
  │  │ Hash block  │  SHA-256 of raw block content        │
  │  │ content     │                                      │
  │  └──────┬──────┘                                      │
  │         │                                             │
  │         ▼                                             │
  │  ┌─────────────┐                                      │
  │  │ Derive CDK  │  HKDF(MasterKey, block_idx, hash,    │
  │  │             │  salt) → unique per-block key        │
  │  └──────┬──────┘                                      │
  │         │                                             │
  │         ▼                                             │
  │  ┌─────────────┐                                      │
  │  │  AEAD       │  AES-256-GCM or ChaCha20-Poly1305    │
  │  │  Encrypt    │  → ciphertext + 16-byte auth tag     │
  │  └──────┬──────┘                                      │
  │         │                                             │
  │         ▼                                             │
  │  ┌─────────────┐                                      │
  │  │ Frame as V6 │  Write block prefix + V6-C metadata  │
  │  │ wire block  │  + ciphertext to output stream       │
  │  └──────┬──────┘                                      │
  └─────────┼────────────────────────────────────────────┘
            │
            ▼
  Encrypted V6 block stream (to destination or storage)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This pipeline runs concurrently across multiple connections using a thread pool, meaning a single gateway instance can serve many simultaneous clients without serializing their encryption work.&lt;/p&gt;




&lt;h3&gt;
  
  
  Gateway Topology: Three Deployment Modes
&lt;/h3&gt;

&lt;p&gt;The GatewayServer supports three distinct deployment topologies, selected at startup.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mode 1 — Reflect Mode (Loopback Encryption Testing)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In reflect mode, the gateway receives a raw stream, encrypts it into V6 blocks, and sends the encrypted stream &lt;em&gt;back to the sender&lt;/em&gt;. This is useful for testing, benchmarking, and any scenario where you want to measure V6 overhead in isolation without setting up a full two-sided deployment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ┌──────────────────────────────────────────────────┐
  │               Reflect Mode                       │
  │                                                  │
  │   Client App                GatewayServer        │
  │       │                          │               │
  │       │    raw TCP stream ───────►│               │
  │       │                          │  encrypt       │
  │       │◄─── encrypted V6 ────────│               │
  │       │     stream back          │               │
  │                                                  │
  │  Use case: local testing, encryption benchmarks  │
  └──────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Mode 2 — Forward/Router Mode (Encryption Proxy)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In router mode, the gateway sits between a data source and a destination. Raw data comes in from the source, gets encrypted into V6 blocks, and is forwarded onward to the configured destination host and port. The destination receives only ciphertext — it never sees the plaintext.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ┌────────────────────────────────────────────────────────────┐
  │                    Router Mode                             │
  │                                                            │
  │  Data Source      GatewayServer          Destination       │
  │  (app / service)      │                 (storage, relay)   │
  │        │              │                       │            │
  │        │──raw TCP────►│                       │            │
  │        │              │──V6 encrypted stream─►│            │
  │        │              │                       │            │
  │        │         [encrypt + frame]        [receives        │
  │        │                                   ciphertext]     │
  │                                                            │
  │  Use case: zero-trust data pipelines, encrypted relay      │
  └────────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Mode 3 — Chained Gateway Mode (Multi-Hop Encryption)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Multiple GatewayServer instances can be chained together. The output of one gateway (an encrypted V6 stream) feeds into the input of the next, which re-encrypts it under a different master key. This creates a layered encryption topology where no single node holds the full decryption capability — each hop peels one layer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ┌────────────────────────────────────────────────────────────────┐
  │                 Chained Gateway Mode                           │
  │                                                                │
  │  Source     Gateway A        Gateway B        Destination      │
  │    │       (MK-Alpha)       (MK-Beta)             │           │
  │    │            │               │                 │           │
  │    │──raw──────►│               │                 │           │
  │    │            │──V6[MK-α]────►│                 │           │
  │    │            │               │──V6[MK-β]──────►│           │
  │    │            │               │     (double      │           │
  │    │            │               │      encrypted)  │           │
  │                                                                │
  │  Each gateway adds an independent encryption layer.            │
  │  Compromise of one node does not expose plaintext.             │
  └────────────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  The Gateway as an Encryption Router: Network-Level Placement
&lt;/h3&gt;

&lt;p&gt;One of the more significant capabilities of the GatewayServer is where it can be placed in a network topology. Because it operates at the TCP socket level and is completely transparent to the applications on either side, it can be dropped into virtually any network path without code changes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ┌───────────────────────────────────────────────────────────────────┐
  │         V6 Gateway as a Network Encryption Router                │
  │                                                                   │
  │                         UNTRUSTED NETWORK                        │
  │                      ┌─────────────────────┐                     │
  │                       │  (ISP / Cloud / WAN)│                    │
  │                       └─────────────────────┘                    │
  │                                ▲  ▼                              │
  │  TRUSTED ZONE A                │                TRUSTED ZONE B   │
  │  ┌────────────────┐            │           ┌────────────────┐    │
  │  │  App Server    │            │           │  Storage /     │    │
  │  │  Database      │            │           │  Analytics     │    │
  │  │  Log Source    │            │           │  Backup Node   │    │
  │  └───────┬────────┘            │           └────────┬───────┘    │
  │          │ raw                 │                raw │            │
  │          ▼                     │                    ▼            │
  │  ┌───────────────┐             │           ┌───────────────┐     │
  │  │  V6 Gateway   │─────────────┘           │  V6 Gateway   │     │
  │  │  (Encrypt)    │  encrypted V6 stream    │  (Decrypt)    │     │
  │  └───────────────┘ ───────────────────────►└───────────────┘     │
  │                                                                   │
  │  ● The untrusted network sees only V6 ciphertext                 │
  │  ● No application changes required on either side                │
  │  ● Each block is independently authenticated                      │
  └───────────────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This pattern is particularly relevant for cloud deployments where data must traverse shared infrastructure. The V6 gateway pair creates an encrypted tunnel at the application-data level — distinct from TLS (which secures the transport) in that the &lt;em&gt;data itself&lt;/em&gt; is encrypted in a structured, auditable format that can be stored, replayed, and verified independently of the connection.&lt;/p&gt;




&lt;h3&gt;
  
  
  Concurrent Connection Handling
&lt;/h3&gt;

&lt;p&gt;The GatewayServer uses a ThreadPoolExecutor to handle multiple simultaneous connections. Each connection gets its own encryption context — its own block counter, its own per-block key derivation chain — so connections are completely isolated from each other at the cryptographic level.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  GatewayServer — Concurrent Architecture:

  ┌─────────────────────────────────────────────────────────┐
  │                                                         │
  │  Connection 1 ──► Worker Thread 1 ──► V6 Stream Out 1  │
  │  Connection 2 ──► Worker Thread 2 ──► V6 Stream Out 2  │
  │  Connection 3 ──► Worker Thread 3 ──► V6 Stream Out 3  │
  │  Connection N ──► Worker Thread N ──► V6 Stream Out N  │
  │                                                         │
  │  Each worker maintains:                                 │
  │  ● Independent block counter (block_index)              │
  │  ● Independent CDK derivation chain                     │
  │  ● Independent AEAD cipher state                        │
  │  ● Independent stats (bytes_in, bytes_out)              │
  │                                                         │
  │  Shared across all workers (read-only after init):      │
  │  ● Master Key                                           │
  │  ● Cipher selection (AES or ChaCha20)                   │
  │  ● Block size configuration                             │
  └─────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This design means encryption throughput scales linearly with the number of available CPU cores up to the thread pool limit. A gateway instance running on an 8-core server can simultaneously encrypt 8 independent streams at full CPU speed.&lt;/p&gt;




&lt;h3&gt;
  
  
  Gateway vs. SeekServer: Complementary Roles
&lt;/h3&gt;

&lt;p&gt;It is worth distinguishing the two server components clearly, since they solve related but different problems:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ┌───────────────────────────────────────────────────────────────┐
  │          GatewayServer vs. SeekServer                        │
  │                                                               │
  │  ┌──────────────────────┐   ┌──────────────────────────────┐  │
  │  │   GatewayServer      │   │        SeekServer            │  │
  │  │                      │   │                              │  │
  │  │  Protocol:  TCP      │   │  Protocol:  HTTP/1.1         │  │
  │  │  Direction: Encrypt  │   │  Direction: Decrypt + Serve  │  │
  │  │  Input:     Raw      │   │  Input:     .qltx container  │  │
  │  │             stream   │   │  Output:    Plaintext bytes  │  │
  │  │  Output:    V6       │   │  Seeking:   Range Requests   │  │
  │  │             stream   │   │                              │  │
  │  │  Use when:           │   │  Use when:                   │  │
  │  │  ● Encrypting data   │   │  ● Serving encrypted files   │  │
  │  │    in transit        │   │    to media players,         │  │
  │  │  ● Building zero-    │   │    browsers, apps            │  │
  │  │    trust pipelines   │   │  ● Partial extraction from   │  │
  │  │  ● Transparent       │   │    large archives            │  │
  │  │    encryption proxy  │   │                              │  │
  │  └──────────────────────┘   └──────────────────────────────┘  │
  │                                                               │
  │  Together: Encrypt at source (Gateway) → Store → Serve       │
  │            on demand with seeking (SeekServer)                │
  └───────────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a complete deployment, the GatewayServer encrypts data as it is produced and streams it to storage. The SeekServer then serves that stored, encrypted data to consumers — decrypting only the portions they request. The two components form a complete end-to-end pipeline.&lt;/p&gt;




&lt;h3&gt;
  
  
  Full End-to-End Pipeline Diagram
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ┌──────────────────────────────────────────────────────────────────────┐
  │              Complete V6 Encrypted Data Infrastructure               │
  │                                                                      │
  │  PRODUCTION          │  UNTRUSTED        │  CONSUMER                │
  │  SIDE                │  STORAGE/NET      │  SIDE                    │
  │                      │                   │                          │
  │  ┌──────────────┐    │                   │    ┌──────────────────┐  │
  │  │ App / Camera │    │                   │    │ Media Player /   │  │
  │  │ Sensor / DB  │    │                   │    │ Browser / Client │  │
  │  └──────┬───────┘    │                   │    └────────┬─────────┘  │
  │         │ raw data   │                   │             │ HTTP Range  │
  │         ▼            │                   │             ▼ Request     │
  │  ┌──────────────┐    │   ┌───────────┐   │    ┌──────────────────┐  │
  │  │  V6 Gateway  │────┼──►│  .qltx    │◄──┼────│   SeekServer     │  │
  │  │  (Encrypt)   │    │   │  Storage  │   │    │   (Decrypt +     │  │
  │  └──────────────┘    │   │  (Cloud / │   │    │    Serve range)  │  │
  │                      │   │   Disk)   │   │    └──────────────────┘  │
  │  Master Key held     │   │           │   │    Master Key held       │
  │  by Gateway only     │   │ Sees only │   │    by SeekServer only    │
  │                      │   │ ciphertext│   │                          │
  └──────────────────────┴───┴───────────┴───┴──────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The storage layer — whether a cloud object store, a NAS, or a CDN — holds only encrypted V6 containers. It has no access to the master key, and therefore no ability to read the data it stores. The encryption and decryption capabilities are held exclusively by the gateway (on ingress) and the SeekServer (on egress), both of which operate within the trusted boundary.&lt;/p&gt;




&lt;h2&gt;
  
  
  Gateway-Specific Use Cases
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Zero-Trust Internal Data Bus
&lt;/h3&gt;

&lt;p&gt;In a microservices architecture, services that exchange sensitive data (user records, financial transactions, health data) can route their traffic through V6 gateway pairs. The internal network sees only V6 ciphertext. Even if an internal service is compromised, it cannot read traffic it wasn't issued a key for.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ┌──────────────────────────────────────────────────────────┐
  │            Zero-Trust Microservice Mesh                  │
  │                                                          │
  │  Service A      GW-A     Network Fabric    GW-B  Svc B  │
  │    │             │            │             │      │    │
  │    │──plaintext─►│            │             │      │    │
  │    │             │──V6 crypt─►│──V6 crypt──►│      │    │
  │    │             │            │             │─plain►│    │
  │                                                          │
  │  Service C      GW-C          │            GW-D  Svc D  │
  │    │             │            │             │      │    │
  │    │──plaintext─►│──V6 crypt─►│──V6 crypt──►│─plain►│   │
  │                                                          │
  │  Each service pair has its own Master Key.               │
  │  GW-A cannot decrypt GW-C's traffic.                     │
  └──────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Encrypted Sensor / IoT Data Collection
&lt;/h3&gt;

&lt;p&gt;IoT devices and sensors often transmit data over networks with little to no security. A V6 gateway deployed at the network edge collects raw sensor streams, encrypts them in real time into V6 containers, and forwards them to a cloud backend. The backend stores only ciphertext. Analysis infrastructure that holds the key can then seek into specific time windows without pulling entire archives.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Sensors ──► Edge Gateway (V6 Encrypt) ──► Cloud Storage (.qltx)
                                                      │
                                          Analytics seeks specific
                                          time windows via SeekServer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Encrypted Audit Trail / Compliance Logging
&lt;/h3&gt;

&lt;p&gt;Compliance environments (HIPAA, PCI-DSS, SOC 2) require that sensitive logs be tamper-evident and access-controlled. Running audit log streams through a V6 gateway produces containers where every block is authenticated — any deletion or modification breaks the authentication chain and is immediately detectable. Auditors with the key can seek to any time window; no one else can read the logs at all.&lt;/p&gt;




&lt;h2&gt;
  
  
  Possible Use Cases
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Secure Cloud Video Streaming
&lt;/h3&gt;

&lt;p&gt;Store large video libraries encrypted in cloud storage (S3, GCS, etc.) and serve them with HTTP Range Request support. Users can seek and play without the server — or the storage provider — ever seeing the plaintext. V6's block structure means scrubbing to any point in a 2-hour film requires decrypting at most a few hundred kilobytes.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Encrypted Media CDN
&lt;/h3&gt;

&lt;p&gt;Build a content delivery network where the CDN nodes hold only encrypted blocks. The keys never leave your infrastructure. Even if a CDN node is compromised, an attacker gets only ciphertext — and individual blocks are useless without the master key.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Secure Backup with Partial Restore
&lt;/h3&gt;

&lt;p&gt;Back up large datasets block by block. When you need to restore a single file from a 500 GB backup archive, seek directly to that file's blocks and decrypt only those. No full-archive extraction needed.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Real-Time Encrypted Logging
&lt;/h3&gt;

&lt;p&gt;Use the Gateway Server in front of a log aggregation system. Log data is encrypted in transit and stored in V6 containers, but log analysis tools that hold the key can still seek to specific time windows within a day's logs without downloading the full day.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Secure File Sharing with Selective Access
&lt;/h3&gt;

&lt;p&gt;Distribute an encrypted container where different authorized parties can access different byte ranges (corresponding to different logical sections). Since each block has its own CDK derived from the master key, access control can be scoped to specific block ranges.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Encrypted Game Asset Streaming
&lt;/h3&gt;

&lt;p&gt;Game engines stream assets from disk or network as they're needed. V6 enables those assets to be stored encrypted without performance penalties — the engine requests the exact byte range for a texture or audio clip, and only that range is decrypted.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Tamper-Evident Archival
&lt;/h3&gt;

&lt;p&gt;Every block carries a SHA-256 integrity hash and an AEAD authentication tag. Any modification to any byte of a V6 container — even a single bit flip — causes decryption of the affected block to fail with an authentication error. This makes V6 containers a natural fit for archival storage where data integrity must be provable.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. Privacy-Preserving Data Pipelines
&lt;/h3&gt;

&lt;p&gt;In data processing pipelines, intermediate datasets can be stored as V6 containers. Each pipeline stage holds only the master key it needs to access its assigned blocks, and the encrypted metadata ensures that even the schema and structure of the data remain confidential.&lt;/p&gt;




&lt;h2&gt;
  
  
  Performance Design
&lt;/h2&gt;

&lt;p&gt;V6 is built to be fast. The block architecture is inherently parallelizable: each block is independent, so packing and unpacking use a &lt;code&gt;ThreadPoolExecutor&lt;/code&gt; to process multiple blocks simultaneously across all CPU cores. On modern hardware, this approach can fully saturate the memory and I/O bandwidth available, rather than being bottlenecked by a single encryption thread.&lt;/p&gt;

&lt;p&gt;For cipher choice, V6 offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AES-256-GCM&lt;/strong&gt; — the hardware-accelerated default. On any CPU with AES-NI instructions (most devices manufactured after 2010), this is extremely fast.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ChaCha20-Poly1305&lt;/strong&gt; — the mobile-friendly alternative. Designed to be fast in software on CPUs without AES hardware acceleration, making it ideal for IoT devices or older mobile hardware.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both options provide &lt;strong&gt;AEAD (Authenticated Encryption with Associated Data)&lt;/strong&gt;, meaning every decrypt operation simultaneously verifies that the data has not been altered.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Master Key Problem: How Does V6 Actually Share It?
&lt;/h2&gt;

&lt;p&gt;This is the most important practical question about the system, and it deserves a direct answer.&lt;/p&gt;

&lt;p&gt;The Master Key (MK) is a 32-byte symmetric secret. It lives &lt;strong&gt;only in process memory&lt;/strong&gt; — never written to disk in plaintext, never transmitted by V6 itself. The container header stores an &lt;em&gt;encrypted&lt;/em&gt; copy of the MK (wrapped with AES-GCM using a passphrase-derived key), but that encrypted blob is useless without the passphrase or raw key that created it. Every operation — &lt;code&gt;pack&lt;/code&gt;, &lt;code&gt;unpack&lt;/code&gt;, &lt;code&gt;seek_extract&lt;/code&gt;, &lt;code&gt;GatewayServer&lt;/code&gt;, &lt;code&gt;SeekServer&lt;/code&gt; — requires the caller to supply the MK at runtime.&lt;/p&gt;

&lt;p&gt;This raises an unavoidable question: &lt;strong&gt;how do two parties — a GatewayServer on one machine and a SeekServer on another — both end up holding the same MK without transmitting it over the wire in a way an attacker could intercept?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;V6 intentionally does not solve this problem. The gateway is a routing and encryption component. Key distribution is a separate concern, and deliberately left to the operator. This is the right separation of responsibilities — but it does mean you need to design the key exchange layer yourself when moving toward production.&lt;/p&gt;




&lt;h3&gt;
  
  
  The Gateway Does Not Manage Keys — By Design
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ┌──────────────────────────────────────────────────────────────────┐
  │         What V6 Gateway Does vs. Does NOT Do                     │
  │                                                                  │
  │  ✓ DOES:                       ✗ DOES NOT:                      │
  │  ● Accept MK at startup        ● Generate or negotiate MK        │
  │  ● Hold MK in process memory   ● Transmit MK over the wire       │
  │  ● Derive CDKs from MK         ● Store MK anywhere on disk       │
  │  ● Encrypt/decrypt streams     ● Authenticate remote parties     │
  │  ● Route encrypted data        ● Manage key rotation             │
  │  ● Track stats per connection  ● Distribute MK to new nodes      │
  │                                                                  │
  │  The MK must arrive from OUTSIDE, via an external mechanism.     │
  └──────────────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This design is correct for a routing component — it mirrors how systems like nginx handle TLS certificates: the server doesn't generate your CA; you bring the cert to it. The gateway is an encryption engine, not a key authority.&lt;/p&gt;




&lt;h3&gt;
  
  
  How to Distribute the MK Safely: Three Approaches
&lt;/h3&gt;

&lt;p&gt;When two V6 nodes need to share the same MK, the MK itself must travel over some channel. That channel needs to be secure. Here are the standard approaches, from simplest to most production-grade:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Approach 1 — Diffie-Hellman Key Exchange (ECDH)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Two parties can arrive at a shared secret without ever transmitting the secret itself. Using Elliptic Curve Diffie-Hellman (ECDH), each side generates an ephemeral key pair. They exchange only public keys. Each side independently computes the same shared secret, which is then used as (or to derive) the MK.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ECDH Master Key Exchange for V6:

  Node A (Gateway)              Node B (SeekServer)
       │                               │
       │  Generate ephemeral           │  Generate ephemeral
       │  keypair (privA, pubA)        │  keypair (privB, pubB)
       │                               │
       │────── send pubA ─────────────►│
       │◄───── send pubB ──────────────│
       │                               │
       │  shared = ECDH(privA, pubB)   │  shared = ECDH(privB, pubA)
       │  MK = HKDF(shared, context)   │  MK = HKDF(shared, context)
       │                               │
       │  Both now hold identical MK.  │
       │  The MK was never on the wire.│
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is how TLS establishes session keys. The public key exchange happens in the clear; the secret never leaves either machine. For V6, a pre-connection ECDH handshake between gateway nodes could establish the MK before the stream begins.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Approach 2 — RSA Key Encapsulation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If one party has an RSA public key for the other, they can encrypt the MK under that public key and transmit the ciphertext. Only the holder of the RSA private key can recover the MK. This is simpler to implement than a full DH exchange but requires a pre-existing PKI (public key infrastructure) — each node needs a key pair, and the parties need a way to trust each other's public keys.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  RSA MK Distribution:

  Key Authority / Operator
         │
         │  Encrypt MK with Node B's RSA public key
         │  → sends ciphertext to Node B
         │
  Node B decrypts with private key → recovers MK
  Node A receives MK via secure out-of-band channel
         │
  Both nodes now hold MK. RSA ciphertext was safe to transmit.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Approach 3 — External Key Management Service (KMS)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In cloud environments, services like AWS KMS, HashiCorp Vault, or Google Cloud KMS act as trusted third parties that hold and distribute secrets. Neither the gateway nor the seek server ever holds the MK long-term; they request it from the KMS at startup, authenticated by their cloud identity (IAM role, service account, etc.).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  KMS-Based MK Distribution:

  ┌─────────────┐       ┌─────────────┐       ┌─────────────┐
  │  V6 Gateway │       │     KMS     │       │ V6 SeekSrv  │
  │             │       │  (Vault /   │       │             │
  │  startup:   │──────►│  AWS KMS /  │◄──────│  startup:   │
  │  "give me   │       │  etc.)      │       │  "give me   │
  │  MK for     │       │             │       │  MK for     │
  │  stream X"  │◄──────│  verifies   │──────►│  stream X"  │
  │             │  MK   │  identity   │  MK   │             │
  └─────────────┘       └─────────────┘       └─────────────┘
       MK held in memory only. Never on disk. Rotatable on demand.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  The PoC Hardcoding: What It Is and Why It Matters
&lt;/h3&gt;

&lt;p&gt;The current V6 codebase is explicitly a &lt;strong&gt;proof of concept&lt;/strong&gt;, and it contains several hardcoded values that are safe for testing and demonstration but would create real vulnerabilities in production. It is worth being specific about what these are, why they exist, and what would need to change.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  PoC Hardcoding Inventory:

  ┌────────────────────────┬──────────────────────────┬──────────────────────┐
  │ What's hardcoded       │ Where                    │ Risk if kept in prod │
  ├────────────────────────┼──────────────────────────┼──────────────────────┤
  │ PBKDF2 salt            │ cli.py:                  │ Two users with same  │
  │ b"QeltrixV6Salt"       │ _mk_from_passphrase()    │ passphrase get same  │
  │                        │                          │ MK. Rainbow tables   │
  │                        │                          │ become possible.     │
  ├────────────────────────┼──────────────────────────┼──────────────────────┤
  │ HKDF info strings      │ crypto.py: multiple      │ Low risk alone, but  │
  │ e.g. "QeltrixV6-CDK"   │ derivation calls         │ domain separation    │
  │                        │                          │ relies on these      │
  │                        │                          │ being unique/secret  │
  ├────────────────────────┼──────────────────────────┼──────────────────────┤
  │ PBKDF2 iteration count │ cli.py: 200,000           │ Acceptable today,   │
  │                        │                          │ should be tunable    │
  │                        │                          │ and higher for HSMs  │
  ├────────────────────────┼──────────────────────────┼──────────────────────┤
  │ No MK rotation         │ Entire codebase          │ Compromised MK =     │
  │                        │                          │ all data exposed.    │
  │                        │                          │ No re-key mechanism. │
  └────────────────────────┴──────────────────────────┴──────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The hardcoded PBKDF2 salt is the most significant issue.&lt;/strong&gt; A salt's purpose is to make every passphrase derivation unique, so that the same passphrase on two different containers produces two different MKs. With a fixed salt, if an attacker knows a user's passphrase (or can guess common ones), they can precompute a table of &lt;code&gt;passphrase → MK&lt;/code&gt; mappings and apply it to any V6 container ever created with that passphrase. The fix is simple: generate a random 32-byte salt per container, store it in the header alongside the encrypted MK, and use it during derivation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The symmetric MK itself is the second structural concern.&lt;/strong&gt; AES-256-GCM is a symmetric cipher — the same key encrypts and decrypts. This means every party that can &lt;em&gt;decrypt&lt;/em&gt; V6 data can also &lt;em&gt;encrypt&lt;/em&gt; it and forge valid blocks. For many use cases (a single operator controlling both gateway and storage) this is fine. For use cases where you want to separate write and read authorization — for example, a sensor that can only encrypt, never decrypt — symmetric encryption is insufficient. RSA or an ECDH-based scheme with separate keys for encryption and decryption roles would be needed.&lt;/p&gt;




&lt;h3&gt;
  
  
  The Security That Exists Despite These Constraints
&lt;/h3&gt;

&lt;p&gt;It is important to be precise: the PoC hardcoding creates &lt;em&gt;theoretical&lt;/em&gt; vulnerabilities, but the system is not simply insecure. Several strong protections remain regardless:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Security Analysis: What Holds Even with PoC Constraints

  ┌──────────────────────────────────────────────────────────────────┐
  │  STRONG regardless of PoC status:                               │
  │                                                                  │
  │  ● AES-256-GCM / ChaCha20-Poly1305 are cryptographically sound  │
  │  ● Per-block CDK derivation: compromising one block's key does  │
  │    not expose any other block's key                              │
  │  ● AEAD authentication: any tampering with any block is         │
  │    detected and decryption fails with an error                   │
  │  ● V6-C metadata encryption: container structure is opaque      │
  │    without the MK                                                │
  │  ● MK never written to disk in plaintext                        │
  │                                                                  │
  │  WEAKER due to PoC choices:                                      │
  │                                                                  │
  │  ● Fixed PBKDF2 salt weakens passphrase-to-MK derivation        │
  │  ● No MK distribution mechanism: operator must solve this       │
  │  ● Symmetric MK: no separation between encrypt/decrypt roles    │
  │  ● No key rotation: long-lived MK increases exposure window     │
  └──────────────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The bottom line: if you control the MK — if it was generated securely and distributed through a trusted channel — the data is strongly protected. The PoC weaknesses are primarily in the &lt;em&gt;convenience layers&lt;/em&gt; around the MK (the passphrase-to-key derivation and the lack of a key exchange protocol), not in the core encryption itself.&lt;/p&gt;




&lt;h3&gt;
  
  
  What Production Would Look Like
&lt;/h3&gt;

&lt;p&gt;Moving V6 from proof of concept to production-grade would require changes in two areas: the key derivation layer and the key distribution layer. The block encryption, block framing, CDK hierarchy, and AEAD authentication are already production-quality in design.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  PoC → Production: Required Changes

  PoC (current)                     Production
  ─────────────────────────────────────────────────────────────
  Hardcoded PBKDF2 salt         →   Random per-container salt,
                                    stored in header
  Passphrase via CLI arg        →   MK via KMS / HSM / ECDH
                                    handshake at startup
  No key distribution           →   ECDH or RSA key encapsulation
                                    between gateway nodes
  No key rotation               →   MK rotation via re-key API;
                                    old containers re-encrypted
                                    on a schedule
  Symmetric-only MK             →   Optional asymmetric wrap:
                                    encrypt-only role vs. full
                                    decrypt role
  Single MK per deployment      →   Per-stream or per-container
                                    MK, managed by KMS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The architecture of V6 — its block model, its CDK hierarchy, its gateway topology — is fully compatible with all of these production hardening steps. The PoC is not a wrong design that needs to be replaced; it is a correct design that needs its key management layer completed.&lt;/p&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Qeltrix V6 is a practical answer to a real problem: how do you store large, sensitive data in a way that is both strongly encrypted &lt;em&gt;and&lt;/em&gt; efficiently accessible? By treating encryption not as a one-time transformation but as a structured, seekable container format, V6 makes it feasible to build encrypted video platforms, secure backup systems, privacy-preserving data pipelines, and real-time network encryption gateways — all from a single, unified architecture.&lt;/p&gt;

&lt;p&gt;Its block encryption, CDK key hierarchy, and AEAD authentication are production-quality in design. What remains for a real-world deployment is completing the key management layer: replacing the hardcoded PBKDF2 salt with per-container random salts, adding an ECDH or RSA-based MK exchange between gateway nodes, and integrating with a KMS for key lifecycle management. The routing gateway intentionally leaves this to the operator — it is an encryption engine, not a key authority — which means the design is open to being paired with any key distribution mechanism that fits the deployment context.&lt;/p&gt;

&lt;p&gt;The combination of a fast C core, a rigorous Python cryptography layer, HTTP Range Request support, and a fully separable key management model makes Qeltrix V6 a strong foundation for the next generation of secure streaming infrastructure.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Explore the project:&lt;/strong&gt; &lt;a href="https://github.com/Qeltrix/Qeltrix-v6" rel="noopener noreferrer"&gt;https://github.com/Qeltrix/Qeltrix-v6&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Created by Muhammed Shafin P (&lt;a class="mentioned-user" href="https://dev.to/hejhdiss"&gt;@hejhdiss&lt;/a&gt;) | License: CC BY-SA 4.0&lt;/em&gt;&lt;/p&gt;

</description>
      <category>qeltrix</category>
      <category>hejhdiss</category>
      <category>container</category>
      <category>python</category>
    </item>
    <item>
      <title>Qeltrix V6 — Network-Native Encrypted Streaming Container</title>
      <dc:creator>Muhammed Shafin P</dc:creator>
      <pubDate>Sun, 01 Mar 2026 13:48:54 +0000</pubDate>
      <link>https://dev.to/hejhdiss/qeltrix-v6-network-native-encrypted-streaming-container-4f45</link>
      <guid>https://dev.to/hejhdiss/qeltrix-v6-network-native-encrypted-streaming-container-4f45</guid>
      <description>&lt;p&gt;License: CC BY-SA 4.0&lt;/p&gt;

&lt;p&gt;Architecture: C shared library (.so/.dll) + Python cryptography library&lt;/p&gt;

&lt;p&gt;Repository: &lt;a href="https://github.com/Qeltrix/Qeltrix-v6" rel="noopener noreferrer"&gt;https://github.com/Qeltrix/Qeltrix-v6&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ PROOF-OF-CONCEPT ONLY. Not for production or security-critical use without an independent cryptographic audit. Created fully with Claude Sonnet 4.6.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What is Qeltrix V6?
&lt;/h2&gt;

&lt;p&gt;Qeltrix V6 represents the network-native evolution of the Qeltrix encrypted archiving system. Unlike traditional encryption methods that require an entire file to be processed before it can be used, V6 is designed to turn any data stream into a live, seekable, and encrypted container in real-time. This "stream-first" approach allows for the encryption of data as it arrives from any source, making it an ideal foundation for modern cloud storage and secure file-sharing applications.&lt;/p&gt;

&lt;p&gt;The system’s standout capability is its native support for HTTP Range Requests. This allows users to "seek" into massive encrypted files—such as high-definition videos—and begin playback or extract specific data segments instantly without downloading or decrypting the entire container. By breaking data into discrete, authenticated blocks, Qeltrix V6 ensures that only the requested information is processed, drastically reducing latency and bandwidth consumption in media streaming scenarios.&lt;/p&gt;

&lt;h2&gt;
  
  
  System Architecture
&lt;/h2&gt;

&lt;p&gt;The project utilizes a hybrid architecture that combines the performance of low-level C with the robust security ecosystem of Python. The C core handles the "heavy lifting," including high-speed block framing, memory-efficient permutations, and the complex mathematics required for random-access seeking. Meanwhile, the Python layer leverages the cryptography library to manage high-level logic, such as key derivation and the orchestration of AES-256-GCM or ChaCha20-Poly1305 ciphers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──────────────────────────────────────────────────────────┐
│                    Qeltrix V6 System                     │
│                                                          │
│  ┌─────────────────────┐    ┌──────────────────────────┐ │
│  │  C Shared Library   │    │  Python (cryptography)   │ │
│  │  libqeltrix_v6.so   │    │                          │ │
│  │  qeltrix_v6.dll     │    │  ● AES-256-GCM           │ │
│  │                     │    │  ● ChaCha20-Poly1305      │ │
│  │  ● Block framing    │◄──►│  ● HKDF-SHA256 (CDK)     │ │
│  │  ● Permutation      │    │  ● SHA-256 hashing       │ │
│  │  ● Header/footer    │    │  ● Master key wrapping   │ │
│  │  ● TCP networking   │    │  ● V6-C metadata crypto  │ │
│  │  ● HTTP parsing     │    │                          │ │
│  │  ● Seek math        │    │                          │ │
│  └─────────────────────┘    └──────────────────────────┘ │
│                                                          │
│  ┌───────────────┐  ┌───────────────┐  ┌──────────────┐  │
│  │ pack/unpack   │  │ GatewayServer │  │  SeekServer  │  │
│  │ container.py  │  │ gateway.py    │  │ (HTTP+Range) │  │
│  └───────────────┘  └───────────────┘  └──────────────┘  │
└──────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Performance and Security Features
&lt;/h2&gt;

&lt;p&gt;Qeltrix V6 is engineered for high-performance environments. It utilizes a ThreadPoolExecutor to provide true parallel processing across all platforms, including Windows. This multi-threaded approach allows the system to encrypt or decrypt multiple data blocks simultaneously, fully saturating modern multi-core CPUs. On Windows, the system is fully supported via a .dll built with MinGW, ensuring consistent performance across different operating systems.&lt;/p&gt;

&lt;p&gt;Security is implemented through a multi-layered approach. Each data block maintains its own integrity via SHA-256 hashing and AEAD (Authenticated Encryption with Associated Data) tags. The system employs a dual-layer key hierarchy where a Content Derived Key (CDK) is wrapped within a Master Key (MK). Furthermore, the V6-C metadata is itself encrypted, ensuring that even the internal structure and properties of the container remain hidden from unauthorized parties. Whether using the hardware-accelerated AES-256-GCM or the mobile-friendly ChaCha20-Poly1305, Qeltrix V6 provides a flexible and powerful toolkit for the next generation of secure networking.&lt;/p&gt;

</description>
      <category>qeltrix</category>
      <category>hejhidss</category>
      <category>container</category>
    </item>
    <item>
      <title>Running Machine Learning on Microcontrollers — A Sample Usage of embml</title>
      <dc:creator>Muhammed Shafin P</dc:creator>
      <pubDate>Sun, 01 Mar 2026 10:06:28 +0000</pubDate>
      <link>https://dev.to/hejhdiss/running-machine-learning-on-microcontrollers-a-sample-usage-of-embml-56n4</link>
      <guid>https://dev.to/hejhdiss/running-machine-learning-on-microcontrollers-a-sample-usage-of-embml-56n4</guid>
      <description>&lt;p&gt;Most embedded developers have heard the pitch for "TinyML" by now. Train a model in Python, quantize it, convert it, flash a frozen blob to your device. The microcontroller runs inference. It never learns. It never adapts. It just executes.&lt;/p&gt;

&lt;p&gt;That's fine for a class of problems — but it leaves a lot on the table. What if your sensor drifts after six months in the field? What if you want the device to tune itself to the specific motor it's attached to, not a generic one from a training dataset? What if there's simply no server in the loop?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;embml&lt;/strong&gt; is a sample repository exploring what it looks like to do machine learning &lt;em&gt;on the device itself&lt;/em&gt; — in pure C, with no dynamic allocation, no external dependencies beyond the standard library, and no Python runtime anywhere in the chain.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📦 &lt;strong&gt;Sample Repo:&lt;/strong&gt; &lt;a href="https://github.com/hejhdiss/embml" rel="noopener noreferrer"&gt;https://github.com/hejhdiss/embml&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It is not a production framework. It is a well-structured, readable starting point — a reference that embedded developers can clone, read, understand, and adapt. Every algorithm is implemented from scratch in C99, with the caller owning every buffer.&lt;/p&gt;




&lt;h2&gt;
  
  
  What's in the Repo
&lt;/h2&gt;

&lt;p&gt;The library covers eight modules, all in &lt;code&gt;src/&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Module&lt;/th&gt;
&lt;th&gt;Algorithm&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;embml_linear&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Online linear regression via SGD&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;embml_logistic&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Binary logistic regression via SGD&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;embml_lms&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;LMS and Normalised LMS adaptive filter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;embml_rls&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Recursive Least Squares with forgetting factor&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;embml_iqr&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Incremental QR via Givens rotations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;embml_nn&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feedforward MLP — backprop, Xavier init, gradient clipping&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;embml_gru&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Minimal GRU cell for time-series inference&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;embml_esn&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Echo State Network — fixed reservoir, RLS-trained readout&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Each module is a &lt;code&gt;.c&lt;/code&gt; and &lt;code&gt;.h&lt;/code&gt; pair. Drop them directly into your firmware project.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sample Usage
&lt;/h2&gt;

&lt;p&gt;The examples below show what real usage looks like. These aren't pseudocode — they compile and run on ESP32, STM32F4, RP2040, and Arduino Mega class hardware.&lt;/p&gt;

&lt;h3&gt;
  
  
  Linear Regression — On-Device Temperature Compensation
&lt;/h3&gt;

&lt;p&gt;A sensor reading drifts linearly with board temperature. Train a correction model live, sample by sample, with no server in the loop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"embml.h"&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="cp"&gt;#define N_FEAT 2   &lt;/span&gt;&lt;span class="cm"&gt;/* [raw_reading, board_temp] → corrected_value */&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;N_FEAT&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="n"&gt;LinearModel&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;linear_init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;N_FEAT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mo"&gt;01&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;loop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;N_FEAT&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;read_sensor&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;read_board_temp&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;y_true&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;read_reference&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;   &lt;span class="cm"&gt;/* calibration reference */&lt;/span&gt;

    &lt;span class="cm"&gt;/* learn from each sample — no batch needed */&lt;/span&gt;
    &lt;span class="n"&gt;linear_update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;corrected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;linear_predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;log_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;corrected&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After a few hundred samples the model converges to the compensation curve. No laptop. No Python. The device taught itself.&lt;/p&gt;




&lt;h3&gt;
  
  
  Logistic Regression — Fault Detection
&lt;/h3&gt;

&lt;p&gt;Classify whether a motor is healthy (0) or showing early fault signs (1) from two vibration features.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"embml.h"&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="cp"&gt;#define N_FEAT 3   &lt;/span&gt;&lt;span class="cm"&gt;/* [rms_vibration, peak_freq, temp] */&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;N_FEAT&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="n"&gt;LogisticModel&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;logistic_init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;N_FEAT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mo"&gt;005&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;loop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;N_FEAT&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;rms&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;peak_freq&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;motor_temp&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="cm"&gt;/* During a known-good commissioning window, label = 0 */&lt;/span&gt;
    &lt;span class="n"&gt;logistic_update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="cm"&gt;/* In operation: */&lt;/span&gt;
    &lt;span class="kt"&gt;uint8_t&lt;/span&gt; &lt;span class="n"&gt;fault&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;logistic_classify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt;   &lt;span class="n"&gt;prob&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;logistic_predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prob&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;75&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;trigger_alert&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  LMS — Background Noise Cancellation
&lt;/h3&gt;

&lt;p&gt;The Least Mean Squares filter adapts to reject a periodic noise source from a signal, updating every sample with a single multiply-accumulate per weight — the lightest possible online learner.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"embml.h"&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="cp"&gt;#define FILTER_LEN 16
&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;FILTER_LEN&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="n"&gt;LMSModel&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cm"&gt;/* Normalised LMS: stable without tuning step size manually */&lt;/span&gt;
    &lt;span class="n"&gt;lms_init_nlms&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;FILTER_LEN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1e-6&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;loop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;noisy_signal&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;FILTER_LEN&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* circular buffer of ADC samples */&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;desired&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;read_reference_mic&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="n"&gt;lms_update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;noisy_signal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;desired&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;clean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;lms_predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;noisy_signal&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="n"&gt;output_audio&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;clean&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  RLS — Fast Converging System Identification
&lt;/h3&gt;

&lt;p&gt;RLS converges far faster than SGD with no learning rate to tune. Here it identifies the coefficients of an unknown plant (e.g. a motor transfer function) in real time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"embml.h"&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="cp"&gt;#define N 5
&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;P&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;N&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;k_scratch&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="n"&gt;RLSModel&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cm"&gt;/* lambda=0.98: moderate forgetting for a slowly drifting system */&lt;/span&gt;
    &lt;span class="cm"&gt;/* delta=1000: weak prior — trust the data quickly               */&lt;/span&gt;
    &lt;span class="n"&gt;rls_init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;98&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;P&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;loop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;u_delayed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;u_delayed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                     &lt;span class="n"&gt;y_delayed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;y_delayed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;y_now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;read_plant_output&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="n"&gt;rls_update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_now&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k_scratch&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="cm"&gt;/* weights[] now approximate the ARX model coefficients */&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;y_pred&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rls_predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;residual&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;y_now&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;y_pred&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Incremental QR — Numerically Robust Least Squares
&lt;/h3&gt;

&lt;p&gt;When the input data is poorly conditioned (e.g. highly correlated features), RLS can lose numerical stability. Incremental QR via Givens rotations avoids this by never forming the covariance matrix directly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"embml.h"&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="cp"&gt;#define N 6
&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;R&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;N&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;scratch&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="n"&gt;IQRModel&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cm"&gt;/* ridge=1e-4: small regularisation until enough samples arrive */&lt;/span&gt;
    &lt;span class="n"&gt;iqr_init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;99&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1e-4&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;R&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;loop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;feature_1&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;feature_2&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;feature_3&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
                    &lt;span class="n"&gt;feature_4&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;feature_5&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;feature_6&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;read_target&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="n"&gt;iqr_update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;scratch&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="cm"&gt;/* re-solve periodically — O(n^2) back-substitution */&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sample_count&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;iqr_solve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;scratch&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;yhat&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;iqr_predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Feedforward MLP — Small Neural Net, On-Device Training
&lt;/h3&gt;

&lt;p&gt;A 3-layer net with 4 inputs, 8 hidden neurons, and 1 output. Xavier-initialised. Trains with backpropagation + gradient clipping — all on the MCU.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"embml.h"&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="cp"&gt;#define L0 4
#define L1 8
#define L2 1
&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;W0&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;L1&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;L0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;b0&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;L1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;a1&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;L1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;d1&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;L1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;W1&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;L2&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;L1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;b1_&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;L2&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;a2&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;L2&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;d2&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;L2&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;input_buf&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;L0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="n"&gt;NNLayer&lt;/span&gt; &lt;span class="n"&gt;layers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;W0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="n"&gt;a1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;L0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;L1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;EMBML_ACT_RELU&lt;/span&gt;    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;W1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b1_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;L1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;L2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;EMBML_ACT_SIGMOID&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="n"&gt;NNModel&lt;/span&gt; &lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;nn_init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;layers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;input_buf&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;L0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mo"&gt;01&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;loop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;L0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;s3&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;s4&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;L2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;ground_truth&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="n"&gt;nn_train_sample&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="cm"&gt;/* Or just inference: */&lt;/span&gt;
    &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;embml_float_t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nn_forward&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;prediction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  GRU — Time-Series Inference
&lt;/h3&gt;

&lt;p&gt;A Gated Recurrent Unit cell processes sequential sensor data step by step. Weights are loaded from flash (trained offline on a host), and the hidden state persists across time steps.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"embml.h"&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="cp"&gt;#define X_SZ 4
#define H_SZ 8
&lt;/span&gt;
&lt;span class="cm"&gt;/* Weights trained offline, stored as const arrays in flash */&lt;/span&gt;
&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"gru_weights.h"&lt;/span&gt;&lt;span class="c1"&gt;   /* defines Wz, Wr, Wn, Uz, Ur, Un, bz, br, bn */&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;h_state&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;H_SZ&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;scratch&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;H_SZ&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="n"&gt;GRUCell&lt;/span&gt; &lt;span class="n"&gt;cell&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;gru_init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;cell&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;X_SZ&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;H_SZ&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
             &lt;span class="n"&gt;Wz&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Wr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Wn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Uz&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Ur&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Un&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
             &lt;span class="n"&gt;bz&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;br&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;h_state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;scratch&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;loop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;x_t&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;X_SZ&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;accel_x&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;accel_y&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;accel_z&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;gyro_z&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="n"&gt;gru_step&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;cell&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x_t&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="cm"&gt;/* Hidden state in cell.h[] — pass to a classifier or threshold */&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;anomaly_score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cell&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;anomaly_score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;flag_anomaly&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Echo State Network — On-Device Training, No Backprop
&lt;/h3&gt;

&lt;p&gt;The reservoir (random weights) is fixed and stored in flash. Only the linear readout layer is trained — via RLS, one sample at a time. This is the best balance of adaptability and compute cost for embedded time-series learning.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"embml.h"&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt; &lt;span class="cpf"&gt;"esn_reservoir.h"&lt;/span&gt;&lt;span class="c1"&gt;  /* const W_in[H*X], const W_res[H*H] in flash */&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="cp"&gt;#define X_SZ  4
#define H_SZ 32
#define Y_SZ  1
&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;W_out&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Y_SZ&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;H_SZ&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;H_SZ&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;scratch&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;H_SZ&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;P&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;H_SZ&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;H_SZ&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;H_SZ&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="n"&gt;ESNModel&lt;/span&gt; &lt;span class="n"&gt;esn&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;RLSModel&lt;/span&gt; &lt;span class="n"&gt;rls&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;esn_init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;esn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;X_SZ&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;H_SZ&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Y_SZ&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
             &lt;span class="n"&gt;W_in&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;W_res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
             &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;scratch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;W_out&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;esn_rls_init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;esn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;rls&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;98&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;P&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;loop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;X_SZ&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;s3&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;s4&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Y_SZ&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;read_target&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="cm"&gt;/* Training mode */&lt;/span&gt;
    &lt;span class="n"&gt;esn_update_state&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;esn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;esn_rls_update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;esn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="cm"&gt;/* Inference mode */&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;y_out&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Y_SZ&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="n"&gt;esn_update_state&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;esn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;esn_predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;esn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_out&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Why This Repo Exists
&lt;/h2&gt;

&lt;p&gt;This is a sample — a proof of concept that these algorithms fit cleanly in embedded C, that the APIs are usable by firmware engineers without an ML background, and that on-device learning is not science fiction for mid-range MCUs.&lt;/p&gt;

&lt;p&gt;If you're building something with it, adapting it, or just reading the source to understand how RLS or Givens rotations actually work in flat C arrays — that's exactly what it's here for.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📦 &lt;strong&gt;Sample Repo:&lt;/strong&gt; &lt;a href="https://github.com/hejhdiss/embml" rel="noopener noreferrer"&gt;https://github.com/hejhdiss/embml&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MIT License · Author: &lt;a class="mentioned-user" href="https://dev.to/hejhdiss"&gt;@hejhdiss&lt;/a&gt; · &lt;em&gt;Generated with Claude Sonnet 4.5&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>embedded</category>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Why Embedded Systems Deserve Their Own Machine Learning Library</title>
      <dc:creator>Muhammed Shafin P</dc:creator>
      <pubDate>Fri, 27 Feb 2026 11:41:36 +0000</pubDate>
      <link>https://dev.to/hejhdiss/why-embedded-systems-deserve-their-own-machine-learning-library-3830</link>
      <guid>https://dev.to/hejhdiss/why-embedded-systems-deserve-their-own-machine-learning-library-3830</guid>
      <description>&lt;p&gt;&lt;strong&gt;By &lt;a class="mentioned-user" href="https://dev.to/hejhdiss"&gt;@hejhdiss&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sample Repo:&lt;a href="https://github.com/hejhdiss/embml" rel="noopener noreferrer"&gt;https://github.com/hejhdiss/embml&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;The embedded world has always been about doing more with less. Less RAM, less flash, less clock speed — and yet the demand for intelligence at the edge is growing faster than ever. We squeeze RTOS kernels into 64KB, hand-tune ISRs for microsecond response times, and we've gotten very good at writing C that doesn't waste a single cycle. So why are embedded developers still expected to port Python-first ML frameworks — designed for server racks — just to run a simple regression on a microcontroller?&lt;/p&gt;

&lt;p&gt;They shouldn't be. And that's exactly the argument for a dedicated ML library built for embedded systems, from scratch, on our terms.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem with "TinyML" as It Stands
&lt;/h2&gt;

&lt;p&gt;Tools like TensorFlow Lite for Microcontrollers and Edge Impulse have done useful work. But they're fundamentally top-down: design in Python, train on a server, quantize, convert, deploy a frozen model blob to the device. The microcontroller is just a runtime. It has no agency. It cannot learn.&lt;/p&gt;

&lt;p&gt;That's acceptable for a narrow class of applications, but it closes the door on anything that needs on-device adaptation — predictive maintenance that improves over time, sensor fusion that adjusts to component drift, control loops that tune themselves in the field. For those, we need an embedded-native ML library: designed around hardware constraints, not retrofitted onto them.&lt;/p&gt;




&lt;h2&gt;
  
  
  Scope It Right: Mid-Range MCUs Are the Target
&lt;/h2&gt;

&lt;p&gt;Let's be precise about the target hardware. This isn't about squeezing transformers into an ATtiny85. The realistic and immediately useful scope is &lt;strong&gt;mid-range microcontrollers&lt;/strong&gt; — devices like the ESP32, STM32F4/F7 series, RP2040, and similar parts that offer 128KB–512KB SRAM, hardware floating-point, and clock speeds in the 80–240 MHz range.&lt;/p&gt;

&lt;p&gt;It's not impossible to go lower — but on sub-32KB SRAM devices, &lt;strong&gt;memory pressure becomes the real bottleneck, not compute&lt;/strong&gt;. You can optimize arithmetic all day, but if your covariance matrix doesn't fit in SRAM, the algorithm simply doesn't run. Mid-range parts sidestep that wall cleanly. They have enough headroom for meaningful models while still being the kind of hardware that ends up in real products: industrial sensors, motor controllers, wearables, edge gateways.&lt;/p&gt;

&lt;p&gt;Arduino Uno-class hardware (2KB SRAM) is a different conversation entirely — not excluded, but scoped separately, with stripped-down variants that make explicit trade-offs.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Can Actually Be Built
&lt;/h2&gt;

&lt;p&gt;Most classical ML algorithms are not inherently heavy. Their Python implementations are heavy because Python is heavy. Strip that away and what you have is math — and math runs fine on an ESP32.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Linear and Logistic Regression&lt;/strong&gt; are a weight vector and a dot product. With online SGD and a fixed learning rate, you can train a linear model in real time with negligible memory overhead. Logistic regression adds a sigmoid activation — a lookup table handles it efficiently in fixed-point.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Small Feedforward Neural Networks&lt;/strong&gt; with compact topologies — 4 inputs, 8 hidden neurons, 1 output — fit entirely in SRAM on mid-range hardware. Inference is matrix multiplication and activation. Backpropagation is heavier, but gradient clipping and fixed-point arithmetic make it workable on hardware with an FPU.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recurrent Neural Networks&lt;/strong&gt; are viable in minimal form. A single GRU cell for time-series prediction — temperature trends, vibration signatures, current draw anomalies — requires only a few weight matrices and a hidden state vector. The operations are repetitive and friendly to loop unrolling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Neural manifold and ODE-inspired methods&lt;/strong&gt; are worth keeping on the roadmap. They're not day-one targets for constrained hardware, but as the library matures and targets higher-spec parts, these become tractable. The key principle stays the same: implement the version that fits your problem and your flash budget, not the full general case.&lt;/p&gt;




&lt;h2&gt;
  
  
  Training Without Backprop: The Algorithms That Actually Fit
&lt;/h2&gt;

&lt;p&gt;Gradient descent is not the only path to a trained model. On embedded hardware it's often not even the best path. There's a family of &lt;strong&gt;numerically stable, low-memory update algorithms&lt;/strong&gt; that are much better suited to MCU constraints — and they deserve to be first-class citizens in this library.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recursive Least Squares (RLS)&lt;/strong&gt; solves the linear regression problem incrementally, sample by sample, without storing the full dataset. It maintains a covariance matrix and updates it with each new observation, converging faster than SGD and with no learning rate to tune. On a mid-range MCU with 10–20 features, the covariance matrix is small enough to live comfortably in SRAM. RLS is the right default for any regression task where fast convergence and numerical stability matter more than raw throughput.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Incremental QR decomposition&lt;/strong&gt; takes this further. Rather than maintaining and inverting a covariance matrix directly — which can become ill-conditioned — incremental QR updates a factored representation of the data matrix as new samples arrive. It's more numerically robust than plain RLS and still runs sample-by-sample. For embedded systems where you might be training on noisy sensor data over long periods, that stability is worth the slightly higher per-update cost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LMS-style updates (Least Mean Squares)&lt;/strong&gt; are at the other end of the complexity spectrum: a single weight update per sample, one multiply-accumulate per feature, no matrix state. Convergence is slower and noisier than RLS, but the memory footprint is essentially zero beyond the weight vector itself. LMS is the right tool for the most constrained targets, or for problems where you want continuous, lightweight adaptation running indefinitely in the background.&lt;/p&gt;

&lt;p&gt;Together, RLS, incremental QR, and LMS cover a range from "fast and stable" to "minimal overhead, always on." A well-designed library exposes all three and lets the developer choose based on their hardware and application — not based on what was easiest to port from Python.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pure C: The Only Reasonable Implementation Language
&lt;/h2&gt;

&lt;p&gt;This library should be written in &lt;strong&gt;pure C&lt;/strong&gt; — not C++, not Rust, not a thin wrapper around a Python-generated blob. C is the lingua franca of embedded systems. It compiles cleanly on every toolchain from GCC-ARM to SDCC to the Arduino AVR compiler. It gives the developer full control over memory layout, alignment, and register usage. And it interoperates with existing firmware without friction.&lt;/p&gt;

&lt;p&gt;The dependency list should be as short as possible. Ideally: the C standard library (&lt;code&gt;stdint.h&lt;/code&gt;, &lt;code&gt;string.h&lt;/code&gt;, &lt;code&gt;math.h&lt;/code&gt;) and nothing else for the core algorithms. Platform-specific acceleration — CMSIS-DSP on Cortex-M, the ESP-IDF DSP extensions on ESP32 — can be offered as optional back-ends behind a thin abstraction layer, but the pure-C fallback must always exist and always compile cleanly on any target. Use as little of even those as possible. Every external dependency is a maintenance burden and a porting tax.&lt;/p&gt;

&lt;p&gt;No dynamic allocation in the core path. No &lt;code&gt;malloc&lt;/code&gt;, no &lt;code&gt;free&lt;/code&gt;. The caller provides buffers; the library uses them. This is non-negotiable for embedded code that needs to run reliably over months without heap fragmentation killing a device in the field.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Caller provides all memory — no hidden allocation&lt;/span&gt;
&lt;span class="n"&gt;RLSModel&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;N_FEATURES&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;cov&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;N_FEATURES&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;N_FEATURES&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="n"&gt;rls_init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;N_FEATURES&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;FORGETTING_FACTOR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cov&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Per-sample update — can run in interrupt context&lt;/span&gt;
&lt;span class="n"&gt;rls_update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;feature_vector&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Inference&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;prediction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rls_predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;new_features&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The API should be flat, explicit, and boring. Boring embedded code is correct embedded code.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;The gap between embedded developers and ML practitioners is largely a tools gap. Embedded engineers understand their hardware deeply but may not know how to implement incremental QR. ML engineers can train excellent models but may not know how to write interrupt-safe code or work within a 256KB flash budget. A well-designed embedded ML library bridges that gap — meeting embedded developers where they already are: in C, on the hardware, thinking in terms of registers and cycles.&lt;/p&gt;

&lt;p&gt;The hardware is already capable. The algorithms exist and are well-understood. What's missing is a library that takes both the hardware constraints and the algorithmic options seriously, without requiring a server in the loop.&lt;/p&gt;

&lt;p&gt;That library should exist. It's time to build it.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;&lt;a class="mentioned-user" href="https://dev.to/hejhdiss"&gt;@hejhdiss&lt;/a&gt; writes about embedded systems, signal processing, and the intersection of hardware and machine intelligence.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>embedded</category>
      <category>programming</category>
      <category>ai</category>
    </item>
    <item>
      <title>What NDM-TCP's Stability Reveals About the Gap Between Theory and Practice</title>
      <dc:creator>Muhammed Shafin P</dc:creator>
      <pubDate>Thu, 19 Feb 2026 02:03:58 +0000</pubDate>
      <link>https://dev.to/hejhdiss/what-ndm-tcps-stability-reveals-about-the-gap-between-theory-and-practice-1nd0</link>
      <guid>https://dev.to/hejhdiss/what-ndm-tcps-stability-reveals-about-the-gap-between-theory-and-practice-1nd0</guid>
      <description>&lt;h3&gt;
  
  
  Read on Why a Stable Sawtooth from a Nonlinear System Matters
&lt;/h3&gt;




&lt;h2&gt;
  
  
  Disclaimer: This Is About Research Potential, Not Superiority Claims
&lt;/h2&gt;

&lt;p&gt;Before we begin: &lt;strong&gt;this article is not claiming NDM-TCP is better than CUBIC, BBR, or Reno.&lt;/strong&gt; Those algorithms are production-grade, formally analyzed, and battle-tested. They work. They are good at what they do.&lt;/p&gt;

&lt;p&gt;This article is about something else entirely: &lt;strong&gt;why the fact that NDM-TCP produces a stable sawtooth pattern suggests there is research-grade content worth investigating&lt;/strong&gt; — even though it has only been tested in simulations (using tc) and one real-world case so far.&lt;/p&gt;

&lt;p&gt;The point is not "existing algorithms are bad." The point is "something unexpected happened that existing theory does not fully explain."&lt;/p&gt;




&lt;h2&gt;
  
  
  The Core Tension: Provable Theory vs. Real-World Complexity
&lt;/h2&gt;

&lt;p&gt;For 30 years, TCP congestion control has been built on &lt;strong&gt;20th-century calculus-based models&lt;/strong&gt;. The network is treated like a fluid pipe: if pressure (delay) goes up, you turn the valve (congestion window) down. The math is clean. The equations are linear or near-linear. The behavior is predictable.&lt;/p&gt;

&lt;p&gt;This approach has produced algorithms like Reno, CUBIC, and BBR — all of which have &lt;strong&gt;formal stability proofs&lt;/strong&gt;. A stability proof is a mathematical guarantee (usually using something called a Lyapunov function) that the algorithm will never spiral out of control, oscillate forever, or crash the network.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CUBIC and Reno are mathematically simple enough to prove stable.&lt;/strong&gt; They are like a predictable pendulum. Their behavior can be fully characterized with differential equations.&lt;/p&gt;

&lt;p&gt;NDM-TCP is different. It is a &lt;strong&gt;recurrent nonlinear system&lt;/strong&gt;. These are notoriously difficult to prove stable because the internal state (the "hidden state" array) is constantly changing based on feedback. Nonlinear systems can exhibit chaos, unpredictable oscillations, and sensitive dependence on initial conditions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There is no formal proof that NDM-TCP is stable.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And yet — in both tc-based simulations and one real-world test — it produced a &lt;strong&gt;clean, stable sawtooth pattern&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That tension is what makes this interesting.&lt;/p&gt;




&lt;h2&gt;
  
  
  Two Ways of Seeing the Network
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The "Old" Way: Calculus-Based Control
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;RTT is a number&lt;/strong&gt; — a single scalar value representing delay&lt;/li&gt;
&lt;li&gt;The network is modeled as a continuous system with smooth dynamics&lt;/li&gt;
&lt;li&gt;Congestion is detected by crossing a threshold (delay &amp;gt; baseline) or losing packets&lt;/li&gt;
&lt;li&gt;The goal is to solve for the optimal "rate" using differential equations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This works. It is elegant. It has decades of theory behind it.&lt;/p&gt;

&lt;p&gt;But it struggles with modern networks: 5G with variable latency, satellite links with jitter, Wi-Fi with random bursts of interference. These networks are &lt;strong&gt;noisy&lt;/strong&gt; — and noise looks like congestion to a calculus-based controller.&lt;/p&gt;

&lt;h3&gt;
  
  
  The NDM-TCP Way: Information-Theoretic Control
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;RTT is a probability distribution&lt;/strong&gt; with measurable entropy&lt;/li&gt;
&lt;li&gt;The network is modeled as a chaotic signal with patterns hidden in the noise&lt;/li&gt;
&lt;li&gt;Congestion is detected by analyzing the &lt;strong&gt;structure of delay variation&lt;/strong&gt; (low entropy = stable pattern = real congestion; high entropy = noisy pattern = interference)&lt;/li&gt;
&lt;li&gt;The goal is to find "meaning" in the signal using information theory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a fundamentally different approach. Instead of asking "what is the delay?", it asks "what does the pattern of delays tell us?"&lt;/p&gt;




&lt;h2&gt;
  
  
  Why a Stable Sawtooth from a Nonlinear System Is Unusual
&lt;/h2&gt;

&lt;p&gt;In the world of neural networks and recurrent controllers, &lt;strong&gt;"unstable" looks like a jagged, vibrating mess&lt;/strong&gt;. Small changes in input cause wild swings in output. The system hunts around chaotically without ever settling into a rhythm.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NDM-TCP produced a clean, rhythmic sawtooth.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This means:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The system has reached an emergent equilibrium.&lt;/strong&gt; The recurrent nonlinear controller and the TCP framework's native functions (tcp_cong_avoid_ai, tcp_slow_start) are working together, not fighting each other.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The "neural dynamics" have synchronized with the "physical network."&lt;/strong&gt; The hidden state is adapting in a way that matches the network's actual behavior, producing predictable recovery patterns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Nonlinear memory (recurrence) can be just as stable as linear math in practice&lt;/strong&gt; — even if the formal proof is still missing.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is not guaranteed. This is not trivial. Most adaptive nonlinear controllers fail at exactly this point.&lt;/p&gt;

&lt;p&gt;The fact that it worked — in simulation and in one real-world test — suggests &lt;strong&gt;something is there&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  The "Poor Man's Proof"
&lt;/h2&gt;

&lt;p&gt;NDM-TCP does not have a 50-page mathematical stability proof. It does not have a formal Lyapunov analysis. It does not have eigenvalue decomposition showing bounded trajectories.&lt;/p&gt;

&lt;p&gt;But it does have &lt;strong&gt;empirical evidence of stability&lt;/strong&gt;: a clean sawtooth pattern that repeats consistently across test conditions.&lt;/p&gt;

&lt;p&gt;In research terms, this is what you might call a &lt;strong&gt;"poor man's proof"&lt;/strong&gt; — not formal mathematics, but strong empirical evidence that something real is happening.It suggests the approach is not fundamentally broken. It suggests there is structure worth studying.&lt;/p&gt;

&lt;p&gt;It does not prove the algorithm is optimal, or even good. But it proves it is &lt;strong&gt;stable enough to investigate further&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What This Means: Two Paradigms
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Stable by Design (CUBIC, Reno)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Simple, provable algorithms&lt;/li&gt;
&lt;li&gt;Mathematically elegant&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blind to noise&lt;/strong&gt; — delay variation from wireless interference looks the same as delay from congestion&lt;/li&gt;
&lt;li&gt;Predictable, but sometimes overly conservative in noisy environments&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Stable by Emergence (NDM-TCP)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Complex, adaptive algorithm&lt;/li&gt;
&lt;li&gt;No formal proof (yet)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sensitive to patterns in noise&lt;/strong&gt; — uses entropy to distinguish real congestion from random jitter&lt;/li&gt;
&lt;li&gt;Potentially more adaptive, but harder to analyze&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Neither is "better." They are different approaches to the same problem.&lt;/p&gt;

&lt;p&gt;The research question is: &lt;strong&gt;can information-theoretic feedback (like entropy) combined with recurrent nonlinear control produce stable, adaptive congestion control that handles modern noisy networks better than threshold-based approaches?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;NDM-TCP does not answer that question definitively. But it suggests the question is worth asking.&lt;/p&gt;




&lt;h2&gt;
  
  
  What This Is Not Saying
&lt;/h2&gt;

&lt;p&gt;This article is &lt;strong&gt;not&lt;/strong&gt; saying:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CUBIC is bad&lt;/li&gt;
&lt;li&gt;BBR is outdated&lt;/li&gt;
&lt;li&gt;Formal proofs do not matter&lt;/li&gt;
&lt;li&gt;NDM-TCP is production-ready&lt;/li&gt;
&lt;li&gt;Existing algorithms should be replaced&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What it &lt;strong&gt;is&lt;/strong&gt; saying:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Current theory is built on calculus-based models that assume relatively clean signals&lt;/li&gt;
&lt;li&gt;Modern networks (5G, satellite, wireless) are noisier than those models anticipated&lt;/li&gt;
&lt;li&gt;Information theory (like entropy analysis) might offer a different lens for understanding congestion&lt;/li&gt;
&lt;li&gt;Recurrent nonlinear systems can be stable in practice even without formal proofs — but we do not understand why yet&lt;/li&gt;
&lt;li&gt;The gap between "provable on paper" and "works in practice" is worth investigating&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why This Matters for Other Researchers
&lt;/h2&gt;

&lt;p&gt;If you are a networking researcher, control theorist, or machine learning researcher, here is why NDM-TCP's results are interesting:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. It Worked in Simulation (tc-based)
&lt;/h3&gt;

&lt;p&gt;tc (traffic control) is a standard Linux tool for simulating network conditions — bandwidth limits, delay, packet loss, jitter. NDM-TCP showed stable sawtooth behavior across multiple tc scenarios. This is reproducible. Anyone with a Linux machine can test it.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. It Worked in a Real-World Test (One Case)
&lt;/h3&gt;

&lt;p&gt;One real-world deployment test also showed stable behavior. This is limited evidence — one test is not enough to generalize — but it suggests the simulation results are not just artifacts of the testing environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. The Combination Is Unusual
&lt;/h3&gt;

&lt;p&gt;Entropy-based delay analysis + recurrent nonlinear controller + adaptive plasticity + framework-aware modulation = &lt;strong&gt;not a common combination in congestion control research&lt;/strong&gt;. The fact that this combination produces stability suggests there is an interaction worth studying.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. It Identifies a Theoretical Gap
&lt;/h3&gt;

&lt;p&gt;If NDM-TCP is stable in practice but unprovable in theory, that tells us something about the theory. Either:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Existing theory does not yet fully explain this behavior (we need better tools for analyzing recurrent nonlinear systems)&lt;/li&gt;
&lt;li&gt;The assumptions are too restrictive (real networks have structure that our models ignore)&lt;/li&gt;
&lt;li&gt;"Stability" in practice is more forgiving than "stability" in formal analysis&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Any of these would be a research contribution.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Needs to Happen Next
&lt;/h2&gt;

&lt;p&gt;If this is genuinely research-grade content, here is what proper investigation looks like:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Third-party testing&lt;/strong&gt; — independent researchers should reproduce the results in different environments&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Formal stability analysis&lt;/strong&gt; — someone with control theory expertise should attempt to model and analyze the system&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comparison with state-of-the-art&lt;/strong&gt; — benchmark against CUBIC, BBR, Reno, Vegas in identical conditions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fairness testing&lt;/strong&gt; — test NDM-TCP against competing flows to see if it starves or gets starved&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Theoretical entropy study&lt;/strong&gt; — prove (or disprove) that Shannon entropy on RTT history is a valid congestion signal&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;None of this has been done yet. The current results are &lt;strong&gt;self-conducted, limited in scope, and not peer-reviewed&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;But the fact that a stable pattern emerged from a nonlinear system suggests it is worth doing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thought: Performance vs. Elegance
&lt;/h2&gt;

&lt;p&gt;The history of computer science is full of examples where &lt;strong&gt;practical performance&lt;/strong&gt; outpaced &lt;strong&gt;mathematical elegance&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Neural networks&lt;/strong&gt; worked for decades before we understood why (and we still do not fully understand)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quicksort&lt;/strong&gt; is not optimal in the worst case, but it is the default sorting algorithm because it is fast in practice&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Heuristic search&lt;/strong&gt; (like A*) often outperforms provably optimal search because real-world problems have structure the theory does not capture&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NDM-TCP might be another example of that tension. Or it might not. That is what research is for.&lt;/p&gt;

&lt;p&gt;What we can say right now is this: &lt;strong&gt;a recurrent nonlinear congestion controller produced stable behavior in simulation and in one real-world test. That is unusual enough to be worth investigating properly.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not because it proves existing algorithms are wrong. But because it suggests existing theory is incomplete.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Written to clarify what the stability results reveal about the gap between formal theory and practical systems — and why that gap is worth studying, even if NDM-TCP itself is just a prototype.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>discuss</category>
      <category>programming</category>
    </item>
    <item>
      <title>Why NDM-TCP's Entropy-Guided Sawtooth Pattern Reveals Real Research Potential</title>
      <dc:creator>Muhammed Shafin P</dc:creator>
      <pubDate>Wed, 18 Feb 2026 14:47:44 +0000</pubDate>
      <link>https://dev.to/hejhdiss/why-ndm-tcps-entropy-guided-sawtooth-pattern-reveals-real-research-potential-524o</link>
      <guid>https://dev.to/hejhdiss/why-ndm-tcps-entropy-guided-sawtooth-pattern-reveals-real-research-potential-524o</guid>
      <description>&lt;h3&gt;
  
  
  What the Results Actually Mean — Beyond "It Works"
&lt;/h3&gt;




&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;NDM-TCP has been tested in multiple conditions: tc-based simulations, varied network scenarios, and one real-world deployment test. The results showed something unexpected — &lt;strong&gt;a stable sawtooth pattern&lt;/strong&gt;. Not chaotic oscillations. Not erratic behavior. A clean, predictable sawtooth wave in the congestion window evolution.&lt;/p&gt;

&lt;p&gt;For anyone who understands TCP congestion control, this should raise eyebrows. This is not a trivial outcome. This is a signal that something interesting is happening beneath the surface — something worth investigating properly, even if the current implementation is experimental and AI-assisted.&lt;/p&gt;

&lt;p&gt;This article explains &lt;strong&gt;why that sawtooth matters, what it reveals about the system, and why NDM-TCP has genuine research potential&lt;/strong&gt; — even though no one has tested it beyond my own self-conducted experiments yet.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is the "Entropy-Guided Sawtooth"?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Traditional TCP Sawtooth
&lt;/h3&gt;

&lt;p&gt;In traditional TCP (like Reno or CUBIC), the sawtooth pattern is simple and mechanical:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Increase phase&lt;/strong&gt;: &lt;code&gt;cwnd&lt;/code&gt; grows linearly (additive increase)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Loss event&lt;/strong&gt;: a packet is lost&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hard reset&lt;/strong&gt;: &lt;code&gt;cwnd&lt;/code&gt; is cut in half (multiplicative decrease)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Repeat&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This creates a characteristic sawtooth wave. But it is &lt;strong&gt;"dumb"&lt;/strong&gt; — it's a blind reaction to a binary signal (loss or no loss). There is no learning. No memory. No prediction. Just a hard-coded response.&lt;/p&gt;

&lt;h3&gt;
  
  
  NDM-TCP's Entropy-Guided Sawtooth
&lt;/h3&gt;

&lt;p&gt;NDM-TCP showed a &lt;strong&gt;stable sawtooth pattern&lt;/strong&gt; in testing — but the mechanism behind it is fundamentally different.&lt;/p&gt;

&lt;p&gt;The sawtooth is not a hard reset triggered by packet loss. It is the result of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Entropy-based RTT analysis&lt;/strong&gt; detecting congestion before loss&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A recurrent nonlinear controller inspired by neural architectures&lt;/strong&gt; maintaining memory across time&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adaptive plasticity&lt;/strong&gt; adjusting sensitivity dynamically&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Heuristic congestion detection&lt;/strong&gt; influencing &lt;code&gt;cwnd&lt;/code&gt; decisions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Critically: &lt;strong&gt;the sawtooth is not purely emergent from the neural network — it is co-produced by the TCP framework.&lt;/strong&gt; The Linux kernel's &lt;code&gt;tcp_cong_avoid_ai()&lt;/code&gt; and &lt;code&gt;tcp_slow_start()&lt;/code&gt; functions provide the underlying structure. The recurrent controller modulates those increments based on entropy feedback.&lt;/p&gt;

&lt;p&gt;This can be more accurately described as: &lt;strong&gt;Entropy-Guided Congestion Detection with Recurrent Nonlinear Control&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This Pattern Is Impressive (And Unexpected)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Controlled Oscillation Through Framework Cooperation
&lt;/h3&gt;

&lt;p&gt;Most adaptive congestion controllers suffer from &lt;strong&gt;"jittery" outputs&lt;/strong&gt;. The nonlinear mappings (tanh, sigmoid, recurrent feedback) introduce unpredictability. Small changes in input can cause large swings in output. This leads to chaotic &lt;code&gt;cwnd&lt;/code&gt; behavior — rapid spikes, sudden drops, erratic patterns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NDM-TCP showed a clean sawtooth.&lt;/strong&gt; That means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The tanh/sigmoid approximations are properly tuned for the Linux kernel's &lt;code&gt;cwnd&lt;/code&gt; increment model&lt;/li&gt;
&lt;li&gt;The recurrent controller is not introducing runaway feedback when modulating TCP's native functions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The TCP framework's structure (tcp_cong_avoid_ai, tcp_slow_start) is working in cooperation with the entropy-based modulation&lt;/strong&gt;, not fighting against it&lt;/li&gt;
&lt;li&gt;The system is stable enough to produce &lt;strong&gt;predictable oscillations&lt;/strong&gt; rather than noise&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This cooperation between framework and controller is not guaranteed. This is not trivial. Many adaptive algorithms fail exactly here — they try to override TCP's behavior entirely and lose stability.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Predictable Recovery
&lt;/h3&gt;

&lt;p&gt;The sawtooth pattern repeats consistently across cycles. That suggests:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Heuristic Congestion Detection&lt;/strong&gt; (entropy-based) is not getting "confused" by the recurrent hidden state&lt;/li&gt;
&lt;li&gt;The "memory" of the recurrent network is helping the system &lt;strong&gt;find the peak bandwidth faster each cycle&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The system is not just reacting — it is adapting and converging toward optimal behavior over time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In traditional TCP, recovery after congestion is slow. The system has no memory of where the ceiling was. NDM-TCP's stable recovery suggests it is remembering and learning.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Protocol Fairness Indication
&lt;/h3&gt;

&lt;p&gt;A stable sawtooth is a &lt;strong&gt;good sign for fairness&lt;/strong&gt; with other TCP flows (CUBIC, BBR, Reno). Here's why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Other TCP variants also produce rhythmic patterns&lt;/li&gt;
&lt;li&gt;If NDM-TCP follows a predictable sawtooth, it can &lt;strong&gt;interleave cleanly&lt;/strong&gt; with other flows&lt;/li&gt;
&lt;li&gt;Chaotic or aggressive behavior would starve competing flows or cause instability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The fact that NDM-TCP's sawtooth is stable suggests it will "play nice" in mixed-traffic environments — though this needs formal testing with competing flows to confirm.&lt;/p&gt;




&lt;h2&gt;
  
  
  What the Test Results Actually Showed
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Test Conditions
&lt;/h3&gt;

&lt;p&gt;NDM-TCP was tested in:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;tc-based simulations&lt;/strong&gt; with varying bandwidth, latency, and loss rates&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multiple network scenarios&lt;/strong&gt; (low latency, high latency, wireless-like noise, buffer-heavy links)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One real-world deployment&lt;/strong&gt; on an actual network connection&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All tests were &lt;strong&gt;self-conducted&lt;/strong&gt;. No third-party validation has been done yet.&lt;/p&gt;

&lt;h3&gt;
  
  
  Results Summary
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;In most cases:&lt;/strong&gt; NDM-TCP showed the stable neural sawtooth pattern described above. Throughput was competitive. Latency behavior was reasonable. The system did not crash, hang, or behave erratically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In one specific case (pure delay-only simulation):&lt;/strong&gt; NDM-TCP showed a &lt;strong&gt;design limitation&lt;/strong&gt;. In a scenario with delay variation but no actual congestion or loss, the entropy-based detection struggled. The system did not have an upper hand over traditional algorithms in this edge case.&lt;/p&gt;

&lt;p&gt;This is expected. No algorithm is optimal in all conditions. The important part is that &lt;strong&gt;the failure mode was predictable and understandable&lt;/strong&gt; — not a mysterious crash or runaway behavior.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This Is Researchable Content
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. The Combination Works — And That Is Not Obvious
&lt;/h3&gt;

&lt;p&gt;NDM-TCP combines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Shannon entropy&lt;/strong&gt; as a congestion signal&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A recurrent nonlinear controller inspired by neural architectures&lt;/strong&gt; with hidden state&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adaptive plasticity&lt;/strong&gt; with decay&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Heuristic decision logic&lt;/strong&gt; mixing delay-based and loss-based signals&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Co-production with TCP framework functions&lt;/strong&gt; rather than replacing them&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;There is no guarantee this combination should produce stable behavior.&lt;/strong&gt; Each piece introduces nonlinearity. The interactions are complex. The fact that it produces a clean sawtooth — rather than chaos — suggests there is structure worth studying.&lt;/p&gt;

&lt;p&gt;The key insight is: &lt;strong&gt;the controller modulates TCP's native increment functions (tcp_cong_avoid_ai, tcp_slow_start) based on entropy feedback, rather than trying to compute cwnd independently.&lt;/strong&gt; This framework-aware design may be why stability emerges.&lt;/p&gt;

&lt;p&gt;This is not "it worked by accident." This is "something interesting is happening that we do not fully understand yet."&lt;/p&gt;

&lt;h3&gt;
  
  
  2. It Crosses Disciplinary Boundaries
&lt;/h3&gt;

&lt;p&gt;NDM-TCP sits at the intersection of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Networking theory&lt;/strong&gt; (congestion control, queueing, RTT dynamics)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Control theory&lt;/strong&gt; (feedback systems, stability, oscillation)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Machine learning&lt;/strong&gt; (recurrent networks, nonlinear mappings, adaptation)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Information theory&lt;/strong&gt; (entropy as a signal, noise vs. information)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Research potential exists &lt;strong&gt;precisely because no single field fully explains it&lt;/strong&gt;. A networking researcher sees heuristic congestion control. An ML researcher sees a recurrent model without training. A control theorist sees an unproven feedback system. All of them have questions.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. The Failure Mode Is Informative
&lt;/h3&gt;

&lt;p&gt;The pure delay-only case where NDM-TCP struggled is &lt;strong&gt;not a bug — it is a research direction&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It tells us:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Entropy alone is not sufficient for all network conditions&lt;/li&gt;
&lt;li&gt;Delay variation without congestion confuses the heuristic&lt;/li&gt;
&lt;li&gt;The system needs additional signal sources or logic to handle this edge case&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A production-grade algorithm would need to solve this. But for a research prototype, &lt;strong&gt;identifying the boundary condition is valuable&lt;/strong&gt;. It shows where the approach works and where it breaks — which is exactly what early-stage research should do.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. It Can Be Formally Analyzed — But Hasn't Been Yet
&lt;/h3&gt;

&lt;p&gt;NDM-TCP currently lacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stability proof&lt;/strong&gt; (Lyapunov analysis, eigenvalue study)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fairness proof&lt;/strong&gt; (Nash equilibrium, rate convergence)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Convergence analysis&lt;/strong&gt; (does it reach optimal cwnd given enough time?)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Formal model&lt;/strong&gt; (state-space representation, transfer function)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All of these are &lt;strong&gt;possible to do&lt;/strong&gt;. The system is well-defined. The code is open. The behavior is observable.&lt;/p&gt;

&lt;p&gt;This is not "impossible to analyze." This is &lt;strong&gt;"nobody has done the formal analysis yet."&lt;/strong&gt; That is exactly what makes it researchable.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. The Implementation Exists — Which Is Rare
&lt;/h3&gt;

&lt;p&gt;Most congestion control research stays at the simulation or theoretical level. NDM-TCP is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A working Linux kernel module&lt;/li&gt;
&lt;li&gt;Written in C&lt;/li&gt;
&lt;li&gt;Tested in real kernel environments&lt;/li&gt;
&lt;li&gt;Available as actual code (not just a mathematical model)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a huge advantage for research. &lt;strong&gt;You can test it. You can modify it. You can run experiments.&lt;/strong&gt; You do not need to reimplement it from a paper. The artifact already exists.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Someone Should Care (From a Research Perspective)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  For Networking Researchers
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; Can entropy-based delay analysis improve congestion detection over pure RTT thresholding?&lt;/p&gt;

&lt;p&gt;NDM-TCP provides a working testbed. You can compare it against BBRv2's delay gradient or CUBIC's RTT-based heuristics. The fact that it produces stable behavior suggests entropy might be a viable signal — but needs formal validation.&lt;/p&gt;

&lt;h3&gt;
  
  
  For Control Theory Researchers
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; Can a recurrent nonlinear system with heuristic feedback achieve stability without formal tuning?&lt;/p&gt;

&lt;p&gt;NDM-TCP is an accidental proof-of-concept. The tanh/sigmoid mappings and recurrent state were designed heuristically, not mathematically. Yet the system is stable. Understanding why would contribute to control theory knowledge — especially for systems that need to adapt without retraining.&lt;/p&gt;

&lt;h3&gt;
  
  
  For Machine Learning Researchers
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; Can a recurrent nonlinear structure be useful without training, purely from heuristic design?&lt;/p&gt;

&lt;p&gt;NDM-TCP does not train. There is no gradient descent. The weights are pseudo-random based on indices. Yet the recurrent structure seems to contribute to adaptive behavior (the predictable recovery pattern). This challenges assumptions about what "learning" means in practical systems — perhaps structured recurrence alone, without training, can provide useful memory effects when coupled with the right feedback signals (like entropy).&lt;/p&gt;

&lt;h3&gt;
  
  
  For Systems Researchers
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; How do you build adaptive algorithms in constrained environments (like the Linux kernel)?&lt;/p&gt;

&lt;p&gt;NDM-TCP is implemented in kernel space with strict memory limits, no floating point, and hard real-time constraints. The design choices (16-bit storage, fixed-point arithmetic, simplified activations) are all compromises. Studying how those compromises affect behavior is valuable for any adaptive system in constrained environments.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Needs to Happen Next (If Anyone Cares)
&lt;/h2&gt;

&lt;p&gt;If NDM-TCP has real research potential, what would proper investigation look like?&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Third-Party Testing
&lt;/h3&gt;

&lt;p&gt;Self-conducted tests are valuable but limited. Independent testing would:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify the results are reproducible&lt;/li&gt;
&lt;li&gt;Test in conditions I did not think of&lt;/li&gt;
&lt;li&gt;Identify failure modes I missed&lt;/li&gt;
&lt;li&gt;Provide unbiased performance comparisons&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Formal Stability Analysis
&lt;/h3&gt;

&lt;p&gt;Someone with control theory background should:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Model the system as a dynamical system&lt;/li&gt;
&lt;li&gt;Analyze eigenvalues of the recurrent feedback loop&lt;/li&gt;
&lt;li&gt;Prove or disprove stability under bounded inputs&lt;/li&gt;
&lt;li&gt;Identify conditions where oscillations grow unbounded&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Fairness Analysis
&lt;/h3&gt;

&lt;p&gt;Test NDM-TCP against competing flows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does it starve CUBIC flows?&lt;/li&gt;
&lt;li&gt;Does it get starved by BBR?&lt;/li&gt;
&lt;li&gt;Does it converge to fair bandwidth sharing?&lt;/li&gt;
&lt;li&gt;How does it behave in multi-flow scenarios?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Theoretical Entropy Study
&lt;/h3&gt;

&lt;p&gt;Prove (or disprove) that Shannon entropy on RTT history is a valid congestion signal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Under what network conditions does it work?&lt;/li&gt;
&lt;li&gt;When does it fail?&lt;/li&gt;
&lt;li&gt;Can it be combined with other signals (loss rate, queue delay) for better detection?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Comparison with State-of-the-Art
&lt;/h3&gt;

&lt;p&gt;Benchmark against:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CUBIC (current Linux default)&lt;/li&gt;
&lt;li&gt;BBRv2 (Google's delay-based approach)&lt;/li&gt;
&lt;li&gt;Reno (baseline)&lt;/li&gt;
&lt;li&gt;Vegas (another delay-based algorithm)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Run the same test scenarios. Measure throughput, latency, fairness, and stability. Publish results.&lt;/p&gt;




&lt;h2&gt;
  
  
  Honest Positioning: What This Is and Isn't
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;This is:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A working prototype with interesting emergent behavior&lt;/li&gt;
&lt;li&gt;A research artifact that can be studied and extended&lt;/li&gt;
&lt;li&gt;Evidence that entropy + recurrence + plasticity can produce stable congestion control&lt;/li&gt;
&lt;li&gt;A starting point for formal investigation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;This is not:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Production-ready code&lt;/li&gt;
&lt;li&gt;Academically validated&lt;/li&gt;
&lt;li&gt;Proven stable under all conditions&lt;/li&gt;
&lt;li&gt;Better than existing algorithms (not claimed, not tested rigorously)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The research potential comes from the fact that &lt;strong&gt;something unexpected works&lt;/strong&gt; — and we do not fully understand why yet.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thought: Why This Matters
&lt;/h2&gt;

&lt;p&gt;Most congestion control research is incremental. Take an existing algorithm, tweak one parameter, publish a paper showing 5% improvement in one metric. That is valuable. That is how fields advance.&lt;/p&gt;

&lt;p&gt;But occasionally, something weird happens. Someone mixes ideas that should not obviously work together — entropy as a signal, recurrent nonlinear control, framework-aware modulation — and they do work. The result is not optimal. It is not proven. But it is &lt;strong&gt;interesting&lt;/strong&gt; — in the sense that it raises new questions.&lt;/p&gt;

&lt;p&gt;NDM-TCP is that kind of thing.&lt;/p&gt;

&lt;p&gt;The stable entropy-guided sawtooth is not just "it works." It is &lt;strong&gt;"this combination of techniques produced stable behavior through co-production with the TCP framework, and we did not design that interaction formally."&lt;/strong&gt; That is worth investigating properly — by someone with the mathematical tools and research resources to do it right.&lt;/p&gt;

&lt;p&gt;I built a prototype. Someone else can turn it into science.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Written to clarify what the results actually mean, and why that matters for research — even if I am not the one to carry it forward.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>computerscience</category>
      <category>networking</category>
      <category>performance</category>
    </item>
    <item>
      <title>Building with AI: What I Know, What I Built, and Where I Stand</title>
      <dc:creator>Muhammed Shafin P</dc:creator>
      <pubDate>Tue, 17 Feb 2026 17:40:09 +0000</pubDate>
      <link>https://dev.to/hejhdiss/building-with-ai-what-i-know-what-i-built-and-where-i-stand-3l23</link>
      <guid>https://dev.to/hejhdiss/building-with-ai-what-i-know-what-i-built-and-where-i-stand-3l23</guid>
      <description>&lt;h3&gt;
  
  
  A Personal Experience with AI-Assisted System Development — Using NDM-TCP as a Case Study
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;An honest technical reflection — not a research paper.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This article is a transparent look at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What it actually feels like to build a real system with heavy AI assistance&lt;/li&gt;
&lt;li&gt;Where AI genuinely helps, and where it quietly fails you&lt;/li&gt;
&lt;li&gt;What I understand, what I built, and how honest I can be about the gap between those two things&lt;/li&gt;
&lt;li&gt;Where I stand right now, and what I plan to do next&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The system I built is called &lt;strong&gt;NDM-TCP&lt;/strong&gt; — a Linux kernel TCP congestion control module. But this article is not really about NDM-TCP. NDM-TCP is just the thing that happened when I mixed curiosity, AI assistance, limited time, and a willingness to experiment. The real subject is what that process taught me about using AI as a building tool — what it gives you, what it takes from you, and how to use it without losing the thing that matters most: your own understanding.&lt;/p&gt;

&lt;p&gt;This is not a research paper. It is an honest reflection written by a teenager who built something real and wants to be clear about how.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Know and Where I Stand
&lt;/h2&gt;

&lt;h3&gt;
  
  
  My Background
&lt;/h3&gt;

&lt;p&gt;I am not at advanced engineering level. I am not yet in college. I am still a teenager.&lt;/p&gt;

&lt;p&gt;But I understand things at an abstract and conceptual level — and I have built real things with that understanding. My Python and C knowledge can be considered &lt;strong&gt;intermediate&lt;/strong&gt;. I have already built functional, real-world applications &lt;strong&gt;without AI assistance&lt;/strong&gt; — so my experience is genuine, not just theoretical exposure.&lt;/p&gt;

&lt;p&gt;I have self-taught some basics of &lt;strong&gt;x86/x64 assembly&lt;/strong&gt;, working from documentation. On the networking side, I have self-studied &lt;strong&gt;ARP, VLANs, and STP (Spanning Tree Protocol)&lt;/strong&gt;, which gave me a practical mental model of how networks actually function below the application layer.&lt;/p&gt;

&lt;p&gt;My interest in all of this came from curiosity and self-motivation, not a curriculum.&lt;/p&gt;




&lt;h3&gt;
  
  
  What I Know Clearly (About Congestion Control)
&lt;/h3&gt;

&lt;p&gt;I understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basic concept of &lt;code&gt;cwnd&lt;/code&gt; (congestion window)&lt;/li&gt;
&lt;li&gt;Relationship between throughput and RTT&lt;/li&gt;
&lt;li&gt;Basic differential-style modeling such as:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  dW/dt = 1/R − (W/2)·p
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;AIMD (Additive Increase, Multiplicative Decrease)&lt;/li&gt;
&lt;li&gt;Queue growth and buffer behavior&lt;/li&gt;
&lt;li&gt;RTT as a delay signal&lt;/li&gt;
&lt;li&gt;Difference between delay-based and loss-based control&lt;/li&gt;
&lt;li&gt;Bufferbloat concept&lt;/li&gt;
&lt;li&gt;Basic idea of AQM (like RED/CoDel, conceptually)&lt;/li&gt;
&lt;li&gt;That congestion is a feedback system&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I understand these at a &lt;strong&gt;conceptual and intuitive level&lt;/strong&gt; — not at the level of deep mathematical proof.&lt;/p&gt;




&lt;h3&gt;
  
  
  What I Do NOT Know (Yet)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Engineering-level linear algebra&lt;/li&gt;
&lt;li&gt;Eigenvalues and eigenvectors in depth&lt;/li&gt;
&lt;li&gt;Formal control theory&lt;/li&gt;
&lt;li&gt;Rigorous stability proofs&lt;/li&gt;
&lt;li&gt;Advanced queueing theory&lt;/li&gt;
&lt;li&gt;Formal ML theory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I am working mostly from abstraction and intuition, not full mathematical rigor. I know that. Being transparent about it is the point of this article.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Built: NDM-TCP
&lt;/h2&gt;

&lt;p&gt;NDM-TCP is a &lt;strong&gt;Linux kernel congestion control module&lt;/strong&gt;, implemented in C.&lt;/p&gt;

&lt;p&gt;It combines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Entropy-based RTT analysis&lt;/li&gt;
&lt;li&gt;Adaptive congestion window logic&lt;/li&gt;
&lt;li&gt;A small recurrent neural-style structure&lt;/li&gt;
&lt;li&gt;Plasticity decay mechanism&lt;/li&gt;
&lt;li&gt;Heuristic congestion detection&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How It Works (Technically)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Entropy-Based RTT Analysis:&lt;/strong&gt; The module stores a small window of RTT samples and computes Shannon entropy over the distribution. Low entropy → stable delay → likely real congestion. High entropy → noisy delay → possibly wireless fluctuation. This is a hypothesis. Not formally proven.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adaptive cwnd Behavior:&lt;/strong&gt; Slows growth when entropy suggests congestion, becomes more aggressive when entropy suggests noise, adjusts reduction factor in the &lt;code&gt;ssthresh&lt;/code&gt; phase. Mixes delay-based and loss-based thinking.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recurrent Neural Structure:&lt;/strong&gt; Includes a hidden state array, recurrent update, tanh approximation, and sigmoid output mapping. This introduces memory across time and nonlinear feedback. &lt;strong&gt;Not mathematically proven stable. This is experimental.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Plasticity Concept:&lt;/strong&gt; A variable that increases during congestion and decays slowly over time — simulating adaptive sensitivity. Heuristic-based, not derived from control theory.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Is Proven vs. Experimental
&lt;/h3&gt;

&lt;p&gt;Proven components: AIMD concepts, &lt;code&gt;cwnd&lt;/code&gt; mechanics, TCP congestion avoidance principles, RTT measurement logic, Linux TCP integration model.&lt;/p&gt;

&lt;p&gt;Experimental: entropy as congestion classifier, recurrent hidden state influence, plasticity-based adaptation, neural-style nonlinear mapping. None of these are backed by formal proofs. They are engineering experiments.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why It Has Unpredictable Behavior
&lt;/h3&gt;

&lt;p&gt;Recurrent systems create dynamic feedback loops. Nonlinear functions introduce oscillation possibilities. No eigenvalue stability analysis was done. No formal Lyapunov proof exists. So theoretically: it may be stable, it may oscillate, or it may overreact in delay-only environments. &lt;strong&gt;This is expected and known.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Published Results
&lt;/h3&gt;

&lt;p&gt;All results I have published are from my own &lt;code&gt;tc&lt;/code&gt;-based network simulations(one real world case also incuded). They are honest and accurate to my testing conditions. I am not claiming they generalize beyond those conditions. NDM-TCP showed &lt;strong&gt;promising results&lt;/strong&gt; in those simulations — which is meaningful even for a hobby experiment at this stage.&lt;/p&gt;




&lt;h2&gt;
  
  
  The AI-Assisted Build: What Really Happened
&lt;/h2&gt;

&lt;h3&gt;
  
  
  My Honest Contribution: 20–30%
&lt;/h3&gt;

&lt;p&gt;I need to be clear about this: &lt;strong&gt;my personal contribution to the actual coding of NDM-TCP was roughly 20–30% of the full process.&lt;/strong&gt; The implementation relied heavily on AI assistance.&lt;/p&gt;

&lt;p&gt;The reason is straightforward. The Linux kernel TCP congestion control API involves headers like &lt;code&gt;net/tcp.h&lt;/code&gt;, &lt;code&gt;tcp_cong.h&lt;/code&gt;, and other low-level kernel interfaces. Manually reading through all of that documentation from scratch — while having limited time — was not realistic for me at this stage. I did not want to spend weeks navigating kernel API structures before getting to the part I actually cared about.&lt;/p&gt;

&lt;p&gt;If I had the time — if I had first completed the mathematics properly, then studied the kernel internals deeply, then built — that is the order I would have followed. But that window may not come on a predictable schedule. More on that below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What AI did:&lt;/strong&gt; handled the kernel API boilerplate, translated my conceptual intentions into valid kernel C, and helped me navigate documentation I didn't have time to absorb manually.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I did:&lt;/strong&gt; provided the ideas, the design decisions, the conceptual structure (entropy, recurrence, plasticity), the understanding of what I was building, and the judgment to evaluate whether results made sense.&lt;/p&gt;

&lt;p&gt;The concepts are mine. The implementation process was heavily assisted. That distinction matters.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Usefulness of AI in Building Systems
&lt;/h2&gt;

&lt;p&gt;When used correctly, AI assistance is genuinely powerful.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It removes the blank page problem.&lt;/strong&gt; Starting a kernel module from scratch requires knowing where to begin — which structs to register, which callbacks to implement, how the module lifecycle works. AI can generate a valid skeleton in seconds. That is real value, especially when you understand what the skeleton is doing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It compresses documentation.&lt;/strong&gt; Reading through &lt;code&gt;net/tcp.h&lt;/code&gt; line by line takes time. AI can answer targeted questions about it and let you understand what you need without wading through everything at once.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It accelerates the feedback loop.&lt;/strong&gt; Instead of spending two days wiring up boilerplate before you can test an idea, you spend two hours. More ideas get tested. More things get learned from doing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It keeps your curiosity alive.&lt;/strong&gt; For someone like me — a teenager with limited time but genuine curiosity — AI let me actually build the thing I was thinking about, instead of watching the window close before I ever started.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It is genuinely experience-building when used right.&lt;/strong&gt; Working with AI-generated code that you then read, understand, modify, and test is not the same as copy-pasting code you don't understand. The former builds real capability. I came out of this project knowing significantly more about kernel module structure, TCP internals, and congestion control mechanics than when I started — because I engaged with the code even though I didn't write all of it from scratch.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Drawbacks of AI in Building Systems
&lt;/h2&gt;

&lt;p&gt;These are real and worth naming clearly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You can build faster than you understand.&lt;/strong&gt; This is the core risk. AI can generate code that works — compiles, runs, produces results — faster than your understanding of that code can keep up. If you are not careful, you end up with something functional that you cannot fully explain. That is a fragile position to be in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It can mask gaps in your knowledge.&lt;/strong&gt; If I had written every line manually, I would have immediately hit walls that told me exactly what I didn't know. With AI assistance, those walls become invisible. You bypass them — and the gap stays.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The code may be correct without you understanding why.&lt;/strong&gt; This is especially dangerous in systems work. A kernel module that runs without crashing is not the same as a kernel module you understand. AI-generated low-level code can pass surface-level checks while containing subtle assumptions you are unaware of.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You cannot debug what you don't understand.&lt;/strong&gt; This is where AI assistance most often comes back to hurt people. When something breaks — and it will break — you need to understand the system to fix it. If your understanding is shallow because AI did the heavy lifting, debugging becomes guesswork.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It can create false confidence.&lt;/strong&gt; Building something that works feels good. It should. But the feeling of "I built this" can blur the line between "I designed and implemented this" and "I directed an AI to build this while I supervised." Both have value, but they are not the same thing. Confusing them leads to overestimating where you actually stand.&lt;/p&gt;




&lt;h2&gt;
  
  
  What This Means: How to Use AI Without Losing Yourself
&lt;/h2&gt;

&lt;p&gt;The lesson from building NDM-TCP is not "AI is bad" or "AI is great." It is more specific.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI is a tool that amplifies what you bring to it.&lt;/strong&gt; If you bring ideas, conceptual understanding, and critical judgment — AI makes you faster and more capable. If you bring nothing but a vague goal — AI produces something you cannot own, cannot debug, and cannot build on.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;At minimum, understand at the abstract level.&lt;/strong&gt; I built NDM-TCP without full mathematical rigor, but I understood what entropy measures, what a recurrent structure does, what plasticity is trying to simulate. That abstract understanding was what made the project real rather than just generated code. You do not need a PhD to build something meaningful. But you need &lt;em&gt;something&lt;/em&gt; — some genuine understanding of what you are building and why.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build things yourself without AI too.&lt;/strong&gt; The fact that I had already built real-world applications in Python and C without AI assistance meant I had a reference point. I knew what it felt like to actually write code, hit real errors, navigate real documentation. That context made the AI-assisted experience useful rather than just a shortcut. Without it, I would have had no baseline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The boilerplate reduction is real value — use it.&lt;/strong&gt; Nobody needs to manually write the same Makefile structure every time, or look up every kernel callback signature from scratch. AI handling that is a genuine productivity gain. The key is knowing that what AI is doing is boilerplate reduction — and staying mentally engaged with everything above boilerplate level.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where I Stand Now
&lt;/h2&gt;

&lt;p&gt;I am currently at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Abstract theoretical understanding of congestion control&lt;/li&gt;
&lt;li&gt;Basic mathematical modeling (conceptual, not rigorous)&lt;/li&gt;
&lt;li&gt;Functional kernel implementation level (with heavy AI assistance)&lt;/li&gt;
&lt;li&gt;Intermediate Python and C&lt;/li&gt;
&lt;li&gt;Basic assembly, self-taught from documentation&lt;/li&gt;
&lt;li&gt;Self-taught networking fundamentals: ARP, VLANs, STP&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not&lt;/strong&gt; at advanced engineering math level&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And that is okay — as long as I am honest about it.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Comes Next
&lt;/h2&gt;

&lt;p&gt;I am freezing NDM-TCP for now. This is a deliberate choice.&lt;/p&gt;

&lt;p&gt;What comes next is &lt;strong&gt;completing self-study in the foundational areas I am missing&lt;/strong&gt; — mathematics, linear algebra, calculus, and eventually control theory and stability analysis. After completing that self-study, may I revisit NDM-TCP and rewrite it properly? &lt;strong&gt;Maybe. Maybe not.&lt;/strong&gt; I am not making that promise to myself or anyone else.&lt;/p&gt;

&lt;p&gt;There is an honest tension worth naming: &lt;strong&gt;I do not know if formal college study will take me where I actually want to go.&lt;/strong&gt; Curricula have their own direction. The things I am genuinely curious about — kernel internals, eBPF, network systems theory, low-level AI — may not be on the syllabus. My curiosity pulls toward technical depth that a standard engineering program might not allow. So "I will do this properly after formal study" is not a reliable plan. It might never happen if I leave it entirely to the system.&lt;/p&gt;

&lt;p&gt;That is part of why I built NDM-TCP now, imperfectly, with heavy AI assistance — because the curiosity was here, the time was limited, and waiting for perfect conditions is how ideas die.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Self-study areas planned:&lt;/strong&gt;(adds more as needed)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Linear algebra (Gilbert Strang, MIT OpenCourseWare)&lt;/li&gt;
&lt;li&gt;Calculus (properly)&lt;/li&gt;
&lt;li&gt;Eventually: eigenvalues, stability analysis, control theory basics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Future domains I want to explore:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Operating systems and Linux internals&lt;/li&gt;
&lt;li&gt;eBPF&lt;/li&gt;
&lt;li&gt;Networking systems&lt;/li&gt;
&lt;li&gt;AI systems&lt;/li&gt;
&lt;li&gt;Cybersecurity and reverse engineering&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;C remains my core language for OS-level work.&lt;/p&gt;




&lt;h2&gt;
  
  
  Honest Positioning of NDM-TCP
&lt;/h2&gt;

&lt;p&gt;To be clear about what this project is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Experimental&lt;/strong&gt; — built to explore ideas, not to deploy&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Educational&lt;/strong&gt; — I learned more from building it than from any documentation alone&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Heavily AI-assisted in implementation&lt;/strong&gt; — concepts mine, coding process roughly 20–30% mine&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not academically proven&lt;/strong&gt; — no stability proof, no fairness analysis, no convergence guarantee&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not production-certified&lt;/strong&gt; — not meant to compete with Reno, CUBIC, or BBR&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Promising in self-tested simulations&lt;/strong&gt; — results are honest within their scope&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is a learning system built from curiosity. That is what it is.&lt;/p&gt;




&lt;h2&gt;
  
  
  For Anyone Reading This
&lt;/h2&gt;

&lt;p&gt;If you are self-taught, still young, curious about systems and networking and AI, and wondering whether you can build something real — you can. AI makes that more accessible than ever before.&lt;/p&gt;

&lt;p&gt;But understand clearly what you are doing when you use it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Functional code is not the same as theoretical proof.&lt;/strong&gt; Building something that works does not mean you fully understand it. Both things can be true at once — that is fine — but do not confuse them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using AI to build is experience — if you stay engaged.&lt;/strong&gt; If you read the code, modify it, test it, break it, and understand what each part is trying to do — even at an abstract level — you are learning. If you just copy and run output without engaging, you are not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Know where you actually stand.&lt;/strong&gt; This is the hardest and most important thing. I know roughly what I understand deeply, what I understand abstractly, and what I assisted rather than authored. That clarity is more valuable than the project itself.&lt;/p&gt;

&lt;p&gt;Building something is step one. Understanding it properly is step two. Both matter. Neither replaces the other.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Reflection
&lt;/h2&gt;

&lt;p&gt;NDM-TCP showed promising results in simulation. It is a real kernel module running on a real Linux system. The results I published are honest.&lt;/p&gt;

&lt;p&gt;But what I am most proud of is not the module — it is that I can write this article. That I can say exactly where the AI contribution ends and mine begins. That I know what the gaps in my understanding are and can name them. That I built something while being fully aware of what I was and was not doing.&lt;/p&gt;

&lt;p&gt;That clarity is the most important thing a self-taught builder can develop.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>discuss</category>
      <category>experience</category>
      <category>programming</category>
    </item>
    <item>
      <title>Real-World Analysis of TCP Congestion Control: Reno vs. NDM TCP vs Cubic in a Home Network Environment</title>
      <dc:creator>Muhammed Shafin P</dc:creator>
      <pubDate>Mon, 16 Feb 2026 16:31:03 +0000</pubDate>
      <link>https://dev.to/hejhdiss/real-world-analysis-of-tcp-congestion-control-reno-vs-ndm-tcp-vs-cubic-in-a-home-network-593c</link>
      <guid>https://dev.to/hejhdiss/real-world-analysis-of-tcp-congestion-control-reno-vs-ndm-tcp-vs-cubic-in-a-home-network-593c</guid>
      <description>&lt;h2&gt;
  
  
  1. Introduction
&lt;/h2&gt;

&lt;p&gt;This report documents a real-world comparative analysis of three TCP congestion control algorithms: TCP Reno, TCP Cubic, and ndm_tcp. Unlike theoretical simulations or controlled lab environments, this test was conducted within a live home network during active usage. The primary objective was to observe the impact of high-throughput iperf3 transfers on simultaneous real-time traffic—specifically a streaming YouTube video—to evaluate fairness and aggression in standard consumer-grade hardware.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Experimental Setup
&lt;/h2&gt;

&lt;p&gt;The test utilized a client-server architecture within a standard residential layout.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hardware and Software Configuration
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Server:&lt;/strong&gt; Laptop running Debian 13 (Trixie).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Client:&lt;/strong&gt; Laptop running Windows Subsystem for Linux (WSL).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Router:&lt;/strong&gt; Scopus Router (Version 3.0), operating on the 2.4 GHz Wi-Fi band.(in hall)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cabling:&lt;/strong&gt; The client was connected via a 15-meter Fedus Cat 6 Ethernet cable to eliminate wired bottlenecks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Network Path:&lt;/strong&gt; The server was located in a separate room from the router, introducing a physical wall as a signal attenuation factor for any wireless legs of the path.The client was connected through Fedus  15m cat 6 cable and also was in another room.(since ethernet connected , room doesn't matter).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Measurement Tool:&lt;/strong&gt; iperf3 version 3.12.(client version) , (server version) - 3.18.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Layout
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                [ Room 1 ]
    +----------------------------------+
    |                                  |
    |  Server Laptop                   |
    |  Debian 13 (Trixie)              |
    |                                  |
    +---------------+------------------+
                    )))))
                2.4 GHz Wi-Fi
                    )))))
            (Physical Wall Barrier)
                    )))))
    +---------------+------------------+
    |       Scopus Router v3.0        |
    |        (Located in Hall)        |
    +---------------+------------------+
                    |
                    | 15m Fedus Cat 6 Ethernet Cable
                    |
    +---------------+------------------+
    |                                  |
    |  Client Laptop                   |
    |  WSL (Windows Subsystem Linux)  |
    |  iperf3 v3.12 (Client)          |
    |                                  |
    +----------------------------------+
                [ Room 2 ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Real-World Background Traffic
&lt;/h2&gt;

&lt;p&gt;The test was conducted while a high-priority background task was active: a streaming YouTube class for SSLC (10th grade) exam preparation(my sister was studying). This provided a realistic metric for "fairness"—if the iperf3 test caused the stream to buffer, the algorithm was considered highly aggressive or "unfair" to existing flows.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Test Scenarios and Observations
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Scenario A: ndm_tcp (Initial Test)
&lt;/h3&gt;

&lt;p&gt;The first test was conducted using the ndm_tcp algorithm at the server side.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Average Bitrate:&lt;/strong&gt; ~101 Mbits/sec.(sender), (reciever) - 101 Mbits/s&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Total Retransmissions:&lt;/strong&gt; 1,158.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stability:&lt;/strong&gt; The congestion window (Cwnd) fluctuated between 300 KB and 1.2 MB.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Impact on Background Traffic: The YouTube stream remained stable throughout the 100-second transmission phase.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scenario B: TCP Cubic
&lt;/h3&gt;

&lt;p&gt;TCP Cubic, the modern standard for Linux, was tested for baseline comparison.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Average Bitrate:&lt;/strong&gt; ~99.9 Mbits/sec.(sender), (reciever) - 99.6 Mbits/s.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Total Retransmissions:&lt;/strong&gt; 1,164.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Behavior: Showed consistent throughput, slightly lower than ndm_tcp in this specific instance, with retransmissions remaining comparable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scenario C: TCP Reno (The Aggressive Phase)
&lt;/h3&gt;

&lt;p&gt;The test was then switched to the legacy TCP Reno algorithm.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Average Bitrate (Sender):&lt;/strong&gt; 19.0 Mbits/sec.(sender) , (reciever) - 0 Mbits/s&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Observations:&lt;/strong&gt; While Reno initially showed high Cwnd values (up to 2.97 MB), it experienced a massive surge in retransmissions (1,197 within the first 6 seconds). After the 18-second mark, the receiver reported 0.00 bits/sec, suggesting a significant collapse or stall in the link under the specific congestion conditions of the router's buffer.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Key Findings: The "YouTube Stalls"
&lt;/h2&gt;

&lt;p&gt;A critical observation occurred regarding the fairness of these algorithms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reno Aggression:&lt;/strong&gt; Approximately 7–11 seconds after the Reno test completed, the YouTube class on the sister's device stopped entirely, showing a loading/buffering spinner. Simultaneously, attempts to load YouTube on the client system also failed. This suggests that Reno's behavior (likely through bufferbloat or aggressive window scaling prior to the stall) saturated the Scopus router's resources to the point where existing flows were starved.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Recovery with ndm_tcp:&lt;/strong&gt; Once the system was switched back to ndm_tcp, the YouTube class resumed playback within approximately 5–8 seconds.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hardware vs. Simulation:&lt;/strong&gt; It is important to emphasize that these results were obtained on real hardware. The Scopus router's version and the physical wall between the router and server likely contributed to the packet loss and latency patterns that triggered these behaviors.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Statistical Summary (100s Transmissions)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Algorithm&lt;/th&gt;
&lt;th&gt;Avg Bitrate (Sender)&lt;/th&gt;
&lt;th&gt;Retransmissions&lt;/th&gt;
&lt;th&gt;Key Event&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ndm_tcp&lt;/td&gt;
&lt;td&gt;101 Mbits/sec&lt;/td&gt;
&lt;td&gt;1,158&lt;/td&gt;
&lt;td&gt;Stable background stream.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cubic&lt;/td&gt;
&lt;td&gt;99.9 Mbits/sec&lt;/td&gt;
&lt;td&gt;1,164&lt;/td&gt;
&lt;td&gt;Minimal impact on stream.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reno&lt;/td&gt;
&lt;td&gt;19.0 Mbits/sec*&lt;/td&gt;
&lt;td&gt;1,264&lt;/td&gt;
&lt;td&gt;YouTube stream stalled; link collapsed.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Reno bitrate is averaged over the full duration, but actual transmission stalled after 18 seconds.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  iperf3 (last part in results)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1.ndm_tcp
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-100.00 sec  1.18 GBytes   101 Mbits/sec  1158             sender
[  5]   0.00-100.01 sec  1.17 GBytes   101 Mbits/sec                  receiver
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2.cubic
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-100.00 sec  1.16 GBytes  99.9 Mbits/sec  1164             sender
[  5]   0.00-100.03 sec  1.16 GBytes  99.6 Mbits/sec                  receiver
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3.reno
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-100.00 sec   226 MBytes  19.0 Mbits/sec  1264             sender
[  5]   0.00-100.00 sec  0.00 Bytes  0.00 bits/sec                  receiver
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Limitations and Conclusion
&lt;/h2&gt;

&lt;p&gt;Test Limitations&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sample Size:&lt;/strong&gt; This report is based on a single real-world test case.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Environment:&lt;/strong&gt; Testing was limited to a residential 2.4 GHz Wi-Fi environment. Results may differ significantly in 5 GHz, WiFi-6, or high-performance enterprise/telecom infrastructures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Lack of 5G/Data Center Data:&lt;/em&gt; I do not have access to large-scale data center environments or 5G infrastructure to validate if these findings scale.&lt;strong&gt;This is where community support needed&lt;/strong&gt;.(even this  testing was   with creating problem for others)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Based on this hardware test, ndm_tcp appeared to maintain better fairness toward background real-time traffic (YouTube) compared to TCP Reno. Reno's behavior under these specific conditions was highly aggressive, leading to a temporary denial of service for other devices on the network. However, further community validation and large-scale testing are required before concluding that ndm_tcp is excellent across various networking scenarios.&lt;/p&gt;

&lt;h2&gt;
  
  
  Full Data Access
&lt;/h2&gt;

&lt;p&gt;The complete raw iperf3 logs (TXT format) can be accessed here:&lt;br&gt;
&lt;a href="https://drive.google.com/file/d/1AFkaVhC38giY4LKho566PDkZE2yJWa4k/view?usp=sharing" rel="noopener noreferrer"&gt;Full Test Results - Google Drive&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>discuss</category>
      <category>hejhdiss</category>
      <category>network</category>
    </item>
  </channel>
</rss>
