-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Logging cache_hit_rate only for prefill and speculative_decoding metrics only for decode
#12460
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
base: main
Are you sure you want to change the base?
Conversation
…ics only for decode Signed-off-by: Mohd Muzzammil <[email protected]>
Summary of ChangesHello @MMuzzammil1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the system's metric collection by introducing conditional logging for certain performance indicators. The change ensures that metrics like Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly separates the logging of cache_hit_rate for prefill steps and speculative decoding metrics for decode steps. The changes are logical and well-implemented by introducing an is_decode_stats flag. I've added one suggestion to improve code clarity by using an if/else block for the mutually exclusive conditions, which makes the code more readable and maintainable.
| if not is_decode_stats: | ||
| self._log_gauge(self.cache_hit_rate, stats.cache_hit_rate) | ||
|
|
||
| # Speculative decoding | ||
| self._log_gauge(self.spec_accept_length, stats.spec_accept_length) | ||
| self._log_gauge(self.spec_accept_rate, stats.spec_accept_rate) | ||
| if is_decode_stats: | ||
| self._log_gauge(self.spec_accept_length, stats.spec_accept_length) | ||
| self._log_gauge(self.spec_accept_rate, stats.spec_accept_rate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since logging cache_hit_rate and speculative decoding metrics are mutually exclusive based on is_decode_stats, you can use a single if/else block. This improves readability and makes the mutually exclusive nature of these logic blocks more explicit.
| if not is_decode_stats: | |
| self._log_gauge(self.cache_hit_rate, stats.cache_hit_rate) | |
| # Speculative decoding | |
| self._log_gauge(self.spec_accept_length, stats.spec_accept_length) | |
| self._log_gauge(self.spec_accept_rate, stats.spec_accept_rate) | |
| if is_decode_stats: | |
| self._log_gauge(self.spec_accept_length, stats.spec_accept_length) | |
| self._log_gauge(self.spec_accept_rate, stats.spec_accept_rate) | |
| if not is_decode_stats: | |
| self._log_gauge(self.cache_hit_rate, stats.cache_hit_rate) | |
| else: | |
| # Speculative decoding | |
| self._log_gauge(self.spec_accept_length, stats.spec_accept_length) | |
| self._log_gauge(self.spec_accept_rate, stats.spec_accept_rate) | |
Described as above in the title. Closes #12459.
Checklist