Skip to content

Conversation

@abheesht17
Copy link
Collaborator

@abheesht17 abheesht17 commented Aug 18, 2025

TODOs:

  • Need to make it work for multi-host: Multi-host training does not work for distributed embeddings #143.
  • Currently uses dummy data, need to shift it to using the actual dataset. Already added code for loading actual data, but the path we are reading already has "batched" data. Can go ahead with this, or can load "unbatched" data and batch that up.
  • Eval dataset
  • Check if random seed is being correctly passed. We need to make sure that the initialiser returns different values for different layers (since we are passing SeedGenerator, I think we are good, but good to verify manually).
  • Instead of separate files for configs, maybe have separate functions for configs.
  • Is this a worry?
 08:44:12.046114: W jax_tpu_embedding/sparsecore/lib/core/input_preprocessing_util.cc:251] No Coo Buffer Size provided for table cat_14_table_cat_15_table_cat_23_table_cat_24_table_cat_25_table_cat_33_table_cat_34_table_cat_35_table_cat_36_table, the default value (6144) may be too large and can cause OOM. Utilize the stats returned from the sparse dense matmul preprocessing API.
  • Set up metric logging and checkpointing.

@abheesht17 abheesht17 requested a review from hertschuh August 18, 2025 08:48
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 @abheesht17, 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 introduces the DLRM-DCNv2 model as an MLPerf example, designed for efficient training on TPUs. It provides the model architecture, configuration files for dataset, model, and training hyperparameters, a dummy data loader, and a comprehensive shell script to set up the TPU environment and execute the training process. The current implementation uses dummy data and has known areas for future improvement, such as multi-host support and actual dataset integration.

Highlights

  • New Model Implementation: Adds the DLRM-DCNv2 model, a deep learning architecture combining deep neural networks with a cross-network for learning explicit feature interactions, commonly used in recommendation systems.
  • TPU Integration: Leverages Keras's distributed training capabilities with JAX backend and keras_rs.layers.DistributedEmbedding for efficient large-scale embedding table handling on TPUs, including SparseCore.
  • Modular Configuration: Introduces a structured configuration system using keras.utils.Config for defining dataset features, model parameters (embedding dimensions, MLP layers, DCN layers), and training hyperparameters.
  • Automated Setup Script: Provides a run.sh script to automate the entire setup process on Google Cloud TPU VMs, from VM creation and environment setup to dependency installation and model execution.
  • Dummy Data Support: Includes a dataloader.py to generate dummy data, enabling initial testing and development of the DLRM-DCNv2 model before integration with real datasets.
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. 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 a DLRM-DCNv2 model implementation for MLPerf benchmarks, including configurations, a dummy dataloader, the model definition, and a run script. The overall structure is good, but there are several critical and high-severity issues that need to be addressed. Specifically, there are bugs related to weight initialization due to seed reuse in loops, which will lead to layers having identical weights. There's also a potential runtime error in the model's forward pass due to improper handling of an empty list during tensor concatenation. Additionally, the main training script has a hardcoded number of epochs, ignoring the value from the configuration. I've also included some medium-severity suggestions to improve code maintainability and script robustness. Please review the detailed comments.

Copy link
Collaborator

@hertschuh hertschuh left a comment

Choose a reason for hiding this comment

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

Some comments about the bash script

@abheesht17
Copy link
Collaborator Author

Status: Moved to multi-threaded dataloader because TPU was idle for long times between train steps because of embedding layer preprocessing which is outside of tf.data.

However, it doesn't immediately solve the issue, because host-to-device transfer is stalling it. Merging this for now, will open another PR on top of this.

@abheesht17 abheesht17 merged commit 8b555bf into keras-team:main Dec 17, 2025
7 checks passed
@abheesht17 abheesht17 deleted the ml-perf branch December 17, 2025 19: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.

2 participants