
MIT Researchers Devise Novel Diagram-Based Approach to Optimize Complex AI Systems
Software designers are increasingly challenged with coordinating intricate interactive systems, such as urban transportation networks or the multifaceted components of sophisticated robots. Researchers at MIT have introduced an innovative method to tackle these complex problems, utilizing simple diagrams to identify enhanced approaches for software optimization within deep-learning models.
According to the researchers, this novel method simplifies complex tasks to the point where solutions can be sketched on a napkin. Their findings are detailed in the journal Transactions of Machine Learning Research, in a paper co-authored by Vincent Abbott and Professor Gioele Zardini from MIT’s Laboratory for Information and Decision Systems (LIDS).
Zardini explains that they have designed a new “language,” heavily based on category theory, to facilitate discussions about these emerging systems. This diagram-based language aids in designing the fundamental architecture of computer algorithms, which are crucial for sensing and controlling various system components for optimization.
“The components are different pieces of an algorithm, and they have to talk to each other, exchange information, but also account for energy usage, memory consumption, and so on.” Optimizing these systems is challenging because modifications in one area can ripple through others, creating a cascade of effects.
The research focuses on deep-learning algorithms, which are at the forefront of AI research. Deep learning powers large language models like ChatGPT and image-generation models like Midjourney. These models process data through a series of matrix multiplications and other operations. The parameters within these matrices are updated during extensive training runs, enabling the discovery of intricate patterns. With models consisting of billions of parameters, efficient computation and resource optimization become paramount.
Diagrams can effectively illustrate the parallelized operations within deep-learning models, revealing the relationships between algorithms and the parallelized GPU hardware from companies like NVIDIA. Zardini expresses excitement about this, stating that they seem to have discovered a language that effectively describes deep learning algorithms, explicitly representing critical factors such as energy consumption, memory allocation, and other optimization parameters.
Resource efficiency has been a key driver of progress in deep learning. The DeepSeek model demonstrated that small teams can compete with major labs like OpenAI by prioritizing resource efficiency and the software-hardware relationship. Traditionally, achieving these optimizations requires considerable trial and error to discover new architectures. For instance, the FlashAttention optimization program took over four years to develop. However, this new framework allows for a more formal and visually driven approach.
Existing methods for achieving improvements are limited. This new diagram-based method fills a major gap by providing a formal, systematic way to relate algorithms to their optimal execution and resource requirements.
Category theory underpins this approach, offering a generalized and abstract way to mathematically describe system components and their interactions. It allows for relating different perspectives, such as mathematical formulas to algorithms and resource usage, or system descriptions to robust monoidal string diagrams. These diagrams facilitate experimentation with different connections and interactions, amounting to string diagrams on steroids, incorporating more graphical conventions and properties.
Abbott describes category theory as the mathematics of abstraction and composition, capable of describing any compositional system and studying relationships between such systems. Algebraic rules can also be represented as diagrams, creating a correspondence between visual tricks and algebraic functions.
This approach addresses the lack of clear mathematical models for deep-learning algorithms by representing them as diagrams, enabling formal and systematic approaches. It also provides a clear visual understanding of how parallel real-world processes can be represented by parallel processing in multicore computer GPUs.
The “attention” algorithm, crucial for deep-learning models requiring contextual information, is a key phase in large language models like ChatGPT. FlashAttention significantly improved the speed of attention algorithms after years of development.
Applying their method to FlashAttention, Zardini notes that they were able to derive it on a napkin, albeit a large one. This highlights how much the new approach simplifies complex algorithms. Their research paper is aptly titled “FlashAttention on a Napkin.”
Abbott emphasizes that this method allows for rapid optimization derivation, contrasting with existing methods. The researchers aim to automate the detection of improvements, allowing users to upload code and receive optimized versions automatically.
In addition to automation, a robust analysis of how deep-learning algorithms relate to hardware resource usage allows for systematic co-design of hardware and software, integrating with Zardini’s focus on categorical co-design.
Abbott believes that optimized deep learning models are critically unaddressed, making these diagrams a significant step toward a systematic approach.
Jeremy Howard, founder and CEO of Answers.ai, praised the research for its potential significance in diagramming deep-learning algorithms and its analysis of real-world hardware performance. Petar Velickovic, a senior research scientist at Google DeepMind and a lecturer at Cambridge University, lauded the researchers’ communication skills and the paper’s accessibility.
The new diagram-based language has already garnered attention from software developers, with one reviewer noting its artistic appeal. Zardini describes it as both technical and flashy.



