Tinker Models on your device

by Samy (Kondasamy Jayaraman)

3B model at 4 bits: 1.60 GB of 2.00 GB free. It fits.

The 3B model at 4 bits with 0 tokens of context: cobalt bricks are weights, mint are cache. The handheld’s memory, battery and speed are Larkspur’s planning numbers.

Chapter 3 of 7

The working memory

At 4 bits the 3B fits with room to spare. But the picker’s chat, the stock list and the instructions all ride along as context.

This chapter: How much memory does the context take, and when does it overflow?

About this chapter

You will learn

  • The KV cache: keys and values kept for every token read
  • Its size, from the model’s published shape
  • Why a long context can overflow a model that fits

Words you’ll meet

KV cache
The keys and values the model keeps for every token it has read, so each new token computes only its own.
Context
Everything the model reads before replying: instructions, the chat so far, the stock list.

Step 1 of 4

The keeps keys and values for every token: 115 KB each for the 3B model.

Set the context to 1,000 tokens.

0 tokens