Add ctx-per-slot argument for unified KV cache#24124
Conversation
|
@ngxson can you take a look? |
|
IMO this change is quite excessive:
|
|
What do you mean by your first point? Right now I don't believe there is any way to limit how much context an individual slot can use when in unified mode, the only limit is the training context I don't think setting n_ctx will affect anything in unified mode specifically, that would work for non-unified As for the second, yeah I just liked it as a minor convenience, happy to remove it if it's too excessive |
|
Removed the I double checked and I'm 95% sure there is no way to limit the context per slot without adding the server code, there's probably a different way to do it in the server code, but something needs to happen there regardless |
|
Any other thoughts @ngxson ? |
|
I am using and the last part is the key: context 200k num-processes 4 What I would instead like is to have 1 slot with 100k and 2 slots with 50k each. Currently I can have non-unified with each slot divided equally or unified with context limit for total... and this is probably what I should be using for my own agent :) like |
Overview
Adds two new arguments for llama-server context provisioning
ctx-per-slot
First argument,
--ctx-per-slotThis specifies how much context each slot is limited to in the
kvumode, so for example if a user wants to have N slots with each having 4096 context, they can specify--ctx-per-slot 4096, it will provision 16384 total context:If specified with
-c, you will then limit the total context:If you set
-cto a value lower than--ctx-per-slot, it will warn and cap to-c's value:Details
ctx-pool-slots
Also adds another new flag,
--ctx-pool-slots, which specifies how many slots worth of context should be allocated, this is similar to setting-cto an explicit value but doesn't require the user to manually do the math ahead of time:If you specify more pool slots than
np, it will warn and clamp tonp:Since this is purely a helper argument, I wouldn't mind dropping it from the PR, I think it would be nice to have but I've been told the server arguments are already getting a bit bloated...
Requirements