Hacker News new | ask | show | jobs
by searealist 18 days ago
There are two phases to LLMs:

1) prefill

2) decode

For prefill, you are compute bound, and it is trivial to batch multiple input tokens together. When using cpu offload, software like llama.cpp will batch weight uploads with tokens that need those weights and perform work on the GPU. It works very well. With a large batch size and pcie5 you can get prefill speeds close to having all weights on the GPU.

For decode, you are bandwidth bound, and it is difficult to batch multiple output tokens together. There is no benefit to sending your weights to the GPU because even if it internally has insane bandwidth, you are still bottlenecked by system RAM (and adding a pcie5 upload would bottleneck it further). This is the number people usually talk about when they say they are getting a certain tk/s.

1 comments

> For decode, (...) it is difficult to batch multiple output tokens together.

I think it's the other way around? The GPU has to stream gigabytes of active layer weights to compute the next token, so having a batch of next-token predictions sitting there on the GPU goingh through the layers makes better use of the bandwidth.

At least that's what I observed on a Strix Halo, batching 4 predictions yields like 2-3x the total tps.

MTP can give you small batches, but it is still WAY smaller than the batches you can get with prefill, which is limited only by the number of input tokens you have (but has diminishing returns on performance).

But:

1) It still makes no sense to upload the weights to the GPU with MTP as you are still bottlenecked by the weight upload.

2) I'm not sure MTP helps much with MoE models.