Weights in int8
Explore how an integer code and a scale represent a model weight together.
A model weight can be stored as a small integer together with a scale. The int8 format takes one byte per number. The scale tells you the value of one step and also takes up storage.
A small example
In a toy encoding, code 6 at a scale of 0.1 represents the weight 0.6. What if you copy just the code and read it using a scale of 0.2? You get 1.2. To reconstruct approximate weights you must keep their scales with the codes.
Count the bytes for the scale
Take four weights stored using four bytes each. Together they occupy 16 bytes. Now use one byte per weight and keep a single four-byte scale for the group. How much storage does the group need? Four bytes for the codes plus four for the scale makes eight. That halves the space for this small group. The size of the whole file will also depend on what else is stored alongside the weights.
Done reading?
Mark the lesson as read to move your track progress forward.
Lesson marked as done.
Now build your own version
Reduce model weight storage and check which parts remain float32.
What practice includes and how much it costs
MCP includes the full lesson and a local project with starter files. Work through the task with your agent, ask for a hint and run the checks on your computer.
One payment, no auto-renewal · Terms
Progress saved in this browser
Clear your history or open this on your phone, and the marks will be gone. Leave your email and they'll move to your account. No password needed.
Done. moved to your account. You can see your progress on any device. My progress