Skip to content

[Native] Select the logits rows an off-graph export returns - #25009

Draft
metascroy wants to merge 1 commit into
offgraph-kv-ggml-index-rowsfrom
offgraph-kv-selected-logits
Draft

metascroy wants to merge 1 commit into
offgraph-kv-ggml-index-rowsfrom
offgraph-kv-selected-logits

Conversation

@metascroy

@metascroy metascroy commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Stack

Off-graph KV cache for the native ggml engine, through serving Muse Glimmer on it. Review bottom-up; each PR builds and passes its tests on its own.

Summary

The off-graph export returned the last token's logits, which is what a forward over one sequence needs. A batched forward packs several sequences' tokens, and each wants the logits of its own last token.

  • Export: --logits_to_keep selected adds a third int64[K] input of token indices, passed to Hugging Face's logits_to_keep, so the method returns those rows ([1, K, vocab]) without running the LM head over every token. The package records the mode as get_logits_to_keep_mode, as MLX packages do. Muse Glimmer's text-only module takes the index tensor too.
  • Runner: reads the mode from the package and feeds a selected method the last token's index, so these packages still run and verify their golden samples standalone. A method whose input count disagrees with the mode is refused.

Test plan

  • test_export_hf_llm.py on transformers 5.0.0rc1 and 5.22.2: selected golden samples match last-token ones exactly, the export takes three inputs and returns the selected rows, and the metadata records the mode.
  • A 4-layer Muse Glimmer slice and a tiny Gemma3, exported selected, replay their golden samples through run_hf_llm_ggml on CPU and Metal.

Authored with Claude Code.

@pytorch-bot

pytorch-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/25009

Note: Links to docs will display an error until the docs builds have been completed.

❌ 134 New Failures, 2 Cancelled Jobs, 7 Unrelated Failures, 10 Unclassified Failures

As of commit 95d13f3 with merge base c7f7931 (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

CANCELLED JOBS - The following jobs were cancelled. Please retry:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 13, 2026
This was referenced Nov 13, 2026
@metascroy
metascroy force-pushed the offgraph-kv-ggml-index-rows branch from c0d7b51 to 7f88bcc Compare November 14, 2026 00:18
The off-graph export returned the last token's logits, which a forward over
one sequence needs. A batched forward packs several sequences' tokens, and
each wants the logits of its own last token. --logits_to_keep selected adds
a third int64[K] input of token indices, passed to Hugging Face's
logits_to_keep, so the method returns those rows ([1, K, vocab]) without
running the LM head over every token. The package records the mode as
get_logits_to_keep_mode, as MLX packages do, and Muse Glimmer's text-only
module takes the index tensor too.

The native runner feeds a selected method the last token's index, so these
packages still run and verify their golden samples standalone.

This branch had an error being deployed

1 failed deployment
cadence — 95d13f30 Deployed Nov 14, 2026 by metascroy via hifi1s-build / hifi1s #38340
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant