Menu

Why a 2B-parameter model fits on a phone: quantization in plain numbers
📰

Why a 2B-parameter model fits on a phone: quantization in plain numbers

DEV Community: dart·Stacklyn Labs·4 days ago
#N16RkbUL
#devtodart#devto#dev#model#inference
Long article (770 words) — no AI summary yet.
Reading 0:00
15s threshold

Cloud LLM calls cost money per token, add a network round trip to every prompt, and send user text to someone else's server. Running a small model on the phone fixes all three. But a 2-billion-parameter model sounds far too big for a phone. The reason it fits is quantization, and the numbers are simple.

The memory math

Neural network weights are normally stored as 32-bit floats (FP32). That is 4 bytes per parameter. For a 2-billion-parameter model such as Gemma 2B, the raw weights need about 8 GB of RAM . A mobile OS will kill an app that tries to hold that.

Quantization lowers the precision of each weight:

Format Size change vs FP32

INT8 (8-bit integers) 75% smaller

INT4 (4-bit integers) 87.5% smaller

A 4-bit Gemma 2B ends up at roughly 1 GB to 1.5 GB . That fits the memory of modern iOS and Android devices. You give up a small amount of precision and get faster inference, lower battery use, and a model that doesn't crash the host app.

It also helps speed.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.