### Complete checkpoint and resume configuration example Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Advanced Features/checkpoint_and_resume.md Complete configuration example showing checkpoint saving and resuming setup, including checkpoint_config, resume_from_checkpoint, and training control parameters. ```yaml exp_name: "qwen2.5-7B-rlvr-config" seed: 42 logging_dir: ./output/logs output_dir: ./output # Checkpoint configuration checkpoint_config: type: file_system output_dir: /data/cpfs_0/rl_examples/models/${exp_name} # Resume training configuration resume_from_checkpoint: false # Set to checkpoint path to resume training # Training control parameters max_steps: 500 save_steps: 100 # Save checkpoint every 100 steps logging_steps: 1 eval_steps: 10 # Other training configurations... ``` -------------------------------- ### Install dependencies Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Pipeline/agentic_pipeline_start.md Install required Python packages from requirements.txt. Recommended to start from the image launch for proper environment setup. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install Ray for distributed execution Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Pipeline/agent_pipeline_start.md Install Ray, which is recommended for distributed execution. The project may contain example scripts for starting a Ray cluster, such as examples/scripts/start_ray_cluster.sh. ```bash pip install ray ``` -------------------------------- ### Start Ascend NPU container with docker run Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Hardware Support/ascend_npu_rlvr.md Start the Ascend NPU container with all required devices, driver mounts, and data/model volume mounts. Adjust /path/to/models and /path/to/data to your setup. ```bash docker run -dit \ --name roll_npu \ --ulimit nofile=65536:65536 \ --device /dev/davinci0 \ --device /dev/davinci1 \ --device /dev/davinci2 \ --device /dev/davinci3 \ --device /dev/davinci4 \ --device /dev/davinci5 \ --device /dev/davinci6 \ --device /dev/davinci7 \ --device /dev/davinci_manager \ --device /dev/devmm_svm \ --device /dev/hisi_hdc \ -v /usr/local/Ascend/driver:/usr/local/Ascend/driver \ -v /usr/local/Ascend/add-ons:/usr/local/Ascend/add-ons \ -v /usr/local/dcmi:/usr/local/dcmi \ -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \ -v /etc/ascend_install.info:/etc/ascend_install.info \ -v /path/to/models:/data/models \ -v /path/to/data:/data \ --ipc=host \ --net=host \ roll:v0.3-cann9.1.0-torch_npu2.10.0.post4-a3-ubuntu22.04-py3.12 \ /bin/bash ``` -------------------------------- ### Install ROCK SDK Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/Getting Started/Quick Start/rock_agent_native.md Installs the ROCK SDK from the Aliyun mirror. ```bash pip install rl-rock -i https://mirrors.aliyun.com/pypi/simple/ ``` -------------------------------- ### Launch Ascend RLVR training with start_rlvr_pipeline.py Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Hardware Support/ascend_npu_rlvr.md Launch the Ascend RLVR training pipeline on a single node. Requires the ROLL workspace and PYTHONPATH setup. Use --config_path and --config_name to point to the checked-in example configuration. ```bash cd /workspace/ROLL export PYTHONPATH="/workspace/ROLL:$PYTHONPATH" python examples/start_rlvr_pipeline.py \ --config_path ascend_examples \ --config_name qwen3_30b_rlvr_fsdp2 ``` -------------------------------- ### Kimi15 Configuration Example Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Configuration/offpolicy_setting.md A minimal configuration example for Kimi15, setting the variant and the regularization parameter. ```yaml pg_variant: kimi15 kimi15_tau: 0.1 ``` -------------------------------- ### Training trajectory example with search tool Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Agentic/Tool_Use.md Example training trajectory for the QA + SearchTool setup. Shows the prompt instructing the model to use and tags, and the assistant response issuing a search query and receiving tool results. ```json { "prompt": "<|im_start|>system\nYou're a helpful assistant.\n<|im_start|>user\nFor any question, always reason through your thought process using:\n thinking your reasoning here response\nThen, provide your final answer using:\n your answer here \n\nQuestion: Which type of dog is the national dog breed of Israel: Canaan Dog or Dutch Shepherds?\n\nYou have access to a search engine to help answer questions.\n\nAdditional instructions:\n- If your initial reasoning in thinking shows you lack some knowledge, explain what you need to find next inside a new thinking block.\n- Then issue a search query using:\n your query here \n- The search engine will provide results inside:\n ... \n- You may repeat the thinking and steps as many times as needed.\n- When you are ready, give your final answer in:\n your answer here \n<|im_start|>assistant\n", "response": "I will search for the national dog breed of Israel.\nnational dog breed of Israel\n\n<|im_start|>user\n\n\n\nDoc 1(Title: \"Canaan Dog\") Canaan Dog The Canaan Dog is a breed of pariah dog, which has been in existence in the Middle East for thousands of years. There are 2,000 to 3,000 Canaan dogs across the world, mostly in Europe and North America. The Canaan dog is believed to have been a primitive feral in ancient Canaan. Excavations in Ashkelon unearthed the largest known dog cemetery in the ancient world containing 700 dog skeletons, all of which were anatomically similar to the Canaan dog of modern times. Archaeologists hypothesize that the dogs were revered as sacred animals. According to tradition, the Canaan dog\nDoc 2(Title: \"Canaan Dog\") dissecans (OCD). The Canaan dog was first recognized by the Israel Kennel Club in 1953 and by the FCI (Federation Cynologique Internationale) in 1966. The first accepted standard was written by Dr. Menzel. In 1986, the first Canaan dogs were brought to Finland from Sha'ar Hagai Kennel, in Israel. The Canaan Dog is today recognized by all the world's kennel clubs and is being bred in many countries. There are breed clubs in the U.S., Canada, the U.K., Finland, Germany, Israel and France. The first Canaan dog came to Canada May 16, 1970. The dogs came from a kennel in\nDoc 3(Title: \"Canaan Dog\") the loss of the natural habitat of the Canaan. Even the majority of Bedouin dogs today, other than those of tribes still living a traditional and isolated life style, are mixed with other breeds. Myrna Shiboleth visits the Negev regularly, looking for good specimens living by the Bedouin camps, that she can breed with her dogs and use to strengthen the gene pool. The Canaan dog is a typical primitive dog in appearance. It is a medium-sized square built dog, with a wedge-shaped head, erect and low set ears with a broad base and rounded tips. Its outer coat is\n with the logging directory specified in the YAML configuration. ```bash tensorboard --logdir ``` -------------------------------- ### Complete FP8 Quantization Configuration Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Configuration/fp8_rollout.md Complete configuration example enabling FP8 quantization for both actor_infer and llm_judge. Includes per block quantization for actor_infer and the full llm_judge setup. ```yaml # Configuration example: FP8 quantization for actor_infer and llm_judge actor_infer: strategy_args: strategy_name: vllm strategy_config: quantization: fp8 hf_overrides: quantization_config: activation_scheme: dynamic fmt: e4m3 quant_method: fp8 weight_block_size: [128, 128] llm_judge: worker_cls: roll.pipeline.rlvr.rewards.llm_judge_reward_worker.LLMJudgeRewardWorker judge_prompt: Qwen2.5-7B-Instruct-RLVR-prompt judge_model_type: inference tag_included: [RLVR] strategy_args: strategy_name: vllm strategy_config: gpu_memory_utilization: 0.8 quantization: fp8 max_model_len: 8000 load_format: auto ``` -------------------------------- ### Install MCoreAdapter via pip Source: https://github.com/alibaba/roll/blob/main/mcore_adapter/README.md Install MCoreAdapter directly from the Roll GitHub repository using pip. This command installs the package from the mcore_adapter subdirectory. ```bash pip install "git+https://github.com/alibaba/roll.git#subdirectory=mcore_adapter" ``` -------------------------------- ### Install vllm and vllm-ascend from wheels Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Hardware Support/ascend_usage.md Installs vllm and vllm-ascend from pre-built wheels. vllm-ascend is installed from the Huawei mirror. ```bash # Install vllm-project/vllm. The newest supported version is v0.23.0. pip install vllm==0.23.0 # Install vllm-project/vllm-ascend from pypi. pip install \ --extra-index-url https://mirrors.huaweicloud.com/ascend/repos/pypi \ vllm-ascend==0.23.0rc1 ``` -------------------------------- ### Setup Local Debugging Environment Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/Getting Started/Debugging Guide/debug_guide.md Create and activate a Python environment for local debugging. ```bash conda create -n python310_torch280_em python=3.10 conda activate python310_torch280_em ``` -------------------------------- ### Start agentic pipeline Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Pipeline/agentic_pipeline_start.md Launch the agentic pipeline using the start_agentic_pipeline.py script with the configuration directory and name for the Frozen Lake validation example. ```bash python examples/start_agentic_pipeline.py \ --config_path examples/qwen2.5-0.5B-agentic \ --config_name agent_val_frozen_lake ``` -------------------------------- ### Configure Docker Container and Install ROLL Dependencies Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/Getting Started/Quick Start/multi_nodes_quick_start.md Commands to start a Docker container with GPU support, enter it, verify GPUs, clone the ROLL repository, and install dependencies. Uses the torch2.8.0 + vLLM0.11.0 image and the corresponding requirements file. ```shell # 1. Start a Docker container with GPU support, expose container ports, and keep the container running sudo docker run -dit \ --gpus all \ -p 9001:22 \ --ipc=host \ --shm-size=10gb \ roll-registry.cn-hangzhou.cr.aliyuncs.com/roll/pytorch:nvcr-25.06-py3-torch280-vllm0110 \ /bin/bash # 2. Enter the Docker container # You can use the `sudo docker ps` command to find the running container ID or name. sudo docker exec -it /bin/bash # 3. Verify that GPUs are visible nvidia-smi # 4. Clone the project code git clone https://github.com/alibaba/ROLL.git # 5. Install project dependencies (choose the requirements file corresponding to your image) cd ROLL pip install -r requirements_torch280_vllm.txt -i https://mirrors.aliyun.com/pypi/simple/ ``` -------------------------------- ### Dump Mode Configuration Example Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/Development/Developer Guide/rollout_mock_usage.md Example YAML configuration for enabling dump mode, which saves data to the specified dump_dir. ```yaml rollout_mock: enable: true mode: dump dump_dir: ./rollout_dumps/precision_test_v1 ``` -------------------------------- ### Run SFT Pipeline with Python Script Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Pipeline/sft_pipeline_start.md Starts the SFT pipeline using the example script with Hydra configuration. Ensure you are in the ROLL project root directory. The --config_path points to the config directory and --config_name to the config file name (sft_config corresponds to sft_config.yaml). ```bash # Make sure you are in the ROLL project root directory # export PYTHONPATH=$(pwd):$PYTHONPATH python examples/start_sft_pipeline.py \ --config_path examples/qwen2.5-7B-sft_megatron \ --config_name sft_config ``` -------------------------------- ### Example launcher files for dynamic pipeline loading Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/Development/Developer Guide/distributed_application_development.md Example launcher files that dynamically load pipeline_cls and parse YAML with the matching config class. If a launcher hard-codes a config type, a new Pipeline also requires a new or extended launcher; setting pipeline_cls alone does not select a new PipelineConfig. ```text examples/start_agentic_pipeline.py examples/start_onpolicy_distill_pipeline.py ``` -------------------------------- ### Install ROLL in custom environment (CUDA prerequisites and commands) Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/Getting Started/Installation/installation.md Prerequisites for CUDA: CUDA >= 12.4, cuDNN >= 9.1.0, PyTorch >= 2.5.1, SGlang >= 0.4.10.post2, vLLM >= 0.11.0. Then clone the repository, install dependencies, and optionally install in development mode. ```bash # Prerequisites CUDA Version >= 12.4 cuDNN Version >= 9.1.0 PyTorch >= 2.5.1 SGlang >= 0.4.10.post2 vLLM >= 0.11.0 # Clone the repository and install git clone https://github.com/alibaba/ROLL.git cd ROLL pip install -r requirements.txt # Or follow your specific installation steps # For development, consider: pip install -e . ``` -------------------------------- ### Resume from checkpoint-300 Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Advanced Features/checkpoint_and_resume.md Example of resuming training from a specific checkpoint path for the qwen2.5-7B-rlvr-config experiment. ```yaml resume_from_checkpoint: /data/cpfs_0/rl_examples/models/qwen2.5-7B-rlvr-config/checkpoint-300 ``` -------------------------------- ### Configure and Start TensorBoard for RLVR Training Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Hardware Support/ascend_npu_rlvr.md Configure TensorBoard logging in the ROLL config and start the TensorBoard server to monitor training metrics. ```yaml track_with: tensorboard tracker_kwargs: log_dir: ./output/tensorboard/rlvr_npu ``` ```bash tensorboard --logdir ./output/tensorboard/rlvr_npu --port 6006 ``` -------------------------------- ### Start local search engine with start_retrieval_server.sh Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Agentic/Tool_Use.md Starts the local dense retriever search engine. Set SEARCH_URL to the service address (default http://localhost:8000/retrieve) and edit SAVE_PATH_RETRIEVER in start_retrieval_server.sh to point to your downloaded index and corpus directory before running. ```bash # Before running the script, modify the SAVE_PATH_RETRIEVER variable # in start_retrieval_server.sh to your downloaded index and corpus directory path export SEARCH_URL="http://localhost:8000/retrieve" bash examples/qwen3_agentic_gem/start_retrieval_server.sh ``` -------------------------------- ### GSPO Configuration Parameters Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Algorithms/GSPO.md Example YAML configuration for setting up GSPO training, including algorithm-specific settings, PPO-related parameters, and advantage estimation configurations. ```yaml # GSPO related adv_estimator: "grpo" importance_sampling: seq rollout_batch_size: 64 # prompt num_return_sequences_in_group: 8 prompt_length: 2048 response_length: 4096 # ppo related ppo_epochs: 1 use_kl_loss: true kl_loss_coef: 0.001 loss_agg_mode: "seq-mean-token-mean" # advantage whiten_advantages: false advantage_clip: 2.0 dual_clip_loss: true # clip reward_clip: 10 # normalize norm_mean_type: ~ norm_std_type: ~ # reward add_token_level_kl: false ``` -------------------------------- ### Install ROLL from source Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Hardware Support/ascend_usage.md Clones the ROLL repository and installs its common requirements and the package in editable mode. ```bash git clone https://github.com/alibaba/ROLL.git cd ROLL pip install -r requirements_common.txt pip install -e . cd .. ``` -------------------------------- ### Start Ray Head Node Manually (Method B) Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Hardware Support/ascend_npu_examples.md Start the Ray head node manually on the head node for Method B (manual Ray cluster management). ```bash ray start --head --port=6379 --dashboard-port=8265 ``` -------------------------------- ### Install torch and torch_npu for Ascend Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Hardware Support/ascend_usage.md Installs CPU-only torch 2.10.0 and torch_npu 2.10.0.post4. The torch_npu version must match the torch and CANN versions. ```bash # Use CPU-only torch when installing outside the pre-built image pip install \ --index-url https://download.pytorch.org/whl/cpu \ --extra-index-url https://mirrors.huaweicloud.com/repository/pypi/simple \ torch==2.10.0+cpu torchvision==0.25.0 torchaudio==2.10.0 # Install the torch_npu version matching torch/CANN python -m pip install \ --extra-index-url https://mirrors.huaweicloud.com/ascend/repos/pypi \ --no-deps torch-npu==2.10.0.post4 ``` -------------------------------- ### Launch distill pipeline with start_distill_pipeline.py Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Pipeline/distill_pipeline_start.md Launches the distill pipeline using the specified configuration path and name. Ensure the configuration file exists and dependencies are installed. ```bash python examples/start_distill_pipeline.py \ --config_path distill/off_policy/llm \ --config_name distill_megatron ``` -------------------------------- ### Start Docker Containers on All Nodes Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Hardware Support/ascend_npu_examples.md Docker run command to start a container with --net=host and shared storage mount. Must be run on each node. The -v /shared/storage:/data mount is required for model weights, data, and checkpoints, and must be accessible from all nodes at the same path. ```bash docker run -dit \ --name roll_npu_multi \ --ulimit nofile=65536:65536 \ --device /dev/davinci0 \ --device /dev/davinci1 \ --device /dev/davinci2 \ --device /dev/davinci3 \ --device /dev/davinci4 \ --device /dev/davinci5 \ --device /dev/davinci6 \ --device /dev/davinci7 \ --device /dev/davinci_manager \ --device /dev/devmm_svm \ --device /dev/hisi_hdc \ -v /usr/local/Ascend/driver:/usr/local/Ascend/driver \ -v /usr/local/Ascend/add-ons:/usr/local/Ascend/add-ons \ -v /usr/local/dcmi:/usr/local/dcmi \ -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \ -v /etc/ascend_install.info:/etc/ascend_install.info \ -v /shared/storage:/data \ --ipc=host \ --net=host \ roll:v0.3-cann9.1.0-torch_npu2.10.0.post4-a3-ubuntu22.04-py3.12 \ /bin/bash ``` -------------------------------- ### Run Helper Shell Script Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Pipeline/vl_rlvr_pipeline_start.md Runs the helper shell script from the examples directory. This command executes the wrapper script that launches the RLVR VL pipeline. ```bash bash examples/qwen2.5-vl-7B-rlvr/run_rlvr_pipeline.sh ``` -------------------------------- ### Custom environment configuration for SWE-bench Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/Getting Started/Quick Start/rock_agent_native.md Example configuration for the custom environment, specifying the dataset file and test files path. Modify as needed. ```yaml custom_envs: swebench_native_verified: env_config: dataset_name: /ROLL/data/swe_bench_verified_example.jsonl test_files: ["/terminal-bench-datasets/datasets/swebench-verified"] ``` -------------------------------- ### Helper shell script to run distill pipeline Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Pipeline/distill_pipeline_start.md Example shell script that wraps the Python launcher, setting CONFIG_NAME and CONFIG_PATH variables and passing additional parameters. The script is intended to be placed in the examples directory, e.g., `examples/distill/off_policy/llm/run_distill_pipeline.sh`. ```bash #!/bin/bash # Example: examples/distill/off_policy/llm/run_distill_pipeline.sh CONFIG_NAME="distill_megatron" # distill_megatron.yaml CONFIG_PATH="distill/off_policy/llm" # Set environment variables and other configurations python examples/start_distill_pipeline.py \ --config_path $CONFIG_PATH \ --config_name $CONFIG_NAME \ "$@" # Pass any additional parameters ``` -------------------------------- ### FSDP2 Training Configuration (YAML) Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Configuration/fsdp2.md Example FSDP2 training configuration from examples_lixing/qwen3-8B-rlvr_fsdp2/rlvr_config.yaml. Sets strategy_name to fsdp2_train with fsdp_size 16, mix precision enabled, and reshard_after_forward true. ```yaml actor_train: model_args: disable_gradient_checkpointing: false dtype: bf16 model_type: ~ training_args: learning_rate: 1.0e-6 weight_decay: 0 per_device_train_batch_size: 1 gradient_accumulation_steps: 32 warmup_steps: 20 num_train_epochs: 50 strategy_args: strategy_name: fsdp2_train strategy_config: fsdp_size: 16 enable_mix_precision: true reshard_after_forward: true offload_policy: false device_mapping: list(range(0,16)) infer_batch_size: 4 ``` -------------------------------- ### Run helper shell script Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Pipeline/agent_pipeline_start.md Runs the example shell script that wraps the Python launcher for the frozen lake agentic pipeline. ```bash bash examples/qwen2.5-0.5B-agentic_ds/run_agentic_pipeline_frozen_lake.sh ``` -------------------------------- ### Launch RLVR pipeline Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Pipeline/rlvr_pipeline_start.md Launches the RLVR pipeline with the specified configuration path and name. Ensure the configuration file is accessible and dependencies are installed. ```bash python examples/start_rlvr_pipeline.py \ --config_path examples/qwen2.5-7B-rlvr_megatron_hz \ --config_name ppo ``` -------------------------------- ### GEMRunner Configuration Example for Local GEM Environments Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Agentic/agent_runner.md Complete GEMRunner configuration example for local GEM environments like Sokoban and FrozenLake. Uses ProxyEnvManager and GEMRunner, with training and validation environment groups, and custom environment references. Suitable for local GEM environments. ```yaml # Global specification of EnvManager and AgentRunner env_manager_cls: roll.pipeline.agentic.env_manager.proxy_env_manager.ProxyEnvManager agent_runner_cls: roll.pipeline.agentic.agent_runner.gem_runner.GEMRunner # Training parameters rollout_batch_size: 1024 sequence_length: 8192 max_tokens_per_step: 64 adv_estimator: "grpo" # Training environment group configuration train_env_manager: max_env_num_per_worker: 16 num_env_groups: 128 group_size: 8 # Sample 8 trajectories per prompt tags: [SimpleSokoban] num_groups_partition: [128] # Validation environment group configuration (mixed evaluation across multiple environments) val_env_manager: max_env_num_per_worker: 32 num_env_groups: 1024 group_size: 1 tags: [SimpleSokoban, LargerSokoban, SokobanDifferentGridVocab, FrozenLake] num_groups_partition: [256, 256, 256, 256] # Custom environments: each environment inherits global env_manager_cls and agent_runner_cls custom_envs: SimpleSokoban: ${custom_env.SimpleSokoban} # Reference environment definition from traj_envs.yaml LargerSokoban: ${custom_env.LargerSokoban} FrozenLake: ${custom_env.FrozenLake} ``` -------------------------------- ### Pipeline algorithm description example Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/Development/Developer Guide/distributed_application_development.md Illustrates how Pipeline code should describe the algorithm using high-level Worker APIs, such as generate and train_step, rather than backend-specific details. ```python teacher_output = self.teacher.generate(batch) train_metrics = self.student.train_step(teacher_output) ``` -------------------------------- ### Launch Pipeline on Head Node (Method B - Manual Cluster) Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Hardware Support/ascend_npu_examples.md After manually starting the Ray cluster, launch the ROLL pipeline only on the head node. ```bash cd /workspace/ROLL export PYTHONPATH="/workspace/ROLL:$PYTHONPATH" python examples/start_rlvr_pipeline.py \ --config_path \ --config_name rlvr_npu_multinode ``` -------------------------------- ### Run the pipeline on the master node Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/Getting Started/Quick Start/multi_nodes_quick_start.md Executes the multi-node pipeline demo script on the master node. After the Ray cluster starts, log examples are shown in the accompanying image. ```shell bash examples/agentic_demo/run_agentic_pipeline_frozen_lake_multi_nodes_demo.sh ``` -------------------------------- ### Launch SFT pipeline with start_sft_pipeline.py Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Pipeline/sft_pipeline_start.md Launch the SFT pipeline using the specified configuration directory and file name. Ensure the pretrain path is accessible and the data fields match the configured keys. ```bash python examples/start_sft_pipeline.py \ --config_path examples/qwen2.5-7B-sft_megatron \ --config_name sft_config ``` -------------------------------- ### Install gymnasium dependency Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Pipeline/agent_pipeline_start.md Install the gymnasium package, which is required for the frozen lake environment. ```bash pip install gymnasium ``` -------------------------------- ### example_grpo.yaml: GRPO training configuration for Qwen2.5-7B Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Configuration/config_system.md Complete YAML configuration for a GRPO training run using Qwen2.5-7B. It defines experiment metadata, checkpoint and tracker settings, GRPO hyperparameters (rollout_batch_size, adv_estimator, num_return_sequences_in_group), sequence lengths, training parameters (ppo_epochs, use_kl_loss, kl_loss_coef, loss_agg_mode), advantage and reward clipping, model paths, actor_train (Megatron) and actor_infer (vLLM) role configurations, and a math rule reward worker. Note the use of ${exp_name} and ${response_length} variable references and the device_mapping values as Python expressions. ```yaml # Basic configuration exp_name: "qwen2.5-7B-rlvr-config" # Experiment name seed: 42 # Random seed logging_dir: ./output/logs # Log directory output_dir: ./output # Output directory # Checkpoint saving configuration checkpoint_config: type: file_system output_dir: /data/cpfs_0/rl_examples/models/${exp_name} # Tracker configuration track_with: tensorboard # Using tensorboard for tracking tracker_kwargs: log_dir: /data/oss_bucket_0/rl_examples/llm/tensorboard/roll_exp/rlvr # Log directory # GRPO algorithm-related configuration rollout_batch_size: 64 # Rollout batch size adv_estimator: "grpo" # Advantage estimator using GRPO num_return_sequences_in_group: 8 # Number of sequences returned per group # Sequence length configuration prompt_length: 2048 # Prompt length response_length: 4096 # Response length # Training parameters ppo_epochs: 1 # PPO optimization rounds use_kl_loss: true # Use KL divergence loss kl_loss_coef: 0.001 # KL loss coefficient loss_agg_mode: "seq-mean-token-sum" # Loss aggregation mode # Advantage calculation related whiten_advantages: true # Whiten advantage values advantage_clip: 2.0 # Advantage value clipping dual_clip_loss: true # Use dual clipping loss # Reward processing reward_clip: 10 # Reward value clipping # Model configuration pretrain: Qwen/Qwen2.5-7B # Pretrained model path reward_pretrain: Qwen/Qwen2.5-7B # Reward model path # Role configurations actor_train: # Training role model_args: disable_gradient_checkpointing: false # Enable gradient checkpointing dtype: bf16 # Data type training_args: learning_rate: 1.0e-6 # Learning rate per_device_train_batch_size: 1 # Training batch size per device gradient_accumulation_steps: 32 # Gradient accumulation steps strategy_args: strategy_name: megatron_train # Using Megatron training strategy strategy_config: tensor_model_parallel_size: 1 # Tensor parallel size pipeline_model_parallel_size: 1 # Pipeline parallel size device_mapping: list(range(0,16)) # Device mapping actor_infer: # Inference role model_args: disable_gradient_checkpointing: true # Disable gradient checkpointing dtype: bf16 # Data type generating_args: max_new_tokens: ${response_length} # Maximum new tokens temperature: 0.99 # Temperature parameter strategy_args: strategy_name: vllm # Using vLLM inference strategy strategy_config: gpu_memory_utilization: 0.8 # GPU memory utilization device_mapping: list(range(0,12)) # Device mapping # Reward model configuration rewards: math_rule: # Math rule reward worker_cls: roll.pipeline.rlvr.rewards.math_rule_reward_worker.MathRuleRewardWorker # Worker class model_args: model_name_or_path: ${reward_pretrain} # Model path tag_included: [deepmath_103k, aime] # Included tags world_size: 8 # Number of worker nodes ``` -------------------------------- ### Install Debugging Dependencies Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/Getting Started/Debugging Guide/debug_guide.md Install required packages for local debugging from the requirements file. ```bash pip3 install torch torchvision torchaudio py-cpuinfo pip install -r requirements_em_local_debug.txt ``` -------------------------------- ### Install ROLL in custom environment (ROCm prerequisites and commands) Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/Getting Started/Installation/installation.md Prerequisites for AMD/ROCm: ROCm >= 6.3.4, PyTorch >= 2.8.0, vLLM >= 0.11.0. Then clone the repository, install dependencies, and optionally install in development mode. ```bash # Prerequisites ROCm Version >= 6.3.4 PyTorch >= 2.8.0 vLLM >= 0.11.0 # Clone the repository and install git clone https://github.com/alibaba/ROLL.git cd ROLL pip install -r requirements.txt # Or follow your specific installation steps ``` -------------------------------- ### Run RLVR pipeline on Ascend NPU Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Hardware Support/ascend_docker_usage.md Launch an example RLVR pipeline on Ascend NPU using FSDP2 as the training backend. Update model paths and set device_mapping according to the NPU topology before running. ```bash python examples/start_rlvr_pipeline.py \ --config_path examples/ascend_examples \ --config_name qwen3_8b_rlvr_fsdp2 ``` -------------------------------- ### Install Ascend 950 torch/vLLM stack Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Hardware Support/ascend_usage.md Installs the Ascend 950-specific stack: torch 2.10, torch_npu 2.10.0, vLLM v0.20.2, and vLLM-Ascend from the main branch. Set COMPILE_CUSTOM_KERNELS=1 before installing vLLM-Ascend to build its custom kernels. ```bash # Install torch 2.10 pip install torch==2.10.0 torchvision==0.25.0 torchaudio==2.10.0 --index-url https://download.pytorch.org/whl/cpu # Install the torch_npu package matching torch 2.10 and your CANN release pip install torch_npu==2.10.0 # vLLM v0.20.2 git clone -b v0.20.2 --depth 1 https://github.com/vllm-project/vllm.git cd vllm pip install -r requirements/build.txt VLLM_TARGET_DEVICE=empty pip install -v -e . cd .. # vLLM-Ascend main git clone -b main --depth 1 https://github.com/vllm-project/vllm-ascend.git cd vllm-ascend export COMPILE_CUSTOM_KERNELS=1 pip install -v -e . cd .. ``` -------------------------------- ### Sokoban environment configuration for prompt generation Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/Development/Developer Guide/prompt_intro.md Example YAML configuration for the Sokoban environment, defining the instruction, grid vocabulary, and action lookup used to generate the first user prompt. ```yaml env_instruction: "You are solving the Sokoban puzzle. You are the player and you need to push all boxes to targets. When you are right next to a box, you can push it by moving in the same direction. You cannot push a box through a wall, and you cannot pull a box. The answer must be one of action in a turn, format is Right" grid_vocab: "#": "wall" "_": "empty" "O": "target" "√": "box on target" "X": "box" "P": "player" "S": "player on target" action_lookup: 1: "Up" 2: "Down" 3: "Left" 4: "Right" ``` -------------------------------- ### Complete NPU Configuration for Qwen3-30B-A3B RLVR Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Hardware Support/ascend_npu_rlvr.md Complete NPU-adapted RLVR configuration for Qwen3-30B-A3B, adapted from examples/ascend_examples/qwen3_30b_rlvr_fsdp2.yaml. Key NPU-specific settings include HCCL_NPU_SOCKET_PORT_RANGE=auto, VLLM_ASCEND_ENABLE_NZ=0, FSDP2 training/inference strategies (not megatron), vLLM-Ascend inference, CPU offloading, TiledMLP, and MoE wrap policy. Training, inference, and reference all share NPUs 0-15. ```yaml hydra: run: dir: . output_subdir: null exp_name: "qwen3-30BA3B-rlvr-npu" seed: 42 logging_dir: ./output/logs output_dir: ./output system_envs: USE_MODELSCOPE: '1' HCCL_NPU_SOCKET_PORT_RANGE: auto # NPU: allow same-device multi-process HCCL port allocation VLLM_ASCEND_ENABLE_NZ: '0' # NPU: disable FRACTAL_NZ for RL weight reload flows checkpoint_config: type: file_system output_dir: ./output/models/${exp_name} track_with: tensorboard tracker_kwargs: log_dir: ./output/tensorboard/rlvr_npu rpc_timeout: 72000 num_gpus_per_node: 16 max_steps: 500 save_steps: 100 logging_steps: 1 eval_steps: 10 resume_from_checkpoint: false rollout_batch_size: 32 prompt_length: 2048 response_length: 4096 num_return_sequences_in_group: 8 ppo_epochs: 1 adv_estimator: "reinforce" value_clip: 0.5 reward_clip: 10 advantage_clip: 2.0 dual_clip_loss: true norm_mean_type: ~ norm_std_type: ~ max_len_mask: true difficulty_mask: true difficulty_low_threshold: 0.1 difficulty_high_threshold: 0.95 error_max_len_clip: false difficulty_loss_weight: false length_loss_weight: false add_token_level_kl: false whiten_advantages: true pretrain: Qwen/Qwen3-30B-A3B reward_pretrain: Qwen/Qwen3-30B-A3B actor_train: model_args: disable_gradient_checkpointing: false dtype: bf16 model_type: ~ training_args: learning_rate: 1.0e-6 weight_decay: 0 per_device_train_batch_size: 2 gradient_accumulation_steps: 8 warmup_steps: 20 num_train_epochs: 50 data_args: template: qwen2_5 file_name: - data/math_deepmath_deal.jsonl domain_interleave_probs: math_rule: 1 dataset_dir: data messages: messages interleave_probs: "1.0" preprocessing_num_workers: 16 strategy_args: strategy_name: fsdp2_train # NPU: Must use FSDP2, NOT megatron_train strategy_config: fsdp_size: 16 # NPU: FSDP2 sharding size param_dtype: bf16 reduce_dtype: bf16 offload_policy: true # NPU: Enable CPU offloading for large models apply_expert_patch: true # NPU: Required for MoE models apply_tiled_mlp: true # NPU: TiledMLP to reduce memory tiled_num_shards: 8 reshard_after_forward: true wrap_policy: # NPU: MoE-specific wrap policy wrap_embeddings: true wrap_lm_output: true moe_experts: - Qwen3MoeMLP transformer_layer_cls_to_wrap: - Qwen3MoeAttention - Qwen3MoeSparseMoeBlock use_remove_padding: true device_mapping: list(range(0,16)) # NPU: Training on NPUs 0-15 infer_batch_size: 2 actor_infer: model_args: disable_gradient_checkpointing: true dtype: bf16 generating_args: max_new_tokens: ${response_length} top_p: 0.99 top_k: 100 num_beams: 1 temperature: 0.99 num_return_sequences: ${num_return_sequences_in_group} data_args: template: qwen2_5 strategy_args: strategy_name: vllm # NPU: vLLM-Ascend for inference strategy_config: gpu_memory_utilization: 0.8 block_size: 16 max_model_len: 6144 tensor_parallel_size: 2 enforce_eager: true load_format: dummy device_mapping: list(range(0,16)) # NPU: Inference shares NPUs with training infer_batch_size: 1 reference: model_args: disable_gradient_checkpointing: true dtype: bf16 model_type: ~ data_args: template: qwen2_5 strategy_args: strategy_name: fsdp2_infer # NPU: Use fsdp2_infer, NOT megatron_infer strategy_config: fsdp_size: 16 param_dtype: bf16 reduce_dtype: bf16 apply_tiled_mlp: true tiled_num_shards: 8 reshard_after_forward: true offload_policy: true device_mapping: list(range(0,16)) # NPU: Reference shares NPUs with training infer_batch_size: 2 rewards: math_rule: worker_cls: roll.pipeline.rlvr.rewards.math_rule_reward_worker.MathRuleRewardWorker model_args: model_name_or_path: ${reward_pretrain} data_args: template: qwen2_5 tag_included: [deepmath_103k, aime] world_size: 8 infer_batch_size: 1 ``` -------------------------------- ### Create DataProto and set meta_info Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/Development/Developer Guide/distributed_application_development.md Creates a DataProto from a single dict and sets meta_info with global_step and loss_mask_keys. ```python batch = DataProto.from_single_dict(batch_dict) batch.meta_info = { "global_step": global_step, "loss_mask_keys": ["labels"], } ``` -------------------------------- ### Install VLM pipeline dependencies Source: https://github.com/alibaba/roll/blob/main/docs_roll/docs/User Guides/Pipeline/vl_rlvr_pipeline_start.md Install dependencies for the VLM pipeline. VLLM is the only supported inference engine for VLM pipeline currently, so use the corresponding requirement files. ```bash pip install -r requirements_torch280_vllm.txt ```