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

[MODEL] Make constant vocab size for models instead dynamic #2290

Closed
wants to merge 1 commit into from

Conversation

krishnaraj36
Copy link
Contributor

Used model config vocab size in model compilation instead dynamic variable, which degrades the performance of chat application.

Used model config vocab size in model compilation instead dynamic
variable, which degrades the performance of chat application.
@krishnaraj36
Copy link
Contributor Author

@srkreddy1238 @tqchen : Please take a look to this PR and let me know your advice.

@tqchen
Copy link
Contributor

tqchen commented May 7, 2024

Thanks @krishnaraj36 this is a tradeoff we need to make. Since constant vocab size would mean same lib cannot be shared across fine tunes. I think we should make it an option that compiler can take but not default.
Do you know the impacted perf? I know on nvidia gpus the impact is minimum

@krishnaraj36
Copy link
Contributor Author

krishnaraj36 commented May 7, 2024

Thanks @krishnaraj36 this is a tradeoff we need to make. Since constant vocab size would mean same lib cannot be shared across fine tunes. I think we should make it an option that compiler can take but not default. Do you know the impacted perf? I know on nvidia gpus the impact is minimum

There is 15-20% impacting for few set of LLM models like Gemma-2b, Mistral-7b etc

@tqchen
Copy link
Contributor

tqchen commented May 7, 2024

Get it, i assume it is on adreno? In this case I think it would be great if we can add a flag to gen_config command,

--static-vocab-size, which can be turned on optionally, and write "static_vocab_size" as an flag into mlc-chat-config.json

That then will impact the compiled binary. The default case can still use dynamic vocab-size

@krishnaraj36
Copy link
Contributor Author

krishnaraj36 commented May 8, 2024

Thanks @tqchen for review!

We have enhance the opencl gemv schedules to resolve this issue with very minor perf compromise.
(apache/tvm#16973).

Closing this PR.

Thanks

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.

None yet

2 participants