Weight Averaging is a model fusion technique that creates a final network by computing the element-wise mean of the weights from multiple model snapshots saved at different points during the fine-tuning process. Unlike traditional ensemble methods that average the predictions of separate models, weight averaging operates directly in the parameter space, producing a single model with no additional inference cost. This approach exploits the geometry of the loss landscape, where checkpoints near a minimum often oscillate around a central basin of low error.
Glossary
Weight Averaging

What is Weight Averaging?
A regularization technique that constructs a final model by averaging the learned parameters from multiple checkpoints collected during the fine-tuning trajectory, resulting in a flatter loss minimum and improved generalization on unseen medical imaging data.
In medical imaging transfer learning, Stochastic Weight Averaging (SWA) and Model Soups are prominent variants that enhance robustness against domain shift. By averaging weights from checkpoints with cyclical or high-constant learning rates, the fused model settles into a flatter region of the loss surface, reducing sensitivity to the subtle scanner-specific variations common in radiological data. This technique is particularly valuable when fine-tuning on small, annotated medical datasets where individual checkpoints may overfit to spurious correlations.
Key Characteristics of Weight Averaging
Weight averaging constructs a final model by interpolating the weights from multiple checkpoints along the fine-tuning trajectory, effectively discovering a flatter loss minimum that generalizes more robustly to unseen data.
Stochastic Weight Averaging (SWA)
A procedure that averages weights from multiple checkpoints collected during the final epochs of training with a cyclical or constant learning rate schedule. Unlike traditional ensembling, SWA produces a single model with no inference overhead.
- Checkpoints are collected at the end of training, not throughout
- Uses a high constant or cyclical learning rate to explore the loss landscape
- The averaged solution sits in a wider basin of attraction, improving generalization
- Particularly effective when fine-tuning on small medical imaging datasets
Model Soups
A technique that averages the weights of multiple fine-tuned models, each trained with different hyperparameter configurations, to achieve superior accuracy without any additional inference cost. Unlike SWA, the models are trained independently rather than sequentially.
- Greedy soup: sequentially adds models to the average only if validation accuracy improves
- Uniform soup: simply averages all available fine-tuned models
- Works because fine-tuned models lie in a linearly connected region of the loss landscape
- Demonstrated to boost accuracy on medical imaging benchmarks like CheXpert and MIMIC-CXR
Exponential Moving Average (EMA)
A running average of model weights maintained throughout training, where recent iterations receive exponentially higher weight than older ones. EMA produces a smoothed model that is more stable and often generalizes better than the final raw checkpoint.
- Maintained as a shadow copy of the model during training
- The decay rate controls how much historical weights influence the average
- Commonly used in self-supervised pre-training for medical images
- Provides a form of temporal ensembling without storing multiple checkpoints
Loss Landscape Geometry
Weight averaging exploits the geometry of neural network loss surfaces. Fine-tuned solutions often reside in the same wide, flat basin of the loss landscape, making linear interpolation between them viable.
- Flat minima generalize better than sharp minima because small weight perturbations don't degrade performance
- Averaging acts as an implicit sharpness-aware regularization
- Visualized via loss contour plots showing averaged solutions at the center of wide basins
- Explains why averaging weights from different fine-tuning runs yields robust diagnostic models
Implementation in Medical Transfer Learning
Weight averaging is straightforward to implement during fine-tuning of pre-trained models on medical imaging tasks. The technique requires minimal code changes and integrates with existing training loops.
- SWA: collect checkpoints at the end of each epoch during the final phase of fine-tuning
- EMA: update a shadow model after each optimizer step using a decay factor (e.g., 0.999)
- Model Soup: independently fine-tune with varied learning rates or augmentations, then average
- Compatible with LoRA and adapter-based fine-tuning methods
- Particularly valuable when annotated medical data is scarce, as it reduces overfitting
Comparison with Traditional Ensembling
Weight averaging provides the generalization benefits of model ensembling without the linear increase in inference cost. This is critical for deploying diagnostic models in resource-constrained clinical environments.
- Ensembling: requires N forward passes for N models; averages predictions
- Weight averaging: single forward pass; averages parameters before inference
- Both techniques reduce variance in predictions
- Weight averaging is preferred for edge deployment of diagnostic AI where compute is limited
- Can be combined with test-time augmentation for further robustness gains
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Frequently Asked Questions
Explore the mechanics and benefits of weight averaging, a technique that combines multiple model checkpoints to achieve flatter loss minima and superior generalization in diagnostic AI.
Weight averaging is a technique that creates a final model by averaging the weights from multiple checkpoints along the fine-tuning trajectory, leading to a flatter loss minimum and better generalization. Instead of selecting a single best-performing checkpoint, this method collects model snapshots—often from the end of training or across different hyperparameter configurations—and computes their element-wise arithmetic mean. The resulting averaged model resides in a wider basin of the loss landscape, making it less sensitive to small perturbations in the input data. This is particularly valuable in medical imaging, where domain shift between scanners can cause sharp minima models to fail. The process requires no additional training, only storage of intermediate weights, and can be implemented as a post-hoc step after standard fine-tuning or self-supervised pre-training.
Related Terms
Weight averaging is one of several techniques that improve model robustness and generalization. Explore these related concepts that address domain shift, catastrophic forgetting, and efficient adaptation in medical imaging.
Model Soups
A direct application of weight averaging where multiple fine-tuned models with different hyperparameter configurations are averaged into a single model. Unlike traditional ensembles that require running multiple models at inference, a model soup collapses diversity into one set of weights, providing accuracy gains with zero additional inference cost. Popularized by the original paper demonstrating ImageNet accuracy improvements without any runtime overhead.
Exponential Moving Average (EMA)
A weight averaging technique that maintains a decaying average of model parameters throughout training, giving more weight to recent updates. EMA models are commonly used as the final evaluation checkpoint because they exhibit smoother convergence and better generalization than the raw training trajectory. Widely adopted in self-supervised learning frameworks like BYOL and MoCo for medical image pre-training, where stable target representations are critical.
Catastrophic Forgetting
The phenomenon where a neural network abruptly overwrites previously learned knowledge when fine-tuned on a new target task. Weight averaging helps mitigate this by interpolating between the pre-trained and fine-tuned weights, preserving source domain representations. Key mitigation strategies include:
- Elastic Weight Consolidation (EWC): Penalizes changes to important parameters
- Progressive Networks: Freeze old tasks and add lateral connections
- Weight Interpolation: Average pre-trained and fine-tuned weights to balance old and new knowledge
Domain Generalization
The challenge of training a model on one or several source domains that must robustly generalize to entirely unseen target domains without any adaptation. Weight averaging contributes to domain generalization by finding flatter minima that are less sensitive to distribution shifts. In medical imaging, this is critical for deploying models that work across:
- Different MRI scanner manufacturers (Siemens, GE, Philips)
- Varying acquisition protocols and field strengths
- Unseen patient demographics and disease presentations
Test-Time Adaptation
A technique that updates a model's normalization statistics or parameters during inference on target samples to combat distribution shift. Unlike weight averaging which is applied offline, test-time adaptation operates dynamically. Common approaches:
- BatchNorm recalibration: Update running statistics on target data
- Entropy minimization: Adjust weights to produce confident predictions
- TENT: Optimize channel-wise affine parameters via entropy minimization
Weight-averaged models provide a more robust initialization for test-time adaptation, reducing the risk of destabilization.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us