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

batch loglikelihood_rolling across requests #2559

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

batch loglikelihood_rolling across requests #2559

wants to merge 7 commits into from

Conversation

baberabb
Copy link
Contributor

@baberabb baberabb commented Dec 11, 2024

Currently, loglikelihood_rolling processes each request's windows separately, leading to suboptimal batching and more calls to _loglikelihood_tokens than necessary. This PR optimizes the function by batching windows across different requests.

@baberabb
Copy link
Contributor Author

Results with meta-llama/Llama-3.2-3B, max_length=2048

Before:

hf (pretrained=meta-llama/Llama-3.2-3B,max_length=2048), gen_kwargs: (None), limit: None, num_fewshot: None, batch_size: 16

Tasks Version Filter n-shot Metric Value Stderr
wikitext 2 none 0 bits_per_byte 0.6243 ± N/A
none 0 byte_perplexity 1.5414 ± N/A
none 0 word_perplexity 10.1131 ± N/A

vllm (pretrained=meta-llama/Llama-3.2-3B,max_length=2048,gpu_memory_utilization=0.5), gen_kwargs: (None), limit: None, num_fewshot: None, batch_size: 16

Tasks Version Filter n-shot Metric Value Stderr
wikitext 2 none 0 bits_per_byte 0.6243 ± N/A
none 0 byte_perplexity 1.5414 ± N/A
none 0 word_perplexity 10.1138 ± N/A

After:

hf (pretrained=meta-llama/Llama-3.2-3B,max_length=2048), gen_kwargs: (None), limit: None, num_fewshot: None, batch_size: 32

Tasks Version Filter n-shot Metric Value Stderr
wikitext 2 none 0 bits_per_byte 0.6243 ± N/A
none 0 byte_perplexity 1.5415 ± N/A
none 0 word_perplexity 10.1153 ± N/A

vllm (pretrained=meta-llama/Llama-3.2-3B,max_length=2048,gpu_memory_utilization=0.5), gen_kwargs: (None), limit: None, num_fewshot: None, batch_size: 16

Tasks Version Filter n-shot Metric Value Stderr
wikitext 2 none 0 bits_per_byte 0.6243 ± N/A
none 0 byte_perplexity 1.5414 ± N/A
none 0 word_perplexity 10.1138 ± N/A

@MaxiBoether
Copy link

Also wanted to give my thanks here for adressing this so quickly! Looking forward to this being merged into main :)

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