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

llama-bench : add test measuring token generation rate at given prompt length #11126

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fairydreaming
Copy link
Collaborator

I needed a test that would measure token generation rate after processing a prompt of given length, so I decided to add a new kind of test to the llama-bench tool.

This PR adds -gp <pp,tg> option that allows to specify a prompt length and number of tokens generated after processing the prompt. This new test works almost the same way as old -pg test, but it doesn't take into account the prompt length and prompt processing time when calculating result, only the token generation rate is reported.

Test results are labeled in a different way to avoid confusion with -pg test results, I used @ character to emphasize that the result indicates the token generation rate AT given prompt length.

Example:

$ ./bin/llama-bench --numa distribute -t 32 -m /mnt/md0/models/deepseek-v3-Q4_K_S.gguf -p 0 -n 0 -gp 128,32 -gp 256,32 -r 3

model size params backend threads test t/s
deepseek2 671B Q4_K - Small 353.90 GiB 671.03 B CPU 32 tg32@pp128 8.94 ± 0.06
deepseek2 671B Q4_K - Small 353.90 GiB 671.03 B CPU 32 tg32@pp256 8.35 ± 0.01

Hopefully this is more intuitive compared to averaged prompt processing + token generation rate in -pg test results.

Copy link
Collaborator

@slaren slaren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other printers (sql, json, etc) would also need to be updated.

@fairydreaming
Copy link
Collaborator Author

The other printers (sql, json, etc) would also need to be updated.

@slaren Can you be more specific?

@slaren
Copy link
Collaborator

slaren commented Jan 8, 2025

The test type needs to be exported in these printers as well, since n_prompt and n_gen is no longer enough to tell the difference. Another option would be to get rid of test_kind_type and just record and report timings for the prompt and generation steps separately, then the -pg test would be enough.

@fairydreaming
Copy link
Collaborator Author

The test type needs to be exported in these printers as well, since n_prompt and n_gen is no longer enough to tell the difference. Another option would be to get rid of test_kind_type and just record and report timings for the prompt and generation steps separately, then the -pg test would be enough.

I guess another option is to add a "test" column in all printers with the same values as displayed in default console output. Any specific reason it's not included there?

@slaren
Copy link
Collaborator

slaren commented Jan 8, 2025

Yes, that's what I meant when I said that the test type would need to be exported in these printers. There isn't a test column/field at the moment because it is not necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants