Skip to content

Conversation

@mayank31398
Copy link
Collaborator

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @mayank31398, 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 extends the lm_engine framework by integrating a new GatedDeltaNet component, enhancing the variety of available sequence mixer architectures. This involves defining its specific configuration, seamlessly incorporating it into the model's build and forward pass mechanisms, and laying the groundwork for future performance analysis. Additionally, it introduces optimized Triton kernels for Flash Attention v2, which may serve as a foundational element for the new component or other performance-critical operations.

Highlights

  • GatedDeltaNet Configuration: Introduced a new configuration class, _GatedDeltaNetArgs, defining parameters for the GatedDeltaNet, and integrated it into the model's configuration system.
  • Model Architecture Integration: The GatedDeltaNet block is now recognized and can be instantiated within the model's sequence mixer layers, allowing for its dynamic use based on model configuration.
  • Forward Pass Support: Added logic to the model's forward pass to correctly handle and execute the GatedDeltaNet when it is selected as the sequence mixer type.
  • FLOPs Estimation Placeholder: Included a placeholder for calculating the Floating Point Operations (FLOPs) for the GatedDeltaNet within the training utilities, though the detailed calculation is currently commented out.
  • Triton Flash Attention Kernels: Two new files, triton_attn.py and triton_attn_old.py, have been added, providing Triton-based implementations of the Flash Attention v2 algorithm.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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 introduces support for the GatedDeltaNet sequence mixer. The changes span model configuration, layer implementation, and factory functions.

My review has identified a few issues:

  • A critical bug in the gated_deltanet forward pass within lm_engine/hf_models/mixins/dense/layer.py where generation caching is hard-coded to be disabled and the returned cache state is ignored. This will break autoregressive generation.
  • The TFLOPs calculation for gated_deltanet in lm_engine/train_utils.py is incomplete and currently returns zero, which will lead to incorrect performance metrics.
  • The PR adds two large, complex, and very similar Triton kernel files (triton_attn.py and triton_attn_old.py) whose purpose is unclear and which seem unrelated to GatedDeltaNet. They should be removed or their inclusion justified.
  • The configuration for _GatedDeltaNetArgs could be made more robust by providing a default for num_v_heads.

Overall, the core wiring for GatedDeltaNet seems to be in place, but the critical issue with generation caching must be addressed. The other points are also important for correctness and maintainability.

mayank31398 and others added 23 commits December 31, 2025 00:34
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
@mayank31398 mayank31398 marked this pull request as ready for review January 8, 2026 03:47
Signed-off-by: Mayank Mishra <[email protected]>
Signed-off-by: Mayank Mishra <[email protected]>
@mayank31398 mayank31398 merged commit 26decd5 into main Jan 8, 2026
2 checks passed
@mayank31398 mayank31398 deleted the gdn branch January 8, 2026 23:51
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