Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inference colorization #402

Merged
merged 3 commits into from
Feb 24, 2025

Conversation

klei22
Copy link
Collaborator

@klei22 klei22 commented Feb 21, 2025

This adds two colorization modes for sample.py:

  1. 'minmax' - direct logit magnitude, but normalized over inference.
  2. 'softmax" - normalized over all vocab logits with softmax, shows even lower values for first letter.
  3. 'softmax_top_k' - normalized first by softmax then printing colors, at normal temperatures of softmax it shows moreso non-top-k choices.

Left minmax, right softmax
image

Left softmax_top_k right softmax:
image

klei22 added 2 commits February 20, 2025 16:01
This gives the option to colorize output by either the softmax val of
the output or the overlap.
Note that it appears that the first letter has larger number of top k
swaps.

This might not be so bad, as evidenced in the minmax output, the first
letter (resonating with SpaceByte and our earlier analysis) has a higher
temperature so to speak than the remaining letters in a word.

However, the selection of lower top k for middle values might be worse.
Perhaps this hints at a better decoding scheme where we emphasize the
first syllable of a word, turning off top k for following.
@klei22 klei22 requested a review from gkielian February 21, 2025 01:02
This compartmentalizes each of the colorization mode operations into
conditionals, minimizing the interference on the default sample mode.
@klei22 klei22 force-pushed the add_inference_colorization branch from e59e8be to 366e7e0 Compare February 24, 2025 00:03
Copy link
Collaborator

@gkielian gkielian left a comment

Choose a reason for hiding this comment

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

Looks good

@gkielian gkielian merged commit 54e4748 into ReaLLMASIC:master Feb 24, 2025
8 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.

2 participants