Making LLMs faster without sacrificing accuracy

A new scaling law that relates particular architectural choices to loss helps identify models that improve throughput by up to 47% with no loss of accuracy.

Key takeaways
  • Surefire models match or exceed LLaMA-3.2 accuracy while improving throughput by up to 47%, with gains consistent across A100 and H200 GPUs and multiple serving frameworks.
  • The optimal MLP-to-attention ratio of LLaMA-3.2-style models is around 1.0, far lower than that of existing open-weight versions (e.g., 4.8 for LLaMA-3.2-1B).
Was this answer helpful?

Large language models (LLMs) keep getting bigger and better. But the cost of running them — generating text, answering questions, powering real-time applications — is scaling up, too. Obviously, model accuracy is important, but for real-time AI-based web applications, it can’t come at the expense of efficiency.

In a paper we presented at the International Conference on Learning Representations (ICLR), we provide a framework for navigating this accuracy-versus-efficiency tradeoff, by connecting scaling laws directly to architectural-design decisions.

The gap in current scaling laws

In 2022, Google DeepMind announced the results of a study involving an experimental LLM called Chinchilla. The DeepMind researchers demonstrated a scaling law that enabled joint optimization of model size and training data to achieve a desired loss level, given a particular computational budget.

More precisely, the law relates the model loss (L) to the number of model parameters (N) and the number of tokens in the training dataset:

Chinchilla law.png
The Chinchilla scaling law relates model loss (L) to parameter count (N) and training-token count but says nothing about the model's internal architecture — the gap this work addresses.

The other variables in this equation — E, A, B, α, and β — are all learnable coefficients. The DeepMind researchers did extensive experimentation to tune those coefficients.

This "Chinchilla law" doesn't specify architectural choices, such as the size of the model's internal representations — the "hidden size" — or the relative number of parameters allocated to attention layers and multilayer perceptron (MLP) layers. However, two models, each with the same billion-parameter count, trained on the same data, with the same accuracy, can differ by up to 40% in inference-time throughput, depending on additional architectural choices. We set out to deduce scaling laws that can help predict those choices.

The Transformer architecture

The Transformer architecture — which lies at the heart of all LLMs — consists largely of stacked attention and MLP blocks. Attention blocks determine how much weight to give each prior token (word or word part) when updating the current token's representation; MLP blocks transform that representation further and are where much of the model's learned knowledge is stored. A separate output layer at the end of the stack converts the final representation into a probability distribution over the next token.

Architecture is not an afterthought. The right configurations can unlock large efficiency gains with no accuracy cost.

The attention mechanism uses three matrices, with names borrowed from information retrieval: the query matrix encodes what each token is looking for in the rest of the sequence; the key matrix encodes what each token has to offer; and the value matrix holds the content each token can contribute when it's attended to. Comparing queries against keys tells the model how relevant each token is to each other token.

Most LLMs use multihead attention: several attention computations run in parallel, each with its own query, key, and value projections. Different heads tend to specialize in different aspects of the input, letting the model capture a richer set of relationships than a single head would.

Our approach: Architecture as a first-class variable

In our ICLR paper, we introduce a scaling law that augments the Chinchilla framework with three architectural factors: the hidden size (the dimension of the vectors that flow through the embedding, attention, and MLP blocks); the ratio of the number of MLP parameters to the number of attention parameters; and grouped-query attention (GQA), in which groups of attention heads, while preserving distinct query matrices, share key and value matrices.

Each factor has a direct impact on inference throughput:

  • Hidden size (d_model): Under a fixed parameter budget, larger hidden sizes reduce total inference FLOPs and shrink the key-value cache, improving throughput.
  • MLP-to-attention ratio (r_mlp/attn): A higher ratio allocates more parameters to the MLP and fewer to attention, shrinking the key-value cache and reducing memory-bandwidth bottlenecks.
  • Grouped-query attention (GQA): Compressing key-value heads further cuts input/output costs during generation.

Adjusting these factors purely for higher throughput comes at a cost of accuracy. Both hidden size and MLP-to-attention ratio exhibit U-shaped loss curves: there is an optimal point for each, and pushing too far in either direction has a negative effect on model accuracy. GQA has a more erratic effect on loss, so we treat it as a discrete hyperparameter tuned through local search.

