# Ray Megatron GKD — separate rollout (disjoint GPUs) + colocated teacher.
# No `colocate_groups` => train and rollout use disjoint GPU sets
rlhf_type: gkd

model: Qwen/Qwen3.5-2B
teacher_model: Qwen/Qwen3.5-4B
gkd_logits_topk: 64

dataset: AI-ModelScope/alpaca-gpt4-data-en#2000
dataset_num_proc: 4
split_dataset_ratio: 0

micro_batch_size: 2
global_batch_size: 16
num_train_epochs: 1
logging_steps: 1
seed: 42
max_length: 8192
max_completion_length: 8192
padding_free: true
sequence_parallel: true
attention_backend: flash

lr: 1e-6
min_lr: 1e-6
lr_warmup_fraction: 0.0

temperature: 1.0
lmbda: 1
beta: 0.5
sft_alpha: 0.0

finetune: true
no_save_optim: true
no_save_rng: true
recompute_granularity: selective

use_vllm: true

# No colocate_groups -> train and rollout occupy separate GPU sets
offload_model: true
offload_optimizer: true
offload_teacher_model: true

train:
  gpus: 4
  tuner_type: lora
  lora_rank: 8
  lora_alpha: 32
  tensor_model_parallel_size: 2
  pipeline_model_parallel_size: 1
  expert_model_parallel_size: 1
  context_parallel_size: 1
  output_dir: megatron_output/gkd_rollout_separate_teacher_colocate

rollout:
  gpus: 4
  vllm_tensor_parallel_size: 1
  vllm_gpu_memory_utilization: 0.8
  vllm_max_model_len: 16384
