Skip to content

Enhance tests in deterministic kernels#12070

Merged
fzyzcjy merged 3 commits intosgl-project:mainfrom
fzyzcjy:feat/test_det
Oct 25, 2025
Merged

Enhance tests in deterministic kernels#12070
fzyzcjy merged 3 commits intosgl-project:mainfrom
fzyzcjy:feat/test_det

Conversation

@fzyzcjy
Copy link
Collaborator

@fzyzcjy fzyzcjy commented Oct 24, 2025

Motivation

Modifications

Accuracy Tests

Benchmarking and Profiling

Checklist

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @fzyzcjy, 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 significantly enhances the testing suite for deterministic kernels by introducing a new test mode, 'p_vs_d'. This mode rigorously compares the outputs of a single prompt generation against a token-by-token decoding process, ensuring that the kernel produces identical results under different execution paths. The changes also include improvements to the send_single utility function and new data structures for detailed comparison of token IDs and log probabilities, thereby strengthening the overall determinism validation.

Highlights

  • New Test Mode: p_vs_d: Introduced a new test mode named 'p_vs_d' to specifically verify the deterministic behavior of the kernel by comparing full prompt generation against token-by-token decoding.
  • Enhanced send_single Function: The send_single utility function has been extended to accept extra_params for more flexible API calls and a pick_first_result flag to control the handling of list responses, making it more versatile for testing scenarios.
  • Robust Token and Logprob Comparison: Added a new TokenIdsAndLogprobs dataclass and associated helper functions (_extract_ids_and_logprobs) to facilitate detailed and structured comparison of token IDs and their corresponding log probabilities, including verbose output for mismatches.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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. 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

  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 enhances the deterministic kernel tests by adding a new test mode, p_vs_d. This mode compares the log probabilities from a generation request with those from a prefill-only request using the same full token sequence, which is an excellent way to ensure consistency. The changes are well-structured, introducing new helper functions and a dataclass to support the new test logic, and making existing helpers more flexible. I've identified a potential TypeError in the log probability comparison logic that could cause the test to crash and have provided a fix.

@fzyzcjy
Copy link
Collaborator Author

fzyzcjy commented Oct 25, 2025

ci passed
image

@fzyzcjy fzyzcjy merged commit d7056c5 into sgl-project:main Oct 25, 2025
60 of 68 checks passed
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.

2 participants

Comments