Skip to content

feat: add LM Studio JIT load mode - #42346

Closed
marcelohildebrand wants to merge 1 commit into
NousResearch:mainfrom
marcelohildebrand:feat/lmstudio-jit-load-mode
Closed

feat: add LM Studio JIT load mode#42346
marcelohildebrand wants to merge 1 commit into
NousResearch:mainfrom
marcelohildebrand:feat/lmstudio-jit-load-mode

Conversation

@marcelohildebrand

Copy link
Copy Markdown
Contributor

Summary

  • add model.lmstudio_load_mode with a backwards-compatible default of explicit
  • support model.lmstudio_load_mode: jit to skip Hermes' explicit LM Studio preload call and let LM Studio JIT/Auto-Evict manage model loading
  • document the new LM Studio config option
  • add regression coverage for JIT skip behavior and explicit/default preload behavior

Motivation

LM Studio's Hermes integration docs describe JIT loading support, but Hermes currently preloads LM Studio models through the LM Studio management API before the first chat request. That path is useful for enforcing Hermes' minimum context, but it bypasses LM Studio's normal JIT-loading / Auto-Evict behavior. Users who rely on LM Studio Auto-Evict can hit VRAM pressure when the explicit preload path tries to load a model before LM Studio has a chance to evict the previous one.

This change keeps the current explicit preload behavior as the default while allowing users to opt into LM Studio-managed JIT loading:

hermes config set model.lmstudio_load_mode jit

To restore the existing behavior:

hermes config set model.lmstudio_load_mode explicit

Testing

  • uv run --with pytest python -m pytest tests/run_agent/test_lmstudio_load_mode.py tests/run_agent/test_switch_model_context.py -q -o 'addopts='
    • 5 passed
  • python -m py_compile run_agent.py agent/agent_init.py tests/run_agent/test_lmstudio_load_mode.py
  • git diff --cached --check

Notes

The default remains explicit, so existing LM Studio users should keep the same behavior unless they opt into jit.

@alt-glitch alt-glitch added type/feature New feature or request comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have labels Jun 8, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the focused opt-in path. The current behavior is still present: run_agent.py:761-775 unconditionally routes LM Studio through ensure_lmstudio_model_loaded(), and the shared helper is reached during initialization (agent/agent_init.py:1751), model switches (agent/agent_runtime_helpers.py:2029-2030), and fallback activation (agent/chat_completion_helpers.py:1606-1607).

Problems

  • model.lmstudio_load_mode is documented and read by the PR, but it is not added to the config schema. hermes_cli/config.py:976-980 has no default for it, so schema-driven config consumers cannot discover the setting.
  • tests/run_agent/test_lmstudio_load_mode.py only constructs a SimpleNamespace and tests the helper guard. It does not cover config loading through init_agent() into the first preload path.

Suggested changes

  • Add the explicit default through the existing model-config normalization path, preserving scalar legacy model config compatibility.
  • Add a temp-HERMES_HOME config-propagation regression test for jit and the default/explicit case.

Automated hermes-sweeper review.

Comment thread agent/agent_init.py
# just-in-time / Auto-Evict chat-completions path. Keep the default
# explicit for backward compatibility; users with LM Studio Auto-Evict can
# opt into JIT via ``model.lmstudio_load_mode: jit``.
agent.lmstudio_load_mode = "explicit"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add model.lmstudio_load_mode: explicit through the config schema/normalization path as well. The runtime fallback is safe, but leaving the new documented setting out of DEFAULT_CONFIG means schema-driven config consumers cannot discover its default.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
prmartinow pushed a commit to prmartinow/hermes-agent that referenced this pull request Aug 26, 2026
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants