Repository navigation
feat(scaling): spread model calls across a group's running units - #673
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALjNbLobvPe7VwvDL8j7V3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Before: a model group (RunPod, Hugging Face, SageMaker) served Lens's model calls from one unit only. A group scaled out to three units paid for three GPUs and used one; the others stood by.
After: every running unit of the group takes model calls in turn. A group's units share one API key, made once and sealed on the group, and the scaler keeps a new
llm.spreadsetting ({"base_url", "urls"}) at the shown unit's address and the others'. A unit that can't be reached hands its call to the next. A spread is used only whilellm.base_urlis still the address it was made for, so a provider a person picks never sends calls to a unit.How:
scaling.unit_keymakes or opens the group's key, andbootstraphands it to RunPod and Hugging Face launches asboot["key"].Scaler._servecomputes the other running units with the same model and key (_others) and savesllm.spreadonly when it changes.llm._postwalks_spread(cfg), starting with the next address in turn and trying at most one more when an address can't be reached. Units launched before this keep their own keys and serve only as the shown unit until replaced. Bedrock's units are models at one address, so a Bedrock group still serves from one unit.Motivation and Context
Adeel asked for auto scaling of model providers. Scaling out a model group should add capacity. This was the first Refine later item in docs/scaling.md.
Types of changes
!in the title)Checklist:
test_model_calls_go_to_a_groups_running_units_in_turn,test_llm_spread_is_checked).docs/scaling.md,docs/configuration.md,docs/requirements.md, README).changelog.d/scaling-spread.md.Done questions (AGENTS.md)
llm.spreadshows and is settable in the settings API like any setting; the scaler keeps it.llm.spreaddefaults to none and is an ordinary checked setting.unit_keyonscale_group. Old units keep their keys._serve.Generated by Claude Code