Generating text one token at a time would repeat enormous amounts of work if the model recomputed the whole past at every step. The key-value cache stores the past keys and values so that each step only does the new token’s work. The price is memory, which grows with the context and with the number of users.
You will fit a serving workload into a GPU, write the cache-size formula, and count the work that the cache saves.