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

Fix bug with CoT early stopping and LLama2 tokenizer #2902

Merged
merged 16 commits into from
Jan 29, 2024

Conversation

bmosaicml
Copy link
Contributor

@bmosaicml bmosaicml commented Jan 24, 2024

What does this PR do?

LLaMa2 tokenizer didn't work with early stopping because it inserted some extra token (28971) before \n\n. This caused the stop sequence to appear longer than it really was, which resulted in the stopping criteria looking back too far into the input and causing generation to stop as soon as it begins. With the new implementation we remove any superfluous tokens in the stopping criteria (i.e. those tokens that add nothing to the decoded result) I also reduced the amount of extra lookback we do to make it so we don't ever look back farther than we should and stop as soon as generation begins.

Testing: mpt-eval-NzfmSy

| Category   | Benchmark   | Subtask   |   Accuracy | Number few shot   | Model                    |
|:-----------|:------------|:----------|-----------:|:------------------|:-------------------------|
|            | gsm8k       |           |   0.141774 | 0-shot            | meta-llama/Llama-2-7b-hf |

Results replicate LLama2 paper (14.6 for 7b)

What issue(s) does this change relate to?

Before submitting

  • Have you read the contributor guidelines?
  • Is this change a documentation change or typo fix? If so, skip the rest of this checklist.
  • Was this change discussed/approved in a GitHub issue first? It is much more likely to be merged if so.
  • Did you update any related docs and document your change?
  • Did you update any related tests and add any new tests related to your change? (see testing)
  • Did you run the tests locally to make sure they pass?
  • Did you run pre-commit on your change? (see the pre-commit section of prerequisites)

@bmosaicml bmosaicml marked this pull request as ready for review January 24, 2024 22:51
@bmosaicml bmosaicml requested a review from a team as a code owner January 24, 2024 22:51
@dakinggg
Copy link
Contributor

Can you please include some evidence this resolves the issue in the pr description?

@dakinggg dakinggg requested a review from maxisawesome January 24, 2024 23:17
@bmosaicml bmosaicml requested a review from a team as a code owner January 25, 2024 20:23
pyproject.toml Outdated Show resolved Hide resolved
@bmosaicml bmosaicml merged commit 28a9a23 into mosaicml:dev Jan 29, 2024
17 checks passed
@bmosaicml bmosaicml deleted the patch_cot_for_spiece_tokenizer branch January 29, 2024 20:14
ShashankMosaicML pushed a commit to ShashankMosaicML/composer that referenced this pull request Feb 3, 2024
* finish

* finish

* add fixture

* add fixture

* add fixture

* Update tests/datasets/test_in_context_learning_datasets.py

Co-authored-by: Daniel King <[email protected]>

* fix

* pyright

* precommit

---------

Co-authored-by: Daniel King <[email protected]>
ShashankMosaicML pushed a commit to ShashankMosaicML/composer that referenced this pull request Feb 3, 2024
* finish

* finish

* add fixture

* add fixture

* add fixture

* Update tests/datasets/test_in_context_learning_datasets.py

Co-authored-by: Daniel King <[email protected]>

* fix

* pyright

* precommit

---------

Co-authored-by: Daniel King <[email protected]>
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