Model size, latency and energy

The three metrics that govern deploying a model at the edge and how they are estimated and measured.

Intermediate10 min read

Educational draft content that needs expert review before it is used as an academic reference. Specifications, versions and licences change; check the official source. No experimental result is shown here unless it was actually run.

Learning objectives

  • Compute model size from parameters and bits
  • Separate operation count from real latency
  • Relate energy to power and time

Size: parameter count × bits per parameter. 1 million parameters: 4 MB in FP32, 2 MB in FP16 and 1 MB in INT8 (weights only). Add the activation memory used during execution, which can exceed the weight size.

Latency depends on the operation count (MACs) but also on memory movement and optimised kernels. A model with fewer operations is not necessarily faster on your hardware. Energy is measured in joules per inference (energy = power × time) and determines battery life; reducing time at constant power reduces energy.

So all three are measured on the target hardware with the real settings (batch size, frequency, temperature) and the details are recorded for reproducibility.

Terminology (with Arabic equivalents)

MACsعمليات الضرب والتجميع
Activation memoryذاكرة التنشيطات
Peak memoryذروة الذاكرة
Joules per inferenceجول لكل استدلال

Worked example

A model with 3.3 million parameters: 13.2 MB in FP32 and 3.3 MB in INT8 (weights only). If the device draws 0.5 W and finishes inference in 100 ms, the energy = 0.05 J; if the time drops to 40 ms at the same power it becomes 0.02 J.

Code snippet

PythonSimple calculation
def size_mb(params, bits):
    return params * bits / 8 / 1_000_000

def energy_j(power_w, time_s):
    return power_w * time_s

print(size_mb(3_300_000, 32), size_mb(3_300_000, 8))
print(energy_j(0.5, 0.100), energy_j(0.5, 0.040))

An illustrative snippet that was not executed in the lab environment; check library versions in their official documentation before use.

Check yourself

  1. The weight size of a one-million-parameter model in INT8 is about:

    • 0.25 MB
    • 1 MB
    • 4 MB
    • 8 MB
    Answer and explanation

    1 MB — One byte per parameter: 1 million bytes ≈ 1 MB.

  2. Is a model with fewer operations always faster?

    • Yes, always
    • No, memory and the available cores may dominate
    • Only on phones
    • Only in the cloud
    Answer and explanation

    No, memory and the available cores may dominate — Latency is affected by memory movement and core quality, not only by the number of operations.

  3. Energy per inference equals:

    • Power ÷ time
    • Power × time
    • Time ÷ accuracy
    • Size × time
    Answer and explanation

    Power × time — Energy = power × time.

References

Suggested reading (links not verified yet)

  • Banbury et al. (2021). MLPerf Tiny Benchmark. NeurIPS Datasets and Benchmarks Track Not verified

Image and audio processing in the experiments runs inside your browser. Your images and audio are never uploaded and conversations are not stored. Privacy