Hugging Face, End to EndLesson 20 of 75

Module 3 · Running it on the hardware you actually have

The memory arithmetic you can do in your head

In this lesson

  • 9 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 2 of 9 in this chapter

This chapter’s goalCompute from a model’s parameter count and dtype whether it will fit the machine in front of you, pick between a full-precision, quantized, GGUF or ONNX route for a stated constraint, and measure peak memory, first-token latency and quality loss well enough to defend the choice.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmWatch2:05Not available
Full audiobookNot availableNot available
A seven-billion-parameter model, by dtypefloat32, four bytes aparameter28 GBbfloat16, two bytes aparameter14 GBint8, one byte a parameter7 GB4-bit nf4, about half abyte4 GBKV cache, one 4,096-tokensequence0.50 GBThe first four bars are the weights alone. The fifth is what a single 4,096-token conversation adds ontop of whichever of them you chose: eight concurrent conversations of that length cost about fourgigabytes, which is the whole of the quantized model again. Most people discover the constraint is thecache, not the weights.
The first four bars are the weights alone. The fifth is what a single 4,096-token conversation adds on top of whichever of them you chose: eight concurrent conversations of that length cost about four gigabytes, which is the whole of the quantized model again. Most people discover the constraint is the cache, not the weights.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 8Free · no account needed
Lesson steps

One multiplication decides most of it

weights in bytes = parameters × bytes per parameter

The bytes per parameter come from the dtype:

  • float32: 4 bytes. The default if you say nothing, and almost never what you want.
  • float16 / bfloat16: 2 bytes. The normal choice on a GPU.
  • int8: 1 byte.
  • int4: about 0.5 bytes, plus a small overhead for scales.

So a 7-billion-parameter model is 28 GB at float32, 14 GB at bfloat16, 7 GB at int8 and roughly 4 GB at int4. A 1.5B model is 3 GB at bfloat16 and fits comfortably in a free Colab session with room to work. A 70B model is 140 GB at bfloat16, which is two 80 GB cards, and about 40 GB at int4, which is one.

You can now look at any repository name and know, before downloading anything, whether it is worth downloading.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Image Generation, in Practice exam.

Stuck on something?Ask Arjun, your AI tutor

How to cite: Addaly (2026) ‘The memory arithmetic you can do in your head’, in Hugging Face, End to End. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/hugging-face/dtype-and-the-memory-bill (Accessed: 29 November 2026).