-
Notifications
You must be signed in to change notification settings - Fork 49
feat: Adds think budget-forcing #107
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
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for the contribution! The pre-commit checks found several type errors and a typo; could you please fix these prior to a code review? You can run these checks locally by installing the pre-commit hooks. Assuming you have already created a venv and installed Mellea editable ( Once installed, you can still commit over errors using the -n (no-verify) flag; e.g., |
I have fixed the type errors related to the modified code, however I still get pre-commit (MyPy) errors for code not related to this PR: |
|
@nrfulton let us know if there are any further changes needed. It would be good to know if we are missing something fundamental. This will inform the other PRs, thanks!. |
@ramon-astudillo @nrfulton after some recent updates to main, it seems that automatic checks fail for my branch. I modeled my tests using |
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Signed-off-by: Mateus Devino <mdevino@ibm.com>
…rompt_modules (generative-computing#105) * Implements "prompt_modules" and complete refactor of the "decompose" feature * typo: missing period * minor fix: changed the "NotRequired" import * fix: minor fixes * moves prompt_modules to utils * moves decompose modules to appropriate path * refactor: moves prompt_modules to cli scope Signed-off-by: Tulio Coppola <tulio.cppl@icloud.com> * adds README.md to write later Signed-off-by: Tulio Coppola <tulio.cppl@icloud.com> --------- Signed-off-by: Tulio Coppola <tulio.cppl@icloud.com> Co-authored-by: Tulio Coppola <tuliocoppola@ibm.com> Co-authored-by: Nathan Fulton <nathan@ibm.com>
|
@nrfulton |
|
Thanks! Taking a look. |
corrected default argument
|
Hi @nrfulton any further concerns? if not, I suggest merging |
A couple of questions:
|
| if rem_toks <= min_step_len: # minimum step length reached | ||
| break | ||
|
|
||
| model_options["max_tokens"] = rem_toks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
model_options
| model_options["max_tokens"] = rem_toks | ||
| # TODO workaround to obtain generated token counts | ||
| # The token count should be relayed by openai's CompletionUsage | ||
| model_options["logprobs"] = 1 # To get number of generated tokens |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
model_options
|
|
After recent discussions, this PR requires prompting |
|
@nrfulton @ramon-astudillo This PR is ready for review, it incorporates all the recent updates involving the |
Implements think budget-forcing techniques
Generates response with budget forcing using the completions APIs.
This relies on multi-step raw autocompletion and assumes the model's output is structured in the following form:
<think> ... </think> summary answerThe budget forcing method is proposed in the paper: https://arxiv.org/abs/2501.19393
This implementation tries to follow the key outlines in the paper while ensuring stable and fail-safe operation.
This is performed via multi-step generation. The model will be called multiple times until requirements are met, in other words, the response will be assembled conditionally.
unit tests provided
uv run --with mellea test/stdlib_basics/test_think_budget_forcing.py