Skip to content

[1/n] DP Enhancement: Multiple minor refactor for eagle#8276

Closed
ch-wan wants to merge 3 commits intogh/ch-wam/1/basefrom
gh/ch-wam/1/head
Closed

[1/n] DP Enhancement: Multiple minor refactor for eagle#8276
ch-wan wants to merge 3 commits intogh/ch-wam/1/basefrom
gh/ch-wam/1/head

Conversation

@ch-wan
Copy link
Collaborator

@ch-wan ch-wan commented Jul 23, 2025

[ghstack-poisoned]
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @ch-wan, 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 primarily focuses on refactoring and minor improvements within the 'eagle' speculative decoding component. The changes aim to enhance the robustness of batch processing, particularly for idle or empty input scenarios, by standardizing data structure initialization and refining control flow. Additionally, a small performance optimization was introduced by skipping a check in the speculative generation pipeline.

Highlights

  • Refactoring EagleDraftInput: Standardized the initialization of EagleDraftInput objects, particularly for verified_id (now an empty tensor instead of None) and its construction in the verify method. This improves consistency and robustness for empty/idle batch scenarios.
  • Improved Idle Batch Handling: Enhanced logic in both eagle_utils.py and eagle_worker.py to gracefully handle IDLE forward modes and empty verified_id tensors, preventing unnecessary computations and ensuring correct state transitions.
  • Performance Optimization: A conditional check (check_forward_draft_extend_after_decode) was removed in eagle_worker.py to streamline the speculative generation process, with a note indicating it was skipped for performance.
  • Data Structure Enhancement: Added seq_lens_for_draft_extend and req_pool_indices_for_draft_extend fields to EagleDraftInput to support draft extension operations.
  • Type Hint Clarity: Updated the type hint for logits_output in the verify method to LogitsProcessorOutput for better code readability and maintainability.
Using Gemini Code Assist

The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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 or fill out our survey to provide feedback.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 introduces several minor refactorings and improvements for the Eagle speculative decoding feature. The changes primarily focus on improving code clarity, robustness, and type correctness. Key changes include initializing verified_id to an empty tensor to prevent NoneType errors, refactoring EagleDraftInput creation to use constructors, and updating type hints for better readability.

One area of concern is a performance optimization in eagle_worker.py where a check involving a distributed all_reduce is commented out. While this may improve performance, the accompanying comment suggests it's a temporary solution, which could pose a maintenance risk. I've recommended clarifying this part of the code. Overall, the changes are positive and enhance the quality of the codebase.

@ch-wan ch-wan changed the title Refactor: multiple minor changes for eagle [1/n] DP Enhancement: Multiple minor refactor for eagle Jul 23, 2025
@ch-wan ch-wan mentioned this pull request Jul 23, 2025
6 tasks
ch-wan added 2 commits July 23, 2025 10:23
[ghstack-poisoned]
[ghstack-poisoned]
@ch-wan ch-wan closed this Jul 25, 2025
@ch-wan ch-wan deleted the gh/ch-wam/1/head branch July 25, 2025 04:50
@ch-wan ch-wan restored the gh/ch-wam/1/head branch July 25, 2025 05:11
@ch-wan ch-wan deleted the gh/ch-wam/1/head branch July 25, 2025 05:11
@ch-wan ch-wan restored the gh/ch-wam/1/head branch July 25, 2025 05:22
@ch-wan ch-wan deleted the gh/ch-wam/1/head branch July 25, 2025 05:26
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.

3 participants