Repository navigation
Granite switch decision 256 options - #30693
Conversation
…ion markers Each switch model needs to identify a collection of single-token option markers that can be mapped to their respective logits for the output probability distribution. The simple upper/lower/numbers set only yields 66 unique markers, but the model can support up to 255. The challenge is that which combinations of characters result in single-token markers is model- specific, so we do a discovery exercise at conversion time by looking through the specific model's vocab for single-token sequences of 1+ plain letter strings (eg `A`, `AA`, `BB`, etc). Branch: GraniteSwitchDecisionFullOptions AI-usage: none Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
Branch: GraniteSwitchDecisionFullOptions AI-usage: none Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
|
cc @ngxson for a small follow-up to increase the option set from 56 -> 256 for Granite Switch as a decision model. |
Branch: GraniteSwitchDecisionFullOptions AI-usage: none Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
|
Hmm, looks like this might not actually fix the benchmark failures. Drafting until we get to the bottom of it. |
|
@CISC @ngxson It looks like there's a mirror of the option label logic between the conversion and
I think (3) is probably the most extensible and avoids multiple sources of truth for this (similar to historical switch from hard-coded templates to embedded jinja2), but it would be slightly more invasive. Opinions? Mine is weakly held, so I'm happy to be minimally-invasive too. |
|
It looks like the challenge of (3) is having a decision-specific array Given that, I think it may make more sense to just piggyback on the existing hard-coding for the other dynamic-single-token architectures. |
… source of truth Branch: GraniteSwitchDecisionFullOptions AI-usage: full (Claude + Sonnet 5.5) Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
Branch: GraniteSwitchDecisionFullOptions AI-usage: full (Claude + Sonnet 5.5) Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
Branch: GraniteSwitchDecisionFullOptions AI-usage: full (Claude + Sonnet 5.5) Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
c763e91 to
c10c2b0
Compare
|
Ok, I found that the Ready for re-review @CISC (sorry for the churn) |
|
not 100% sure if it fits the use case, but we recently added |
Oh! That's exactly the route I was trying to go. I must have been a few commits behind |
|
Given that the |
* feat(convert): Attempt to come up with 256 single-token, semantic option markers Each switch model needs to identify a collection of single-token option markers that can be mapped to their respective logits for the output probability distribution. The simple upper/lower/numbers set only yields 66 unique markers, but the model can support up to 255. The challenge is that which combinations of characters result in single-token markers is model- specific, so we do a discovery exercise at conversion time by looking through the specific model's vocab for single-token sequences of 1+ plain letter strings (eg `A`, `AA`, `BB`, etc). Branch: GraniteSwitchDecisionFullOptions AI-usage: none Signed-off-by: Gabe Goodhart <ghart@us.ibm.com> * docs: Note granite-switch with 256 option markers Branch: GraniteSwitchDecisionFullOptions AI-usage: none Signed-off-by: Gabe Goodhart <ghart@us.ibm.com> * style: Remove extra newline Branch: GraniteSwitchDecisionFullOptions AI-usage: none Signed-off-by: Gabe Goodhart <ghart@us.ibm.com> * feat(convert): Use the computed labels in the template so c++ side is source of truth Branch: GraniteSwitchDecisionFullOptions AI-usage: full (Claude + Sonnet 5.5) Signed-off-by: Gabe Goodhart <ghart@us.ibm.com> * feat: Use LEV case for GRANITE_SWITCH w/ computed labels Branch: GraniteSwitchDecisionFullOptions AI-usage: full (Claude + Sonnet 5.5) Signed-off-by: Gabe Goodhart <ghart@us.ibm.com> * docs: Consolidate g-s into 255 bucket Branch: GraniteSwitchDecisionFullOptions AI-usage: full (Claude + Sonnet 5.5) Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
Overview
Small follow-up to #30676 to increase the number of supported options in the decision template.
Additional information
The model supports up to 256 unique choices. The challenge is that each choice needs to be represented by a single vocab index so that logits can map to probabilities, but there are not 256 obvious single-token markers that make a cohesive semantic set. Since the model is based on an LLM, the markers themselves should carry real semantic meaning (vs arbitrary tokens). To handle this on a model-by-model basis, this PR uses a search process to find combinations of the standard english capital letter set that map to single tokens in the model's vocab (eg
A,AA,B,BB, etc). This is done at conversion time so it has no runtime impact and is static to the converted GGUF model.Requirements