Skip to content

Add per-LLM-node generation_config.json path override (#4233) - #4330

Open
exzile wants to merge 6 commits into
openvinotoolkit:mainfrom
exzile:feature/generation-config-path
Open

Add per-LLM-node generation_config.json path override (#4233)#4330
exzile wants to merge 6 commits into
openvinotoolkit:mainfrom
exzile:feature/generation-config-path

Conversation

@exzile

@exzile exzile commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #4233.

Adds an optional generation_config_path field to LLMCalculatorOptions, so several deployments backed by the same model weights can use different generation defaults without duplicating the model directory. This mirrors how graph_path already lets one model directory back several deployments with different graphs.

Behavior

  • Unsetgeneration_config.json from models_path, exactly as before (no change).
  • Set → absolute, or relative to models_path (resolved against the model directory, or its parent when models_path points at a file such as a GGUF).
  • An explicit path that does not exist is a load error (fail fast rather than silently falling back).

A shared resolveGenerationConfigPath helper is used by both the continuous-batching and legacy initializers, so behavior is identical across pipeline types (and the VLM CB servable, which reuses the CB initializer).

Placement rationale

Per the discussion in #4233 (and the config taxonomy from #4221): graph_path already lets one model directory back several deployments with different node options, so putting the override in the node options keeps the whole per-deployment configuration in graph.pbtxt.

Testing

Added LLMGenerationConfigPath.ResolveGenerationConfigPath covering default, absolute, relative, and missing-path cases. Built and ran locally on Windows (MSVC).

🤖 Generated with Claude Code

Adds an optional generation_config_path field to LLMCalculatorOptions so
several deployments backed by the same model weights can use different
generation defaults without duplicating the model directory. Mirrors how
graph_path already lets one model directory back several deployments.

When unset, generation_config.json from models_path is used as before.
An explicit path may be absolute or relative to models_path; a relative
path is resolved against the model directory (its parent when models_path
points at a file, e.g. a GGUF). An explicit path that does not exist is a
load error. Shared resolveGenerationConfigPath helper is used by both the
continuous batching and legacy initializers.

Adds a unit test covering default, absolute, relative, and missing-path cases.

Implements openvinotoolkit#4233

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@exzile
exzile force-pushed the feature/generation-config-path branch from 79ec0ce to 44a52e6 Compare June 27, 2026 01:03
# Conflicts:
#	src/test/llm/llmnode_test.cpp
@exzile

exzile commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@dkalinowski rebased and conflict-free now (additive test collision with main's cache_dir tests — both kept). Adds a per-LLM-node generation_config.json override (#4233). Ready for review when you get a chance.

Comment thread src/llm/servable_initializer.cpp Outdated

Copilot AI 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.

Pull request overview

Adds a per-LLM-node override for generation_config.json via a new generation_config_path option on LLMCalculatorOptions, and wires a shared resolveGenerationConfigPath helper into both legacy and continuous-batching initializers so path resolution is consistent across pipeline types.

Changes:

  • Adds generation_config_path to LLMCalculatorOptions (proto + docs).
  • Introduces resolveGenerationConfigPath(...) and uses it from both legacy and continuous-batching servable initializers.
  • Adds a unit test covering default/absolute/relative/missing-path resolution cases.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/test/llm/llmnode_test.cpp Adds unit test coverage for generation config path resolution.
src/llm/servable_initializer.hpp Declares the shared resolveGenerationConfigPath helper.
src/llm/servable_initializer.cpp Implements resolveGenerationConfigPath including override and existence checks.
src/llm/llm_calculator.proto Adds generation_config_path field to LLM node options.
src/llm/language_model/legacy/servable_initializer.cpp Uses shared resolver to load base generation config.
src/llm/language_model/continuous_batching/servable_initializer.cpp Uses shared resolver to load base generation config.
docs/llm/reference.md Documents the new generation_config_path node option.

Comment thread src/llm/servable_initializer.cpp Outdated
Comment thread src/llm/servable_initializer.cpp Outdated
Comment thread src/test/llm/llmnode_test.cpp Outdated
Comment thread src/test/llm/llmnode_test.cpp
exzile and others added 4 commits July 23, 2026 23:22
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Use FileSystem::resolvePathWithBase (added in openvinotoolkit#4385) for the
  relative/absolute branch instead of hand-rolling is_relative(),
  keeping the generic path resolution in one place. The GGUF
  parent-directory adjustment stays local, since the shared helper is
  deliberately model-agnostic.
- Fix resolveGenerationConfigPath never assigning the resolved override
  back to outPath, so an explicit generation_config_path was validated
  but then discarded and the models_path default returned instead.
- Report a missing/invalid override via a dedicated
  LLM_NODE_GENERATION_CONFIG_DOES_NOT_EXIST rather than reusing
  LLM_NODE_DIRECTORY_DOES_NOT_EXIST, whose "workspace path does not
  exist" message was misleading for this option.
- Harden the unit test: unique temp directory via createTempPath with
  RAII cleanup (a fixed name could collide and leaked on ASSERT
  failure), assert the exact error code, and cover the
  directory-valued override and the GGUF models_path case.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@mzegla mzegla left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@exzile
Generation config is relevant also for VLM and Omni pipelines (@dkalinowski ).
I believe their respective servable initializers should also include the generation config path resolution logic so we are not creating a gap.

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.

generation_config.json path override per LLM node

3 participants