5 Train a projector and extend evaluation
TrainKit leaves feature extraction upstream and trains the projector against a frozen GLM-5.3-Flash backbone. XTuner provides the trainer, FSDP, packing, optimizer, and loss. TrainKit supplies the prompt, supervision mask, and insertion of projected payloads into the packed sequence.
Read a training export
The public sample dataset includes an NEU06 example under samples/eeg/neu06/. In a sage-training-data-v1 export:
dataset.jsondeclares the schema, split JSONL files, and the path tofeatures.json. Resolve paths relative to the manifest.- A split row describes a training example. Its
array_indexidentifies objects in the frozen feature cache, in prompt order. features.jsondescribes the cache.offsets.npylocates each object’s span innodes.npy, which holds its features. Some components also require discrete columns or side features.
Use the component’s scientific_inputs and prompt to decide what your export must contain. The TrainKit reader shows how the manifest and cache are opened.
Check packing before training
Start from the public repository root. Install the pinned XTuner checkout and dependencies, set XTUNER to that checkout, and set GLM to the matching local backbone directory. These commands also use hf from huggingface_hub and the root projector requirements from the CPU chapter. The preflight reads the projector configuration. The downloaded component weights are available for an optional warm start.
The preflight runs the recipe’s dataset, sampler, and collator on CPU. Read sizing in preflight.json for pack count, steps, warmup, and dropped tail packs. For training, the world size must be divisible by the sequence-parallel size (SP), and the data-parallel size (DP) is world_size / SP. Keep pack_max_length divisible by SP and global_batch_size divisible by DP. With round_up=False, steps per epoch are packs // global_batch_size. The sample uses one row per packing chunk so its two rows yield two packs and fill a global batch of two.
Choose a recipe and export
Use recipes/projector_sft.py for the common path across all nine published atom modalities. Use recipes/neu06_projector.py when you need strict NEU06 checks. Follow the training guide to pass the preflight sizing to XTuner. The exported config.json and projector.safetensors use the same component interface as the public checkpoints, so compatible serving clients can load the export and EvalKit can score the resulting predictions.
Add an evaluation dataset
Implement an EvalDataset subclass in the relevant EvalKit suite. Give it a unique name and versioned protocol. Implement load for frozen references keyed by eval_id, metadata for provenance and scoring rules, and score_items for parsing and metrics. Use the shared answer_span where its extraction rules match the protocol. Register the subclass in datasets/__init__.py and add fixed fixtures for reference validation, missing responses, and scoring. The dataset contract test shows how a new implementation reaches the existing CLI and scorer.