Skip to content

Conversation

@Lollipop
Copy link

@Lollipop Lollipop commented Jan 26, 2026

Summary

Add complete MiniCPM-V-4 vision-language model support for EAGLE3 speculative decoding training, including:

  • MiniCPMVLOnlineEagle3Model: New model class for MiniCPM-V target model integration with EAGLE3 training
  • VLM Template Architecture: ms-swift style VLM data preprocessing with VLMTemplate base class and model-specific implementations (MiniCPMVTemplate, QwenVLTemplate)
  • LongRoPE Support: Add LlamaLongRopeRotaryEmbedding for long-context positional embeddings in draft model
  • Multi-node Training: Add distributed training script for multi-node setups

Changes

New Files

  • specforge/data/vlm_template/ - VLM template module
  • specforge/data/dataset.py - VLMDataset class
  • configs/minicpm-v4-eagle3.json - MiniCPM-V-4 config
  • examples/run_minicpm_v4_eagle3_online.sh - Single-node training
  • examples/run_minicpm_v4_eagle3_multinode.sh - Multi-node training
  • scripts/convert_sft_data.py - Data conversion utility

Modified Files

  • specforge/core/eagle3.py - Add MiniCPMVLOnlineEagle3Model
  • specforge/data/preprocessing.py - Add VLM dataset building functions
  • specforge/modeling/draft/llama3_eagle.py - Add LongRoPE embedding
  • scripts/train_eagle3.py - Integrate VLM template support

Add complete MiniCPM-V-4 vision-language model support for EAGLE3 speculative decoding training.

## New Features

- Add MiniCPMVLOnlineEagle3Model class for MiniCPM-V target model integration
- Add VLM Template architecture (ms-swift style) for VLM data preprocessing
  - VLMTemplate base class with encode() and collate() methods
  - MiniCPMVTemplate for MiniCPM-V-4 specific processing
  - QwenVLTemplate for Qwen2.5-VL models
- Add LongRoPE positional embedding support in draft model
- Add multi-node training script for distributed training

## Changes

- Refactor VLM support: move VLM-specific logic to dedicated model classes
- Add new data processing functions: build_vlm_dataset_with_template(), generate_vocab_mapping_for_vlm()
- Add minicpm-v chat template
- Add configs and example scripts for MiniCPM-V-4 training

## Files Added

- specforge/data/vlm_template/ (new module)
- specforge/data/dataset.py (VLMDataset)
- configs/minicpm-v4-eagle3.json
- examples/run_minicpm_v4_eagle3_*.sh
- scripts/convert_sft_data.py
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Lollipop, 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 robust support for the MiniCPM-V-4 vision-language model into the EAGLE3 speculative decoding training system. It achieves this by implementing a new, modular VLM template architecture for data preprocessing, integrating LongRoPE for improved long-context handling in draft models, and providing dedicated training scripts for both single and multi-node environments. The changes streamline the integration of diverse VLM models and enhance the training capabilities of the framework.

Highlights

  • MiniCPM-V-4 VLM Support: Introduced comprehensive support for the MiniCPM-V-4 vision-language model (VLM) within the EAGLE3 training framework, including a dedicated model class (MiniCPMVLOnlineEagle3Model) and configuration.
  • VLM Template Architecture: Implemented a new VLM data preprocessing architecture, inspired by ms-swift, featuring a VLMTemplate base class and model-specific implementations (e.g., MiniCPMVTemplate, QwenVLTemplate). This refactors VLM data handling for better modularity and efficiency.
  • LongRoPE Positional Embeddings: Added LlamaLongRopeRotaryEmbedding to support LongRoPE scaling for long-context positional embeddings in Llama-based draft models, enhancing the model's ability to handle longer sequences.
  • Multi-node Training Scripts: Provided new distributed training scripts (run_minicpm_v4_eagle3_multinode.sh) to facilitate multi-node setups for MiniCPM-V-4 EAGLE3 training.
  • Refactored Data Preprocessing: Significantly refactored the data preprocessing pipeline in scripts/train_eagle3.py and specforge/data/preprocessing.py to cleanly separate VLM and LLM data handling, utilizing the new VLM template architecture and optimizing vocab mapping generation for VLMs.

🧠 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 comprehensive support for MiniCPM-V-4 VLM training within the EAGLE3 framework. The changes are well-structured, incorporating a new VLM Template architecture for flexible data preprocessing, specific model integration for MiniCPM-V-4, and LongRoPE support for enhanced context handling. The addition of dedicated training scripts and a data conversion utility streamlines the workflow. Robustness improvements, such as lazy processor loading and handling of empty batches, are also commendable. Overall, this is a significant and well-executed feature addition.

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.

1 participant