Mixed-precision training is a technique that accelerates deep learning by performing the majority of a model's arithmetic operations in lower-precision numerical formats like BFloat16 or FP16, while retaining a master copy of model weights in FP32. This approach halves the memory footprint of activations and gradients, enabling larger batch sizes and significantly faster tensor core utilization on modern GPUs without sacrificing the numerical stability required for model convergence.
Glossary
Mixed-Precision Training

What is Mixed-Precision Training?
A memory and speed optimization technique that uses lower-precision numerical formats for most operations while preserving critical calculations in higher precision.
In the context of legal domain-adaptive pre-training, mixed-precision training is critical for processing massive corpora of case law and contracts within practical time and hardware budgets. By combining BFloat16's wide dynamic range with selective FP32 accumulation for sensitive operations like layer normalization, engineers prevent the vanishing gradients that would otherwise destabilize training on long legal documents, ensuring the model's final legal perplexity remains low.
Key Features of Mixed-Precision Training
Mixed-precision training accelerates the domain-specific pre-training of legal language models by combining different numerical formats to dramatically reduce memory footprint and increase throughput without sacrificing model quality.
FP32 Master Weights
A full-precision FP32 (32-bit floating point) master copy of model weights is maintained throughout training. While forward and backward passes execute in lower precision, weight updates are accumulated and applied to this master copy. This prevents the gradual loss of small gradient values that would otherwise vanish in lower-precision formats, ensuring the model converges to the same accuracy as full FP32 training.
BFloat16 Compute Format
BFloat16 (Brain Floating Point) is the preferred half-precision format for legal model pre-training. Unlike standard FP16, BFloat16 preserves the same 8-bit exponent range as FP32 but truncates the mantissa to 7 bits. This identical dynamic range eliminates overflow and underflow errors when processing large legal corpora, removing the need for loss scaling—a critical stability advantage when training on lengthy contracts and multi-page judicial opinions.
Automatic Loss Scaling
When using FP16 instead of BFloat16, automatic loss scaling becomes essential. Gradients in FP16 can underflow to zero due to the format's limited exponent range. Loss scaling multiplies the loss value by a large factor before backpropagation, shifting small gradient values into the representable FP16 range. The gradients are then unscaled before the weight update. Modern frameworks like NVIDIA's Apex implement dynamic scaling that adapts the factor during training.
Tensor Core Acceleration
Mixed-precision training is designed to leverage NVIDIA Tensor Cores, specialized hardware units on Volta, Turing, and Ampere architectures. These cores perform fused multiply-add operations on FP16 or BFloat16 matrices in a single clock cycle. For legal pre-training workloads involving large matrix multiplications in self-attention and feed-forward layers, Tensor Cores deliver up to 12x higher throughput compared to FP32 operations on standard CUDA cores, directly reducing the wall-clock time for domain adaptation.
Memory Bandwidth Optimization
The primary bottleneck in large-scale legal model training is often GPU memory bandwidth, not compute. By storing activations and gradients in half-precision, mixed-precision training halves the data transferred between GPU HBM and on-chip SRAM during each training step. This directly addresses the memory-wall problem, enabling larger batch sizes and longer legal sequence lengths—critical for processing full contracts or multi-page opinions without truncation.
Integration with ZeRO Optimization
Mixed-precision training combines seamlessly with ZeRO (Zero Redundancy Optimizer) stages in DeepSpeed. ZeRO partitions optimizer states, gradients, and parameters across GPUs, while mixed-precision reduces the per-GPU memory footprint of each shard. Together, these techniques enable the pre-training of billion-parameter legal models on commodity GPU clusters. The combination is essential for domain-adaptive pre-training on massive legal corpora that would otherwise exceed available GPU memory.
Frequently Asked Questions
Clear answers to the most common technical questions about using lower-precision numerical formats to accelerate the pre-training of domain-specific legal language models.
Mixed-precision training is a technique that accelerates neural network training by using lower-precision numerical formats, such as 16-bit floating point (FP16 or BFloat16), for the majority of arithmetic operations while retaining a master copy of model weights in 32-bit floating point (FP32). During each training iteration, a FP16 copy of the weights is used for the forward and backward passes, which dramatically speeds up computation and halves memory requirements. The resulting FP16 gradients are then used to update the master FP32 weights, preserving the numerical stability required for convergence. A loss scaling factor is often applied to prevent small gradient values from underflowing to zero in FP16, a step that is typically unnecessary with the larger dynamic range of BFloat16. This approach allows legal models to be pre-trained on massive corpora of case law and contracts using significantly less GPU memory and time.
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.
Related Terms
Core techniques and formats that enable mixed-precision training to accelerate legal model pre-training while preserving numerical stability.
BFloat16 (BF16)
A 16-bit floating-point format that retains the same 8-bit exponent range as FP32 but truncates the mantissa to 7 bits. This design preserves the dynamic range critical for deep learning stability while halving memory bandwidth. Unlike FP16, BF16's matching exponent range eliminates the need for loss scaling in most training scenarios, making it the preferred format for large-scale legal model pre-training on GPUs like the NVIDIA A100 and H100.
FP16 (Half Precision)
The IEEE 754 16-bit floating-point format with 5 exponent bits and 10 mantissa bits. While offering higher fractional precision than BF16, its narrower dynamic range makes it susceptible to gradient underflow and overflow during training. This necessitates loss scaling—multiplying the loss by a large factor before backpropagation and unscaling gradients before weight updates—to keep small-magnitude gradients from flushing to zero, adding complexity to legal model pre-training pipelines.
FP32 Master Weights
A critical technique where a full-precision (32-bit) copy of model weights is maintained and updated during training, even when forward and backward passes execute in lower precision. The master weights accumulate small gradient updates without rounding errors, and are periodically cast to the lower-precision format for computation. This prevents numerical drift over thousands of training steps, ensuring the legal model's final parameters retain the precision required for accurate citation generation and statutory interpretation.
Loss Scaling
A technique required for FP16 mixed-precision training to combat gradient underflow. The training loss is multiplied by a large scaling factor (e.g., 1024) before backpropagation, shifting small gradient values into the representable range of FP16. The gradients are then unscaled by the same factor before the optimizer update. Dynamic loss scaling automatically adjusts this factor during training by monitoring gradient overflow, but adds overhead. BF16 training typically eliminates this requirement entirely.
Automatic Mixed Precision (AMP)
A framework-level implementation, such as PyTorch's torch.cuda.amp, that automates the casting of operations to lower precision. AMP maintains a whitelist of numerically safe operations (e.g., convolutions, linear layers) that execute in FP16 or BF16, while forcing precision-sensitive operations (e.g., softmax, layer normalization, loss computation) to remain in FP32. This provides the speed and memory benefits of mixed precision with minimal code changes, reducing the engineering burden for legal AI teams.
TensorFloat-32 (TF32)
A 19-bit internal format on NVIDIA Ampere and later architectures that uses the 8-bit exponent of FP32 with a 10-bit mantissa from FP16. TF32 operates transparently within FP32 tensor core operations, providing up to 8x throughput improvement over standard FP32 without any code changes. While not a storage format, TF32 accelerates the FP32 master weight computations and precision-sensitive operations within a mixed-precision training loop, further reducing legal model pre-training time.

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