How st01tyy/lightscale works
LiteScale is a Megatron-native post-training framework for GKD, GRPO, and SFT, with replaceable inference services and an asynchronous rollout stack. Its principal online-RL workflow samples prompts, generates responses, evaluates rewards, and trains the actor; GKD and SFT are distinct training paths. The graph preserves major README capabilities and selected Megatron runtime layers. Relationships among LiteScale components follow README statements; unsampled implementation details are not inferred as confirmed calls.
Main entry points: training.py Megatron training · rollout_loop.py Rollout loop · config.py Unified config · async_grpo_trainer.py Async GRPO
Components 22
Entry and config
- Unified config
light_scale/config.py - Async actor entry
main_async_actor.py - SFT entry
main_sft.py - GKD entry
headquarters_v2.py
Async rollout
- Rollout loop
light_scale/async_rollout_v2/rollout_loop.py - Rollout thread
light_scale/async_rollout_v2/rollout_thread.py - Inference services
light_scale/async_rollout_v2/services/base_service.py - Rollout workers
light_scale/async_rollout_v2/workers/base_worker.py - LLM judging
light_scale/async_rollout_v2/utils/llm_judge.py - Rollout samples
light_scale/data.py
Post-training
- GRPO trainer
light_scale/grpo_trainer.py - Async GRPO
light_scale/async_grpo_trainer.py - SFT trainer
light_scale/sft_trainer.py - GKD objectives
light_scale/gkd_utils.py - Logit exchange
light_scale/logits_express.py
Megatron runtime
- Megatron training
megatron/training/training.py - Transformer layers
megatron/core/extensions/transformer_engine.py - Parallel execution
megatron/core/parallel_state.py - Inference engine
megatron/core/inference/engines/dynamic_engine.py - Request and sampling
megatron/core/inference/inference_request.py
Checkpointing
- Distributed checkpointing
megatron/core/dist_checkpointing/strategies/torch.py
Other components
- Research engineer
Connections 24
- Research engineer → Unified config: configures
- Unified config → Async actor entry: selects entry
- Unified config → SFT entry: selects entry
- Unified config → GKD entry: selects entry
- Async actor entry → Async GRPO: runs training
- Async GRPO → Rollout loop: coordinates rollouts
- Rollout loop → Inference services: uses services
- Rollout loop → Rollout workers: dispatches workers
- Rollout thread → Rollout loop: runs loop
- Rollout workers → LLM judging: requests judgments
- Rollout workers → Rollout samples: processes samples
light_scale/async_rollout_v2/workers/llm_judge_worker.py - Rollout loop → Rollout samples: produces samples
- Async GRPO → GRPO trainer: uses GRPO
- Async GRPO → Megatron training: accumulates gradients
- SFT entry → SFT trainer: runs SFT
- GKD entry → GKD objectives: computes objectives
- GKD objectives → Logit exchange: uses logit exchange
- GKD entry → Megatron training: trains distributed
- GRPO trainer → Megatron training: trains actor
- SFT trainer → Megatron training: trains model
- Megatron training → Transformer layers: executes layers
- Transformer layers → Parallel execution: uses parallel groups
megatron/core/extensions/transformer_engine.py - Inference engine → Request and sampling: handles requests
megatron/core/inference/engines/dynamic_engine.py - Megatron training → Distributed checkpointing: saves state