We deduce our scaling law in two stages. First, we fit the standard Chinchilla law to the model under investigation, calculating values for the coefficients E, A, B, α, and β. This establishes an optimal reference loss. Then we calibrate how each architectural choice — differences in the three factors we consider — affects that loss. Effectively, we learn a correction surface over the design space. Because the effects of hidden size and MLP-to-attention ratio on loss turn out to be separable, each factor can be optimized independently.

Throughput and predicted training loss .png
Throughput (left) and predicted training loss (right) over hidden size and MLP-to-attention ratio. There’s a sweet spot where throughput increases and loss decreases simultaneously.

Two model families: Panda and Surefire

This scaling law enabled us to develop a search framework that identifies Pareto-optimal architectures for any given accuracy target. The result of that search was two model families: Panda (which maximizes accuracy) and Surefire (which is Pareto optimal on the accuracy–efficiency frontier).

To validate the framework and identify our families of optimal models, we trained more than 200 models with varying architectures (80 million to three billion parameters, eight billion to 100 billion tokens). The results of our experiments are below (throughput measured on H200 GPU with batchsize-128-4096-input-1024-output tokens):

Model

d_model

GQA

r_mlp/attn

Loss

Avg. accuracy

Throughput vs. LLaMA-3.2-vLLM

Throughput vs. LLaMA-3.2-SGLang

LLaMA-3.2-1B

2048

4

4.80

2.803

54.9%

baseline

baseline

Panda-1B

2560

4

1.07

2.782

57.0%

-33%

-

Surefire-1B

2560

9

3.60

2.804

55.4%

+21%

+47%

LLaMA-3.2-3B

3072

3

4.80

2.625

61.9%

baseline

baseline

Panda-3B

4096

3

1.00

2.619

62.5%

-23%

-

Surefire-3B

4096

7

1.00

2.620

62.6%

+12%

+17%

  • The billion-parameter Panda model gains 2.1% over LLaMA-3.2-1B, and the three-billion parameter model gains 0.6% over LLaMA-3.2-3B — at the cost of lower throughput.
  • Surefire models match or exceed LLaMA-3.2 accuracy while improving throughput by 12-47%, with gains reaching up to 42% on A100 (vLLM) and 47% on H200 (SGLang) under different model size and batch size configurations.
Training loss across billion-parameter architectural variants.png
Training loss across billion-parameter architectural variants. Panda-1B sits at the minimum of the U-shaped curve, while Surefire-1B trades a small amount of loss for much higher throughput. LLaMA-3.2-1B, with r_mlp/attn=4.8, operates far from the optimum.

Key takeaways

  • Architecture is not an afterthought. The optimal MLP-to-attention ratio of LLaMA-3.2-style models is around 1.0, far lower than that of existing open-weight versions (e.g., 4.8 for LLaMA-3.2-1B). Current models overallocate to MLP layers. The right configurations of hidden size, MLP-to-attention ratio, and GQA configuration can unlock large efficiency gains with no accuracy cost.
  • Small-scale experiments predict large-scale outcomes. The conditional scaling law, calibrated on models with as few as 80 million to 297 million parameters, reliably predicts the best architecture at one billion and three billion parameters, enabling low-cost exploration before expensive full-scale training.
  • The framework generalizes across hardware and serving systems. Efficiency gains are consistent across A100/H200 GPUs and vLLM/SGLang, making the results directly actionable.

Related content

