Efficient models and edge AI

The best place to run a model depends on the job

A practical look at quantization, local inference, cloud fallback, and what my work on devices and MLTFT taught me about deployment.

A small edge computer in the foreground with a larger server rack behind it.
AI-generated editorial illustration.

Building hardware at Black Box Crypto alongside software has made “it runs” a more demanding sentence. What does it run on? Can I load it after an update? How long does it take when the device has been doing real work for a while? I ask the same questions about AI inference. The model may be the most interesting piece of the project, but the hardware, runtime, and connection all get a vote in how useful it is.

Start with the latency people feel

When the model runs near the sensor or the user, we usually call it edge AI. Keeping work local can help with response time, intermittent connectivity, or keeping raw data near its source. Running in the cloud can give the system access to more memory and compute. These choices meet in the thing a user experiences, which is the time and effort between their action and a useful result.

Imagine a thermal camera tagging clips. A small local detector could mark intervals with possible motion and keep a short event buffer. A heavier model could analyze selected clips later, subject to review and the project’s data rules. The device handles a job with a tight response window. The later review gets more time and a smaller amount of information to inspect. I would test that the queue also works after a period offline.

That division is a design choice, not an automatic win. A local detector can miss the events most worth sending. It can consume enough power to shorten the recording time. Different devices may run differently under the same workload. I want to bench the whole job on hardware like the hardware we expect to use, with an evaluation set that includes the difficult examples.

A local-first wildlife review example The local device captures evidence and hands off selected work for deeper analysis.
  1. Capture locallyKeep a short recording buffer and preserve the event timestamps.
  2. Flag candidatesScore movement and retain clips around candidate events.
  3. Queue for reviewPreserve events during outages and observe storage limits.
  4. Analyze when eligibleRun deeper analysis on allowed clips when resources are available.

Quantization changes the numbers the runtime carries

Model weights and intermediate values need a numerical representation. Quantization represents some of them with fewer bits. That can reduce storage and memory traffic and enable faster hardware operations. The details of what gets quantized and how its scale is chosen matter. A file size that drops by half can still result in a small speed change if the runtime cannot use the intended operations on the target hardware.

I would try a few configurations on representative inputs and measure elapsed time, peak memory, and the error cases I care about. For a text model, try both short and long interactions, including any retrieval context. For a detector, separate hard cases such as small or partially obscured objects. If the aggregate score stays flat while one important class gets worse, I want to know before I send out an update.

GPTQ is an example of work on post-training quantization for large language models. The engineering implication I take from the paper is that model compression is a problem we can explore systematically. ONNX Runtime documents how different quantization formats and execution providers affect deployment. I use documentation like that to choose experiments, then run the experiment on the actual target.

Treat the artifact and runtime as a pair

One practical lesson from the Black Box Crypto MLTFT work is that a trained artifact and a working inference service are two milestones. A model has an input contract, a format, and versions of operators it expects. The target runtime has its own supported versions and dependencies. Loading the model on the machine that exported it proves something useful about that machine. I want a separate load-and-run test in the release environment.

I start with a small known input that exercises the real load path and yields an output we can sanity-check. Record the artifact version, feature shape, runtime version, and where the run happened. For a time-series model I include guards for missing or stale inputs. I want the workflow to show that a fresh artifact really produced a valid forecast, with enough information to distinguish a problem in loading, inputs, or output handling.

It is worth measuring the first call after startup and behavior after repeated use. A service that feels quick during a demo can have a cold-start penalty. A small device might become slow after it gets hot. Models that share a processor with capture or rendering code need to be tested under that load. If there is a fallback, I want to know how using it changes response time and output.

Pick a division of work you can support

An edge model can protect some data by keeping it near the source, but only if the surrounding application really behaves that way. I would look at what the logs record, what the application queues, and what is sent during troubleshooting or a fallback. If the team needs a deeper cloud review, decide what is eligible to leave, who can approve it, and what the user will see when review is unavailable.

Hybrid can be the right choice without involving two versions of the same model. A deterministic rule can filter an input locally. A compact model can flag events. A search or a person can handle the exception. I write down the job each component does and the measurement that could show a better split. Then I look at the cost to maintain all the parts together.

For an offline-capable device I want updates as well as inference to survive the conditions it will see. The device should be able to identify which artifact it is running, stage an update, and continue with a known version when the update fails. Those capabilities make it possible to support the device after it leaves a test bench.

Four budgets that shape edge inference Measure each budget under realistic workloads and device conditions.
  • TimeCold start, end-to-end latency, and the slow tail.
  • ResourcesPeak memory, power, and sustained temperature.
  • QualityTask accuracy and failure rates on difficult examples.
  • OperationsOffline behavior, versioning, update recovery, and review.

The smallest useful job

If I am choosing a model for a device, I start with the smallest job that will help a person. Decide what should remain possible when the network is down. Get an end-to-end run on the target. Measure what happens when the model sees the hard cases. If we have a clear reason to add more compute after that, we can make the decision with the results in front of us.

For me, the satisfying moment is when I can pick up the device, use the feature normally, and look up what actually happened when it hit a limit. That tells me more about the design than seeing a model run alone on a powerful development machine.

Connect with me on LinkedIn