AdvancedAbout 20 min

    Quantization & Memory Math

    Read the full article on Substack

    7 min read.

    Work out whether a model actually fits. Split a float into range and precision bits, estimate inference at N × M × 1.2, and watch a 13B model need another 78 GB the moment you make every parameter trainable.

    Think of it this way: Measuring a plank. You can record it to the millimetre or to the nearest centimetre, and you can allow for planks up to two metres or up to a kilometre. Those are two separate decisions — precision and range — and a tape measure has a fixed number of digits to split between them.

    FP6464 bitsFP3232 bitsTF3219 bitsBF1616 bitsFP1616 bitsINT88 bitsINT44 bits

    FP16 (half precision): 1 sign bit, 5 range bits, 10 precision bits, 2 bytes per value. More precise than BF16 in the middle of its range, and it overflows to infinity much sooner.

    Check your understanding

    Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.

    Order by bytes per parameter

    Sequence

    Order these formats from most memory per parameter to least.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    1. 1Drop a step here
    2. 2Drop a step here
    3. 3Drop a step here
    4. 4Drop a step here
    4 pieces left to place

    Quiz

    20 questions
    Question 1 of 20
    Score: 0

    In a floating-point format, the exponent bits determine:

    Done with this lesson?

    Sign in free to keep your progress, streak and quiz scores.

    Keep going