Skip to content

feat(hermes): set the context window compression reads (context_length) - #5777

Merged
yaoyu-33 merged 1 commit into
NVIDIA-NeMo:mainfrom
gwarmstrong:georgea/hermes-context-length
Nov 7, 2026
Merged

yaoyu-33 merged 1 commit into
NVIDIA-NeMo:mainfrom
gwarmstrong:georgea/hermes-context-length

Conversation

@gwarmstrong

@gwarmstrong gwarmstrong commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

hermes_agent gains context_length (unset by default). It writes Hermes' own model.context_length override into the generated config.yaml, so context compression reads the model's real window.

Why: Hermes compresses at compression_threshold of its context window. The generated config names the model only, so Hermes probes the endpoint for the window. The Gym model server does not answer that probe (it serves no /v1/models), and Hermes falls back to 128,000 tokens. On a 262,144-token server it then compresses at 108,800 tokens instead of 222,822. No issue was filed; the fix is one config field.

Defaults are unchanged: without context_length, the config is written exactly as before.

Validation

  • gym env test +entrypoint=responses_api_agents/hermes_agent: 370 passed.

  • Two new tests:

    • context_length is written as model: {default: <name>, context_length: <n>};
    • without it, model stays the plain name.

    The first fails on the previous app.py and passes with this change.

  • Against the pinned hermes-agent (26bb847a), AIAgent built from each config reports:

    • with context_length: 262144: context_compressor.context_length 262144, threshold 222,822 tokens;
    • without it: 128,000 and 108,800.
  • pre-commit run on the changed files: clean. DCO sign-off.

Rollouts

Real-model evidence comes from full HLE Diamond text rounds: 728 questions, Super 3.5, Hermes through a hermes_agent session, run through NVIDIA's eval-factory recipes. The round with Hermes' 128,000 fallback and the round with context_length: 262144 scored 0.091 and 0.082. All 728 questions were graded in both. The gap is within the round-to-round spread we measured on this set (0.01–0.02). The setting changes when Hermes compresses, not whether a run completes.

Compatibility

Opt-in only. Existing configs and results are unchanged.

Hermes compresses at compression_threshold of its context window. The
generated config.yaml names the model only, so Hermes probes the endpoint,
which the Gym model server does not answer, and assumes 128,000 tokens: on a
262,144-token server it compresses at 108,800 tokens instead of 222,822.
context_length writes model.context_length, Hermes' own override; unset keeps
today's config. Checked against the pinned hermes-agent 26bb847a: AIAgent
reads 262144 and a 222,822-token threshold with it, 128000 and 108,800
without.

Signed-off-by: gwarmstrong <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 6, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@gwarmstrong
gwarmstrong requested a review from yaoyu-33 November 6, 2026 23:30
@yaoyu-33
yaoyu-33 enabled auto-merge November 6, 2026 23:39
@gwarmstrong

Copy link
Copy Markdown
Contributor Author

/ok to test 00babfc

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

SHIP

LGTM — no concerns found.

I reviewed all three changed files and traced the configuration through host and sandbox execution. The override is opt-in, the unset branch preserves the existing model-name string, and the sandbox runner retains the model mapping. The added tests assert concrete values for both configured and unset cases.

This was a static review. I didn't execute tests or reproduce the reported rollouts. Hermes' external implementation isn't mounted, so I verified the adapter's propagation rather than Hermes' internal interpretation.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@yaoyu-33
yaoyu-33 added this pull request to the merge queue Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42316455715

Merged via the queue into NVIDIA-NeMo:main with commit d56d805 Nov 7, 2026
61 checks passed
yaoyu-33 added a commit to yaoyu-33/Gym that referenced this pull request Nov 10, 2026
Resolve the integrate-existing-agents conflict by keeping main's task-folders
link and dropping hermes_sandboxed_agent from the deprecated list. Replace
the harbor-tasks example of an ambiguous --agent with terminus_2, since
`hermes` now resolves to hermes_agent alone. Update the Hermes migration
notes for main's context_length setting (NVIDIA-NeMo#5777): it keeps its name but sets
only model.context_length, where the removed adapter also set the
summarization auxiliary's window.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

This branch was previously deployed

1 inactive deployment
public — 00babfc2 Deployed Nov 6, 2026 by copy-pr-bot[bot] via release / finalize / notify #10780
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.

3 participants