Smart Cleanup in Neural Networks: How to Speed Up Training by 63% ✛

Original: "Optimus: A Generic Operator-Level PyTorch Model Transformation Framework"
arXiv:2607.02945 · 2026-07-03 · CC BY 4.0 · 2 min
Optimus automatically finds and removes unnecessary steps in neural network computation graphs, making them faster and more efficient.

Recommendation neural networks, the ones that curate your news feed, are a product of Machine Learning. They work like giant recipes with thousands of steps. Each step is a simple operation: add, multiply, or slice an array of numbers. Over time, as models get tweaked, redundant actions pile up in these recipes. Imagine a chef who slices a carrot into pieces and then immediately glues them back together — pointless, but the recipe demands it. Similarly, in neural networks, you sometimes see data being split apart and then merged right back in the next step. Each such action kicks off a separate task on the GPU, turning what could be one fast computation into a queue of hundreds of tiny jobs. Engineers used to hunt for these inefficiencies manually, but with models updated weekly, automatic optimization became a must.

In one test, the original recipe required 12 772 separate GPU tasks. After cleaning, only 24 remained, as if instead of a thousand couriers with single packages, a single truck arrived.

Optimus is a "cleaner" built into the PyTorch compiler that knows over thirty typical useless patterns. It scans the entire computation graph — what specialists call a Graphs (a set of connected steps)—and compares it against templates: if it spots the familiar “slice-and-glue” pattern, it replaces it with a simple data pass. If the recipe has ten identical operations in a row, it merges them into one. This housekeeping doesn’t alter the final result: you get the same answer, just via a much straighter path. Because the rules work on a common intermediate representation, one set of templates applies to hundreds of different models, regardless of their topology (internal wiring).

Picture it: you wrote a long email full of repetitions, and a robot editor condensed it to the essentials without losing the meaning. Optimus does the same with mathematical graphs.

The impact is tangible. Industrial models, which used to run slowly because of constantly shifting graphs, a hallmark of Dynamical Systems, now train up to 63% faster. In an extreme test, a numerical simulation showed: the number of GPU kernels during training shrank from almost 13 000 to 24, and during inference from 6 320 to 6. Peak memory usage dropped by several percentage points — critical for large-scale work. Optimus is open-source and integrated into PyTorch, so any developer can use it and even add their own patterns — making neural networks even faster and greener.

The compilation time savings exceeded 400 seconds — enough to brew a cup of tea and check your email while the program gets the network ready.

\min_{G'} \text{Cost}(G') \quad \text{s.t.} \quad \text{Result}(G') = \text{Result}(G)
The optimizer seeks the computation graph that yields the same result with minimal cost—time, memory, kernel count.
Scientists
Andrey Markov
Concepts
optimization xgboost genetic algorithm training transformers quantum computing resource optimization quantum algorithm Large Language Models parameter