{
  "id": 9493827,
  "title": "In 2018 I hand-wrote a C++ deep learning framework so I'd never pad a batch. In 2023 LLM serving landed on the same structure.",
  "url": "https://urgent.news/2026/09/24/in-2018-i-hand-wrote-a-c-deep-learning-framework-so-id-never-pad-a",
  "topic": "ai",
  "section": "AI",
  "published": "2026-09-24T05:25:13.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/chncwang/in-2018-i-hand-wrote-a-c-deep-learning-framework-so-id-never-pad-a-batch-in-2023-llm-serving-6ob"
  },
  "original_language": "en",
  "account": "In 2018, a master's student working on NLP research wrote a C++ deep learning library called InsNet to avoid padding when processing inputs of varying lengths. The library, which grew to over 21,000 lines of C++ code, eliminated the need for padded tensors by representing each value as a flat buffer with a two-integer shape: total element count and width. This design allowed InsNet to keep each value's width exactly as wide as the sentence it represented, without any padding or mask tensors.\n\nInsNet's batching key was designed to deliberately forget sizes, grouping nodes by type signature rather than input shape. This meant that linear layers could batch together even if they processed different numbers of columns, as the column count was not included in the signature. By leaving out the column count, a single batch in InsNet could contain matrices of different shapes, making the most of the computation available.",
  "summary": "There's a sentence in the README of a library I wrote that I've been thinking about lately: \"To summarize, we believe that Padding-free Dynamic Batching is the feature that NLPers will dive into but is surprisingly not supported by today's deep learning libraries .\" I wrote that around 2021, about InsNet , a C++14 deep learning library I'd been building since 2018. Then transformers ate the…",
  "key_points": [
    "In 2018, master's student created C++ deep learning library InsNet",
    "InsNet's design eliminated need for padded tensors by using flat buffers",
    "Batching in InsNet grouped nodes by type signature, not input shape"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}