Home Knowledge Base Edge and On-Device Inference

Edge and On-Device Inference

Why Edge Inference? Run models locally on devices for privacy, low latency, offline capability, and reduced cloud costs.

Edge Deployment Targets

TargetTypical PowerUse Case
Mobile phones1-5WPersonal AI
Tablets2-10WField work
Raspberry Pi2-5WIoT, prototypes
Jetson10-30WRobotics, cameras
Edge servers100W+Local inference

Model Optimization for Edge

Quantization

from optimum.intel import OVQuantizer

quantizer = OVQuantizer.from_pretrained("distilbert-base-uncased")
quantizer.quantize(save_directory="./quantized_model", calibration_dataset=dataset)

Pruning

import torch.nn.utils.prune as prune

# Prune 30% of weights
for module in model.modules():
    if isinstance(module, torch.nn.Linear):
        prune.l1_unstructured(module, name="weight", amount=0.3)

Distillation Train smaller model to mimic larger:

# Teacher: large model
# Student: small model for edge
loss = kl_div(student_logits / T, teacher_logits / T) * T^2

Edge Frameworks

FrameworkVendorTarget
TensorFlow LiteGoogleMobile, embedded
ONNX RuntimeMicrosoftCross-platform
OpenVINOIntelIntel hardware
TensorRTNVIDIANVIDIA GPUs
CoreMLAppleApple devices
MLC LLMOpen sourceAny device

MLC LLM Example

# Compile model for device
mlc_llm compile ./model --target android

# Run on Android
mlc_chat ./compiled_model

Edge LLMs

ModelParametersTarget
Gemma 2B2BMobile
Phi-22.7BEdge servers
TinyLlama1.1BEmbedded
Qwen 0.5B0.5BIoT

Performance on Edge

DeviceModelTokens/sec
iPhone 15 ProLlama 7B Q410-15
M2 MacBookLlama 13B Q420-30
Jetson OrinLlama 7B Q415-25

Best Practices

edgeon devicelocal inference

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.