top of page
WGTech-Logo.png

The Gap Between a Model That Works and a Model That Ships

Sep 3
6 min read

By Sahana P, Edge AI Engineer at WG Tech Solutions



Trained Once, Shipped Twice


Many AI models achieve excellent validation accuracy but never make it into production. The reason often has little to do with the model itself. Training produces one artifact, a set of weights that scored well against a validation set. Shipping it requires a second and mostly invisible round of work on that same artifact, where you shrink its precision, cut the parts it doesn't actually need, and export it into whatever format the destination pipeline is expecting. Skip that second round, and a model that looked perfectly fine on a developer's machine can fail to even load once it reaches wherever it's actually meant to run.


Scoring well is one achievement. Surviving the precision, size, and format the destination demands is a second one, and most teams only budget time for the first.


The discipline that closes that gap is model optimization. It isn't one trick. It's a set of decisions about exactly where a model can afford to lose weight, and where it absolutely can't.


Two Different Jobs


Training happens somewhere generous; with power nobody has to ration and no clock running on how fast an answer needs to arrive. Deployment almost never inherits any of that generosity. Power and thermal budgets are tight, memory is a fraction of what training had, latency is non-negotiable, there's usually no cloud to fall back on, and every inefficiency gets copied across every unit in the fleet.


“Deployment” is also not one place. The same model may be handed to a general-purpose CPU with a few cores and no accelerator, a discrete GPU with thousands of them, an NPU built specifically for low-precision integer math, or an APU-style SoC where CPU and GPU share a single memory pool and a single power budget. Edge silicon often adds a DSP or FPGA fabric to the top of that.


Each of those wants something different from the same set of weights. A GPU rewards large, dense, regular work. An NPU may run INT8 far faster than FP32 and then fall back to the CPU entirely for a single operator it doesn't implement. A CPU-only target cares more about memory bandwidth and cache behavior than about raw arithmetic. On a shared-memory SoC, the model competes for bandwidth and thermal headroom with everything else on the die.


That is what optimization is for. Not shrinking a model for the sake of a smaller number but shaping it to fit, what it will run on and at the speed the job needs.


The Optimization Toolbox


There's no single move that does this. Most teams reach for a mix of four levers. Knowledge distillation trains a smaller student model to reproduce the behavior of a larger teacher, and low-rank factorization splits a heavy weight matrix into two thinner ones that approximate it. Both are powerful, and both change the model's architecture, which means retraining and a longer road back to your accuracy numbers.


Quantization and pruning ask far less of you and carry most of the weight in practice, so they are the two worth knowing first.


The Model Optimization Toolbox
The Model Optimization Toolbox

Quantization: Making Every Bit Count


Quantization shrinks the precision a model uses to store its numbers, typically from 32-bit floating point down to 16-bit or 8-bit integers. Smaller numbers mean less memory, less data movement, faster math. The first two options below are both forms of post-training quantization, applied to a model that has already finished training. The third one changes training itself.


  • Dynamic quantization: weights converted ahead of time; activations quantized on the fly. Easy, but the speedup is modest.

  • Static quantization: both weights and activations converted ahead of time using a calibration dataset. Bigger speedup, but only as good as that data.

  • Quantization-aware training (QAT): the model learns to tolerate quantization error during training. Best accuracy, at the cost of a full training cycle.


Pruning: Cutting the Fat Without Losing the Muscle


Pruning removes the parts of a network that aren't pulling their weight.


  • Unstructured pruning zeroes out individual weights. Great compression on paper, but most hardware can't turn that irregular pattern into real speed.

  • Structured pruning removes whole channels or filters, reliably running faster in practice, at a bit more accuracy cost per unit removed.

  • Magnitude vs. importance-based selection: raw weight size is fast but blunt; scoring actual contribution costs more but protects accuracy far better.

  • One-shot vs. iterative: cutting everything at once is fast but rough; cutting gradually with fine-tuning between rounds lands in a much better place.


Neither technique should be tuned blind. Watching how a model actually behaves on real data, which layers need precision, which channels barely activate, is what tells you where the cuts are safe.


A Process, not a Switch


  • Baseline first, on the real target, not stand-in.

  • Profile before touching anything. Find out what's actually slow, and why.

  • Combine techniques deliberately. Quantization and pruning usually work better together.

  • Calibrate with real data, not a convenient proxy dataset.

  • Check accuracy per class. An average can hide a real problem.

  • Re-test on the real target and iterate. Numbers don't transfer across environments, and the first pass is rarely the last.


Why the Same Trick Doesn't Work Twice


An optimization that helps in one deployment can actively hurt in another. There's no such thing as a universally “optimized model.” Every target makes its own assumptions. A platform can claim support for a lower precision and still lack the path to actually use it. Some toolchains expect an unquantized model as input and break if handed in a pre-quantized one.


Data layout expectations differ. And the format that's the obvious choice for one pipeline may not be supported at all in another. None of this is a flaw in any one platform; it's just what happens when every target has its own trade-offs. The same INT8 build that flies on an NPU can end up slower than the FP32 original on a CPU that has to emulate the quantized operators. Benchmarking has to happen against the real target, every time.


The Format Is Part of the Job Too


One decision trips teams up almost as often as the optimization itself, and it happens after the hard part is supposedly done. It is the format the optimized model gets packaged into. The same model, exported in two different ways, can behave completely differently once it reaches whatever is meant to run it.


The Model Format Landscape
The Model Format Landscape

Most models pass through the same rough sequence on their way out. They start framework-native, saved straight from whatever trained them and tied to that framework. From there they usually move into an interchange format, a single file other tools can read, versioned so a consumer knows which operator set it is looking at. A compiler or runtime then turns that into its own intermediate representation, which is where most target-specific optimization actually happens. What finally ships is often something packed and serialized, weights only, built to load fast and safely on the device. Every hop in that chain is a place where an operator can go unsupported or a shape can be silently reinterpreted.


Picking the wrong one doesn't just make a model slower. It can mean the model doesn't load at all, or loads and quietly produces different numbers than the one that was tested. Whatever format it ends up in, the only way to trust it is to run the same inputs through the original and the exported version and check the answers actually match. A loaded file is not the same thing as a correct one.


By the Numbers 


▸  Depending on the model architecture and the target hardware, INT8 quantization often reduces model size to roughly one quarter of FP32, while providing significant inference speed improvements on hardware that supports INT8 acceleration. 

▸  Structured pruning can commonly remove 30 to 50% of a model's size, though how much accuracy that costs depends heavily on the architecture and on how gradually the cuts are made. 

▸  The costliest optimization mistakes are rarely the slow ones. They're the silent ones: a format or shape mismatch nobody catches before deployment. 


The Only Score That Counts


The difference optimization makes is almost boring to describe. The model behaves in production exactly like it did in testing, in whatever precision and format it actually shipped in. Nothing about that sentence belongs on a slide, which is exactly why this part of the work rarely gets a demo of its own, and exactly why skipping it is the most expensive shortcut a team can take.


A model that scores well in testing is a promising result. A model that keeps performing, hour after hour, on whatever it was actually handed to run on, is the only version that actually matters. Optimized isn't a badge a model earns once. It's something it has to keep earning, on every target you ship it to.


Ready to optimize your next deployment? At WG Tech Solutions, we fine-tune hardware and AI models with deep software integration so your solutions perform exactly as required. Reach out to us for full or partial product development—from custom hardware and lightweight AI to integrated software—built alongside our leading MCU, MPU, Accelerator, and GPU partners.


Sahana P

Edge AI Engineer at WG Tech Solutions

 
 
 

Comments


bottom of page