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

Lookahead in forward #1447

Open
Dionysour opened this issue Dec 11, 2024 · 3 comments
Open

Lookahead in forward #1447

Dionysour opened this issue Dec 11, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Dionysour
Copy link

System Info

transformers '4.47.0', bitsanbytes '0.45.0', torch '2.5.1+cu124', NVIDIA RTX A4000

Reproduction

During assisted greedy generation with the verifier loaded in 8-bit, I have noticed that it diverges from vanilla greedy generation. I have investigated this problem and discovered lookahead during forward on a particular sequence. Here's a snippet of the notebook without unnecessary code. You can run it and see the problem, but you need a Llama2 chat token because it's the model I was using.

https://gist.github.com/Dionysour/24b352bb685f7d4a8ffd18896455700d

Expected behavior

change of [n] token doesn't affect logits of [:n] tokens

@matthewdouglas matthewdouglas added the bug Something isn't working label Dec 13, 2024
@matthewdouglas matthewdouglas self-assigned this Dec 13, 2024
@matthewdouglas
Copy link
Member

Thanks for the report. I was unable to reproduce this with Llama 3.1 8B in an environment with torch 2.5.1+cu124, transformers 4.47.0, bitsandbytes 0.45.0, on an RTX 4090.

I'm downloading Llama2 now and will give that a try.

@Dionysour
Copy link
Author

Dionysour commented Dec 14, 2024

I think this behaviour with llama 3.1 is expected. The bug is very model and sequence dependent. I saw different predictions for different models too. So to reproduce it model must be "meta-llama/Llama-2-7b-chat-hf"

@poedator
Copy link
Contributor

I also have a reproduction of the issue found by @Dionysour in this notebook.
https://nbviewer.org/gist/poedator/52440da0cdab808a4c0ff929f009ae31

tested on A100 with
bitsandbytes 0.44.1
torch 2.4.1
transformers 4.45.2
python 3.9

Apparently something is wrong with how bnb-8bit model deals with attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants