8000 Clarify differences between examples/rl/grpo GSM8K recipes and scripts/grpo_demo_llama3_qwen2.py · Issue #939 · google/tunix · GitHub
[go: up one dir, main page]

Skip to content

Clarify differences between examples/rl/grpo GSM8K recipes and scripts/grpo_demo_llama3_qwen2.py #939

Open

Description

@zyh1999

Hi, thanks for open-sourcing Tunix!

I’m a bit confused about the two GRPO entry points that seem to cover similar use cases:

Shell scripts under examples/rl/grpo/gsm8k (e.g. run_llama3.2_1b.sh, run_gemma3_1b.sh), which call python -m tunix.cli.grpo_main ... with a base_config.yaml, dataset_name="gsm8k", reward_functions="['tunix/cli/reward_fn/gsm8k.py']", and various overrides for steps, LR, checkpointing, etc.

The Python demo scripts/grpo_demo_llama3_qwen2.py, which sets up GRPO for Llama 3 / Qwen 2 with its own argument parser (e.g. --model-version) .

So what is the main difference? When should I choose this one instead of the other?

Activity

  1. added
    type:support
    on Dec 30, 2025
  2. SarveshMahalingam commented on Dec 31, 2025

    @SarveshMahalingam
    Contributor

    The shell scripts are designed for launching GRPO training jobs using the tunix.cli.grpo_main entry point. They are made to be highly configurable, using the base_config.yaml and providing numerous command-line overrides for specific parameters. These scripts are used to set up the entire training environment, including model paths, tokenizer settings, dataset name, batch sizes,optimizer configurations, and GRPO specific hyperparameters.

    The Python demo scripts serve as more self-contained, illustrative examples. While they also set up GRPO, they offer a more simplified or specialized interface, abstracting away some of the detailed configuration found in the shell scripts.

    Choose shell scripts (python -m tunix.cli.grpo_main) when you:

    • Need full, fine-grained control over GRPO training (models, optimizers, logging, checkpoints, distributed/mesh configs).
    • Are running real training jobs on clusters (e.g., TPUs) that require robust, scalable configuration.
    • Are modifying examples or porting new models into the Tunix GRPO framework.
    • Are doing production-like runs where precise hyperparameter tuning and resource management matter.

    Choose the Python demo scripts ('scripts/grpo_demo_llama3_qwen2.py'):

    • When you want a quicker, possibly more user-friendly way to get started with GRPO for a specific model without diving deep into all the configuration details.
    • For demonstrating the core GRPO workflow or for quick tests and development.
    • If the demo script specifically targets a use case or model combination (e.g., Llama 3 and Qwen 2) that aligns with your immediate needs and offers a simplified setup for that purpose.
    • If you prefer to define and launch your experiments entirely within a Python environment, potentially allowing for more programmatic control over the setup in a script rather than relying heavily on command-line overrides.

    Hope this helps

  3. zyh1999 commented on Dec 31, 2025

    @zyh1999
    Author

    Thanks for your answer! Is the Python demo version currently the only one that supports sglang rollout?

  4. shreya-mishra325 commented on Oct 24, 2026

    @shreya-mishra325

    Hi! I would like to work on a small documentation improvement addressing this confusion.

    am planning to add a concise comparison of the GRPO CLI-based recipes and the Python demo scripts, including their intended use cases, configuration differences, and supported rollout options based on the current implementation.

    I shall keep the change documentation-only and focused on helping new contributors choose the appropriate entry point.

    Would this be a useful addition to the existing documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:support

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0