Skip to content

Connect top_k in Interpreter/Engine up to front-end vis#1308

Merged
nopdive merged 4 commits intoguidance-ai:mainfrom
hudson-ai:fix_topk_in_engine
Jul 7, 2025
Merged

Connect top_k in Interpreter/Engine up to front-end vis#1308
nopdive merged 4 commits intoguidance-ai:mainfrom
hudson-ai:fix_topk_in_engine

Conversation

@hudson-ai
Copy link
Copy Markdown
Collaborator

  1. Removes EngineOutput in favor of purely using GenTokenExtra
  2. Engine now returns GenTokenExtra whenever we have top-k (still just for generated tokens)
  3. Refactored get_next_token_with_top_k a bit for more readability

Returning said GenTokenExtra was the missing bit of plumbing needed to get top-k to show up in vis. @nopdive note that vis is displaying base64 encoded token bytes instead of the actual bytes, so that still needs fixing.

@JC1DA would appreciate your eyes on get_next_token_with_top_k to make sure it's still correct

There are some remaining optimizations to be done, e.g. not computing unmasked probs at all if we're not doing vis. But I think that's "next PR territory", as afaik, this is not a regression.

@JC1DA
Copy link
Copy Markdown
Collaborator

JC1DA commented Jul 7, 2025

LGTM!


last_temperature = 1.0
engine_output = None
issued_token: Optional[GenToken] = None
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.

seems we only change the name here right?

@nopdive nopdive merged commit ce45048 into guidance-ai:main Jul 7, 2025
25 checks passed
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