transformers modules during training, and saved checkpoints load with from_pretrained.
Halo adds LFM support around the native MoE and attention blocks once, then reuses that integration across SFT, LoRA, GRPO, and environmental GRPO with a consistent YAML structure. When a job grows from one GPU to a multi-node cluster, the distributed settings change but the integration does not.
Different training methods require specific dataset formats. See Datasets for format requirements for SFT and GRPO.
Recipes
MoE SFT
LFM2.5-8B-A1B across two GPUs with expert parallelism.Vision LoRA SFT
LFM2.5-VL-3B on one GPU with a rank-16 LoRA adapter.MoE scaling and GRPO
EP4 and EP8, TP, ETP, LoRA, inference, and GRPO.
LFM support
Halo supports these LFM MoE models:
Halo supports FSDP and these MoE parallelism modes:
- Expert parallelism (EP): distributes routed experts across GPUs
- Tensor parallelism (TP): shards the full-attention layers
- Expert-tensor parallelism (ETP): shards each expert across GPUs
- EP+TP: distributes experts and shards the full-attention layers
Quickstart
-
Clone Halo and its submodules.
-
Pull the image that matches your GPUs.
-
Start the training container. Export
HF_TOKENin the host shell first, and pointDat a large scratch volume.Run the remaining steps inside this container. -
Configure the run. Save the following as
sft.yaml, replacing the placeholder values. The chat template fields are LFM2-specific and should stay as they are.To start without editing anything, Halo ships a runnable EP2 configuration atexamples/sft/lfm2/lfm2.5-8b-a1b-ultrachat-ep2.yaml. Each block below is a delta on the configuration above. TrainLFM2-24B-A2B. Launch four processes with-n 4.On an eight-GPU node, raiseexpert_parallel_sizeto 8 when expert memory is the main limit and launch eight processes to match. On a single node the working EP sizes are the whole job, 2, or 1. An intermediate size such as EP4 on eight GPUs is rejected at config time. Shard attention with TP. Both dimensions use the same two ranks, so still launch with-n 2.Shard each expert with ETP. Use this when a single local expert is too large.Train a LoRA adapter. Keep EP enabled if the base model still needs expert sharding. These target modules cover text attention only. Vision models need a wider list that also reaches the vision tower and projector layers, as in the Vision LoRA SFT recipe.For GRPO with a vLLM or SGLang rollout server, follow the LFM2 cookbook. -
Launch the run. Match the process count to your parallel size.
Tips
expert_parallel_size: Must divide the model’s routed expert count evenly.LFM2.5-8B-A1Bhas 32 routed experts, so EP2 places 16 on each GPUmoe_balancing: bias_update: Required for LFM2 models. They have no router auxiliary loss, so Halo updates the expert-selection bias insteadsave_sharded_ep: false: Gathers a single Hugging Face checkpoint on save, so the result loads withfrom_pretrained. Set it totrueonly if you intend to resume at the same EP sizefp32_router: true: Keeps routing decisions in fp32 while experts stay in bf16, which is the cheaper half of full-precision MoE training- Chat template: LFM2 uses a ChatML-style template. Keep
assistant_message_templatealigned with it so completion masking trains only the assistant turns