US, CA, Sunnyvale
The Artificial General Intelligence (AGI) team is looking for a passionate, talented, and inventive Member of Technical Staff with a strong deep learning background, to build industry-leading Generative Artificial Intelligence (GenAI) technology with Large Language Models (LLMs) and multimodal systems. Key job responsibilities As a Member of Technical Staff with the AGI team, you will lead the development of algorithms and modeling techniques, to advance the state of the art with LLMs. You will lead the foundational model development in an applied research role, including model training, dataset design, and pre- and post-training optimization. Your work will directly impact our customers in the form of products and services that make use of GenAI technology. You will leverage Amazon’s heterogeneous data sources and large-scale computing resources to accelerate advances in LLMs. About the team The AGI team has a mission to push the envelope in GenAI with LLMs and multimodal systems, in order to provide the best-possible experience for our customers.
US, CA, Sunnyvale
The Artificial General Intelligence (AGI) team is looking for a passionate, talented, and inventive Member of Technical Staff with a strong deep learning background, to build industry-leading Generative Artificial Intelligence (GenAI) technology with Large Language Models (LLMs) and multimodal systems. Key job responsibilities As a Member of Technical Staff with the AGI team, you will lead the development of algorithms and modeling techniques, to advance the state of the art with LLMs. You will lead the foundational model development in an applied research role, including model training, dataset design, and pre- and post-training optimization. Your work will directly impact our customers in the form of products and services that make use of GenAI technology. You will leverage Amazon’s heterogeneous data sources and large-scale computing resources to accelerate advances in LLMs. About the team The AGI team has a mission to push the envelope in GenAI with LLMs and multimodal systems, in order to provide the best-possible experience for our customers.
US, CA, Sunnyvale
The Artificial General Intelligence (AGI) team is looking for a passionate, talented, and inventive Member of Technical Staff with a strong deep learning background, to build industry-leading Generative Artificial Intelligence (GenAI) technology with Large Language Models (LLMs) and multimodal systems. Key job responsibilities As a Member of Technical Staff with the AGI team, you will lead the development of algorithms and modeling techniques, to advance the state of the art with LLMs. You will lead the foundational model development in an applied research role, including model training, dataset design, and pre- and post-training optimization. Your work will directly impact our customers in the form of products and services that make use of GenAI technology. You will leverage Amazon’s heterogeneous data sources and large-scale computing resources to accelerate advances in LLMs. About the team The AGI team has a mission to push the envelope in GenAI with LLMs and multimodal systems, in order to provide the best-possible experience for our customers.
US, CA, Sunnyvale
The Artificial General Intelligence (AGI) team is looking for a passionate, talented, and inventive Member of Technical Staff with a strong deep learning background, to build industry-leading Generative Artificial Intelligence (GenAI) technology with Large Language Models (LLMs) and multimodal systems. Key job responsibilities As a Member of Technical Staff with the AGI team, you will lead the development of algorithms and modeling techniques, to advance the state of the art with LLMs. You will lead the foundational model development in an applied research role, including model training, dataset design, and pre- and post-training optimization. Your work will directly impact our customers in the form of products and services that make use of GenAI technology. You will leverage Amazon’s heterogeneous data sources and large-scale computing resources to accelerate advances in LLMs. About the team The AGI team has a mission to push the envelope in GenAI with LLMs and multimodal systems, in order to provide the best-possible experience for our customers.
US, CA, Sunnyvale
The Artificial General Intelligence (AGI) team is looking for a passionate, talented, and inventive Member of Technical Staff with a strong deep learning background, to build industry-leading Generative Artificial Intelligence (GenAI) technology with Large Language Models (LLMs) and multimodal systems. Key job responsibilities As a Member of Technical Staff with the AGI team, you will lead the development of algorithms and modeling techniques, to advance the state of the art with LLMs. You will lead the foundational model development in an applied research role, including model training, dataset design, and pre- and post-training optimization. Your work will directly impact our customers in the form of products and services that make use of GenAI technology. You will leverage Amazon’s heterogeneous data sources and large-scale computing resources to accelerate advances in LLMs. About the team The AGI team has a mission to push the envelope in GenAI with LLMs and multimodal systems, in order to provide the best-possible experience for our customers.
US, CA, Sunnyvale
We are looking for a Senior Inference Engineer to own inference for real-time multimodal conversational AI. This is a full-stack inference role: you will work across the entire path a model takes from research to production — shaping model architecture so it is servable, building the real-time runtime that serves it within hard latency budgets, and building the offline systems that train and reinforce it. You will operate at the boundary of Science and Inference, taking frontier-scale speech and audio models and making them run within real-time latency budgets on production hardware. You will co-design architectures with scientists to make them inference-friendly from inception, own the low-latency streaming serving path, and build the training and reinforcement-learning infrastructure that closes the loop. You will have the compute, data, and runway to solve problems that few teams in the world are positioned to tackle. As a Senior Engineer, you will own a significant area of the inference stack end to end, drive its technical execution, contribute to the team's roadmap, and work closely with scientists and hardware partners to ensure our models run fast enough to feel human in real time — and at a cost that makes them viable at scale. You may go deep in one of the areas below while contributing across the others. Key job responsibilities Model Architecture & Inference Co-Design • Partner with research scientists to make model architectures servable from inception — surfacing the latency, memory, and cost implications of architecture choices before they are locked in • Implement and optimize the inference path for large-scale multimodal models — attention and KV-cache mechanisms, multimodal/autoregressive decoding, and the compute primitives on the critical path Apply efficiency techniques across the stack — quantization (per-tensor/per-channel/per- group, INT8/FP8/BF16), speculative decoding, operator fusion, and paged KV-cache — and quantify their quality/latency trade-offs • Develop and tune high-performance kernels for critical operations where off-the-shelf implementations leave performance on the table, integrating them into production serving with minimal overhead • Profile end-to-end performance with tools such as Nsight Compute/Systems and roofline analysis to identify and eliminate bottlenecks in large-scale inference workloads Real-Time & Interactive Runtime • Own the real-time serving path for streaming multimodal conversational AI, meeting sub- second, streaming latency budgets under concurrent session load • Build and tune continuous batching, scheduling, and preemption to balance throughput against per-request latency SLAs for interactive workloads • Customize production serving frameworks (e.g., vLLM, PyTorch) for real-time streaming generative models that fall outside standard LLM serving patterns — sustained low-latency output under concurrent session load • Implement multi-GPU inference (tensor parallelism, collective communication) for latency- critical paths, and drive cost toward parity with existing production baselines • Establish latency, throughput, and cost benchmarking, and publish the operational metrics that gate deployment Offline Systems: Training, RL & Evaluation Infrastructure • Build and scale the offline inference systems behind post-training — high-throughput rollout generation and reward-model serving for reinforcement learning (RL/RLHF/RLAIF) • Ensure train/serve consistency — that the inference path used in RL and evaluation faithfully matches production online behavior (e.g., parity across sampling and logit processing) • Work with the evaluation team to enable offline inference that captures the quality dimensions unique to real-time conversation — latency sensitivity, audio quality, and interaction naturalness
US, TX, Austin
Are You Ready to Redefine How the World Receives Its Packages? What if your algorithms defined the most efficient path for millions of deliveries — every single day? At Amazon, we're building the science that makes that possible, and we're looking for exceptional scientists to help lead the way. The Last Mile Routing & Planning organization develops the software, algorithms, and tools that power the "magic" of home delivery. Our planning and routing intelligence systems drive billions of daily decisions — enabling safe, efficient, and frustration-free routes for drivers across the globe. What You'll Do In this role, you'll sit at the intersection of state-of-the-art research and real-world impact. You will: - Design and build algorithms that solve large-scale, complex logistics problems - Synthesize data from diverse sources to identify high-value business opportunities - Provide research direction and data-driven insights to guide strategic decisions - Translate complex technical approaches into clear communication for scientists, engineers, and business stakeholders - Partner closely with scientists and engineers in a collaborative, high-impact environment What You'll Work On We have an exciting and growing portfolio of research areas, including: - Routing for same-day and grocery deliveries - Planning for electric and autonomous vehicles - District-level and stop-level planning - Forecasting solutions for diverse delivery programs All of this is powered by the latest methods in Operations Research (OR), Machine Learning (ML), and Generative AI — at a truly global scale. Successful candidates will lead one or more of these problem spaces. What We're Looking For - Deep expertise in Operations Research and/or Machine Learning methods - Proven experience applying these methods to large-scale, real-world business problems - Ability to translate models into production-ready code in Python or Java - Strong communication skills — you can explain complex technical concepts to diverse audiences - A bias for action and an iterative mindset when tackling ambitious research challenges Why Amazon We're passionate about your growth. Whether you want to explore emerging technologies, take on broader scope, or accelerate your career trajectory, we'll invest in helping you get there. Our business is scaling fast — and so are the opportunities for the people who build it. If you're driven by the challenge of optimizing one of the world's most complex logistics systems and excited to see your work impact millions of customers daily, we'd love to hear from you. Key job responsibilities - Invent and design novel solutions for scientifically complex problem areas, and identify opportunities for invention within existing and new business initiatives - Deliver large-scale, high-impact solutions to complex problems in support of medium-to-large business goals - Shape the design of scientifically complex software systems, personally contributing significant portions of the critical scientific novelty - Apply mathematical optimization, machine learning, and Generative AI techniques to develop solution methodologies for in-house decision support tools and software - Research, prototype, simulate, and experiment with models — and actively participate in their production-level deployment in Python or Java - Engage with the broader scientific community by publishing research articles and participating in leading research conferences
US, WA, Redmond
We are searching for a talented candidate with experience in orbital mechanics, orbit determination, launch vehicle trajectories, and launch vehicle mission planning. In this position, a successful candidate would serve as a Research Scientist in support of Amazon Leo’s constellation with particular focus on Launch Vehicle support. Strong analysis skills are required to develop engineering studies of complex large-scale dynamical systems. This position requires demonstrated expertise in computational analysis automation and tool development. Export Control Requirement: Due to applicable export control laws and regulations, candidates must be a U.S. citizen or national, U.S. permanent resident (i.e., current Green Card holder), or lawfully admitted into the U.S. as a refugee or granted asylum. Key job responsibilities Working with the Leo GNC team, you will: • Perform spacecraft maneuver or navigation analysis in support of multi-disciplinary trades within the Amazon Leo team. • Contribute to prototype software development of flight algorithms. • Test and assess navigation software for integration into flight systems. • Assess and trouble-shoot the performance of Leo on-board GNSS hardware and software systems. • Work closely with GNC engineers to manage on-orbit performance and develop flight dynamics operations processes. • Manage engineering trades as needed for various launch vehicle mission designs. • Support Leo’s Launch Vehicle Mission Management team with technical expertise in Launch Vehicle trajectory requirements specification • Evaluate Launch Vehicle performance and compliance with mission requirements • Develop tools to support Mission Management planning for over 80 launches! • Work collaboratively with launch vehicle system technical teams About the team The Flight Dynamics team is responsible for the guidance, navigation, control and safety of the spaceflight of the Amazon Leo constellation. This team provides solutions to spaceflight challenges in constellation design, orbit selection, launch vehicle insertion requirements, navigation, trajectory design, space situational awareness, and space traffic coordination.
US, WA, Seattle
We are looking for a Principal Applied Scientist to drive the research and development of real-time multimodal conversational AI. You will operate across two focus areas: advancing foundation models for speech and audio, and building the post-training systems (reward modeling, reinforcement learning) that shape natural, human-like conversational behavior. You will be the expert in your area while contributing across the full model lifecycle — from pre-training and architecture design through post-training alignment and real-time deployment. You will work at the frontier of what's possible in conversational AI, with the compute, data, and runway to pursue problems that few teams in the world have the resources to tackle. As a Principal Scientist, you will set the technical direction for your research area, influence the broader roadmap, and work closely with inference engineers to ensure your models are designed for real-time production deployment from inception. Key job responsibilities Foundation Model Scaling - Build and train large-scale multimodal foundation models for real-time speech and audio generation, from architecture design through production-scale training - Advance the scaling and efficiency of conversational modes, including the relationship between data, model size, and real time performance. - Design model architectures informed by hardware constraints and inference requirements, working with inference engineers to ensure models are servable from inception - Develop training methodologies for multimodal models that jointly process and generate speech, language, and audio in real-time streaming contexts Post-Training & Reinforcement Learning - Design and build reward models and reward functions for speech systems — capturing naturalness, fluency, conversational quality, and real-time responsiveness - Develop and apply reinforcement learning methods to shape conversational behavior — teaching models natural timing, responsiveness, and fluid interaction - Build the post-training pipeline from SFT through RL alignment, optimized for real-time multimodal outputs rather than text-only generation - Design evaluation frameworks that capture the quality dimensions unique to real-time conversation Real-Time Perception & Generation - Advance the team's capabilities in real-time perception - Work at the intersection of model architecture and production constraints to ensure multimodal capabilities function within hard real-time latency budgets
DE, Berlin
The Amazon Robotics team is seeking an experienced Applied Scientist to join our team. In this role you will apply the latest trends in research to solve real-world problems in robotics and AI. You will collaborate with a team of scientists and engineers building these applications. We holistically design, build, and deliver end-to-end robotic systems. Our team is also responsible for core infrastructure and tools that serve as the backbone of our robotic applications, enabling roboticists, machine learning scientists, software engineers, and hardware engineers to collaborate and deploy systems in the field. Key job responsibilities • Research, design, develop, and evaluate complex perception, motion planning, and decision making algorithms integrating across multiple disciplines and leveraging machine learning. • Create experiments and prototype implementations of new learning algorithms and prediction techniques. • Work closely with software engineering team members to drive scalable, real-time implementations. • Collaborate with machine learning and robotic controls experts to implement and deploy algorithms, such as machine learning models. • Collaborate closely with hardware engineering team members on developing systems from prototyping to production level. • Represent Amazon in academia community through publications and scientific presentations. • Work with stakeholders across hardware, science, and operations teams to iterate on systems design and implementation. About the team Watch this video to learn more about Vulcan Pick team in Amazon Robotics: https://www.amazon.science/publications/vulcan-pick-a-robotic-system-for-picking-targeted-objects-from-fabric-pods