Skip to content

Add idle model unload for mediapipe LLM graphs - #4486

Draft
atobiszei wants to merge 11 commits into
atobisze_refactor_servable_loadingfrom
atobisze_idle_servable_loading
Draft

Add idle model unload for mediapipe LLM graphs#4486
atobiszei wants to merge 11 commits into
atobisze_refactor_servable_loadingfrom
atobisze_idle_servable_loading

Conversation

@atobiszei

Copy link
Copy Markdown
Collaborator

Cherry-picked from idle-models branch (65f2bab).

atobiszei and others added 11 commits August 28, 2026 13:43
Cherry-picked from idle-models branch (65f2bab).
Adds UNLOADED state machine, per-graph idle unload, ActiveInferenceGuard,
config/schema/metrics additions, and related tests.
Cherry-picked from idle-models branch (ceb9f4d).
Adds ModelGroupManager, group_name config field, CLI idle_unload_timeout_seconds,
status codes, and model_group_manager tests.
Comment thread src/modelmanager.cpp
// Urgent reload with existing config (inference-triggered)
// Urgent reload (inference-triggered wake-up or on-demand load)
if (!def)
return StatusCode::MEDIAPIPE_DEFINITION_NOT_LOADED_ANYMORE;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requesting load without taskGraphConfig is INTERNAL_ERROR. Check in L150 doesn't make sense anymore as well.

Comment thread src/modelmanager.hpp
/**
* @brief Model group manager for idle load/unload
*/
std::unique_ptr<ModelGroupManager> groupManager_;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename: groupManager_ -> servableGroupManager

Comment thread src/modelmanager.hpp
return models;
}

const std::unordered_map<std::string, ModelConfig>& getServedModelConfigs() const {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Comment thread src/modelmanager.hpp
return servedModelConfigs;
}

ModelGroupManager* getGroupManager() const {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not expose group manager, and spill such logic to eg kfs_frontend/capi_frontend. We could have additional state that we would treat as READY/LOADED for model readiness, so querying.
What happens when we query model metadata and model is sleeping/unloaded?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants