Multi-Level Modeling of Large Language Model Inference Latency and Energy via Hybrid Analytical--Machine-Learning Predictors
This paper introduces HYMELL, a hybrid three-level framework that combines analytical modeling and machine learning to accurately estimate the inference latency and energy consumption of diverse Large Language Model architectures on hardware like the NVIDIA H100, achieving less than 5% error and enabling efficient, hardware-free design space exploration.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are trying to build a giant, talking robot that can write stories, solve math problems, and chat like a human. This robot is called a Large Language Model (LLM). To make it work, you need a super-fast computer brain, usually a Graphics Processing Unit (GPU), which is the same kind of chip found in high-end video game computers. But here's the catch: these robots are getting so big and smart that they are becoming incredibly expensive to run. They gulp down massive amounts of electricity and take a long time to think, which makes them hard to use in real-world situations like hospitals or schools.
The big question scientists are asking is: "How can we know exactly how much energy and time a robot will need before we even build it?" Right now, to find out, you usually have to build the robot, run it, and measure it with special tools. This is slow, expensive, and requires you to have the actual super-computer handy. If you want to try out a thousand different robot designs to find the most efficient one, you'd have to build and test them all one by one, which would take forever and cost a fortune.
This is where a team of researchers from the University of Southern California steps in with a new idea called HYMELL. Think of HYMELL as a "crystal ball" for computer scientists. Instead of building the robot and testing it, this new tool lets you predict exactly how fast and how energy-hungry a robot will be just by looking at its blueprints. It uses a clever mix of old-school math formulas and modern machine learning to guess the cost of running these giant models. The researchers tested their crystal ball on a powerful computer chip called the NVIDIA H100 and found that it can predict the robot's speed and energy use with amazing accuracy—often being wrong by less than 5%. This means engineers can now quickly try out thousands of different robot designs on a laptop to find the most efficient one, without needing to buy a super-computer or wait days for results.
The Three-Level Detective
To understand how HYMELL works, imagine you are trying to estimate how long it takes to bake a massive, multi-layered cake and how much electricity your oven will use. You could try to guess the total time by just looking at the final cake, but that's often inaccurate because you miss the small details. Instead, HYMELL acts like a three-level detective, breaking the problem down into smaller, manageable pieces.
Level 1: The Tiny Ingredients (Analytical Modeling)
First, the system looks at the smallest "ingredients" of the robot's brain. These are basic math operations like multiplying huge grids of numbers (called GEMM), normalizing data (RMSNorm), and calculating attention scores (Softmax). The researchers realized that these tiny operations behave differently depending on how big the job is.
- The Analogy: Think of a small kitchen task like chopping one onion. If you only have one onion, the time it takes is mostly about how long it takes to walk to the fridge, grab the knife, and start chopping (this is "launch-bound"). But if you have to chop a mountain of onions, the time is mostly about the actual chopping speed and how fast you can move the onions around (this is "memory-bound").
- HYMELL uses math formulas to calculate the cost of these tiny ingredients based on whether the job is small or huge. It doesn't guess; it uses physics-based rules to figure out the baseline cost of these operations.
Level 2: The Recipe Blocks (Machine Learning)
Next, the system groups these tiny ingredients into larger "blocks," like the Attention Block (which helps the robot focus on important words) and the Feed-Forward Network (which helps it process information).
- The Analogy: Imagine you know exactly how long it takes to chop an onion and how long it takes to whisk eggs. But when you combine them to make an omelet, there are extra steps: cracking the shell, cleaning the bowl, and maybe a little bit of waiting. These extra steps are hard to calculate with simple math.
- So, HYMELL uses a small, smart computer program (a Machine Learning model) to learn these "extra steps." It looks at the math-based estimates from Level 1 and adds a correction factor for the messy, real-world overheads like reshaping data or switching between tasks. This allows it to predict the cost of a whole "recipe block" very accurately.
Level 3: The Whole Cake (End-to-End Prediction)
Finally, the system puts all the blocks together to predict the cost of the entire robot running a full conversation.
- The Analogy: Now you have the time for the omelet, the cake, and the salad. But baking a whole banquet involves more than just adding the times together. You have to worry about the oven heating up, the kitchen getting crowded, and the time it takes to move dishes from the counter to the table.
- HYMELL uses another smart computer program to take the costs of all the blocks and add in these "system-level" effects. It considers things like how many people are asking questions at once (batch size) and whether the robot is reading a long prompt or just generating one word at a time. This gives a final, accurate prediction of the total time and energy needed.
What They Found
The researchers tested this three-level detective on a powerful NVIDIA H100 GPU using famous robot models like LLaMA 3, Mistral, and Qwen. The results were impressive.
- High Accuracy: For the tiny ingredients (Level 1), the predictions were incredibly close to reality, with errors often below 4%. For the whole robot (Level 3), the system predicted the time and energy use with an error of less than 5% for many models. For example, when testing the LLaMA 3 8B model, the error was just 4.19% for time and 2.92% for energy during the "prefill" phase (reading the prompt), and even lower (around 1.5%) during the "decode" phase (generating words).
- Speed and Flexibility: Because HYMELL predicts based on the blueprint (architectural parameters) rather than running the robot, it is incredibly fast. It allows engineers to explore thousands of design changes instantly. For instance, they could ask, "What happens if we double the number of attention heads?" and get an answer in seconds, showing that 64 heads might be the most energy-efficient choice for a specific setup.
- Working on Different Hardware: The team also showed that this method isn't tied to just one type of computer. They tested it on a different GPU (the NVIDIA RTX A6000) and the system still worked well, with errors around 8%. This suggests that if you want to use HYMELL on a new computer chip, you don't need to reinvent the whole wheel; you just need to measure the new chip's basic behaviors once, and the rest of the system adapts automatically.
What It's Not
It is important to note what HYMELL does not do. It is not a magic wand that tells you how to build a robot from scratch, nor does it replace the need for real testing entirely. It is a prediction tool. The researchers explicitly state that while their model is very accurate, it still has small errors, especially when dealing with very complex interactions between different parts of the robot or when switching between different types of memory optimizations. Also, while they tested it on single computers, they noted that predicting how these robots work across many computers working together (multi-GPU) would require adding a few more steps to the system, which they haven't fully solved yet.
Why This Matters
The beauty of HYMELL is that it turns a slow, expensive guessing game into a fast, precise science. By combining the reliability of math formulas with the flexibility of machine learning, it gives designers a powerful tool to build greener, faster, and more efficient AI. Instead of burning through electricity and time to test every idea, they can use this "crystal ball" to find the best designs before they even build them, paving the way for a more sustainable future for artificial intelligence.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.