Long Context (v0.49.0)
Four RoPE-scaling types for 128k+ context fine-tuning: linear, dynamic, yarn and llama3. (Through v0.75.2 the list had a fifth, longrope. It is refused at config load since v0.76.0 (#1239): its per-dimension short_factor and long_factor vectors exist only on checkpoints already scaled with LongRoPE, so it cannot extend any checkpoint. To fine-tune a LongRoPE checkpoint such as Phi-3-mini-128k at its native length, leave rope_scaling_type unset.)
YaRN
training:
rope_scaling_type: yarn # linear | dynamic | yarn | llama3
data:
max_length: 32768 # the scaling factor is derived from this and the model's native contextThe RoPE keys are flat fields on training, not a nested rope_scaling block.
How the factor is chosen. Soup divides data.max_length by the model's own max_position_embeddings and applies no scaling at all unless data.max_length is larger. yarn_factor, yarn_attn_factor, yarn_beta_fast and yarn_beta_slow are read since v0.76.0, and only with rope_scaling_type: yarn (they are refused otherwise): yarn_factor replaces the factor Soup derives from data.max_length, and the other three set the attention_factor, beta_fast and beta_slow of the YaRN block. Through v0.75.2 no trainer passed them on.
Where the key applies. rope_scaling_type is read by task: sft, task: tts and task: pretrain, on backend: transformers; for sft that means the text path without stream_layers. Everywhere else it is refused at config load (v0.76.0, #1697, a breaking change): the other 20 tasks (dpo, grpo and so on), sft with backend: mlx or unsloth, sft with modality: vision or audio, and sft with stream_layers: true. Through v0.75.2 those configs loaded and ignored the key. Omitting the key keeps the checkpoint's native RoPE.
What the trainer does with it. Since v0.76.0 the RoPE configuration is applied before the model is constructed (#793): transformers 5 derives the rotary frequencies in the model constructor, so the factor takes effect. Through v0.75.2 the SFT trainer wrote the derived factor into model.config after the model had been loaded and printed Long-context enabled; in a check on a small randomly initialised Llama (transformers 5.17; yarn, linear and dynamic) that later edit changed neither the rotary frequencies nor the outputs. If you relied on this key on v0.75.2 or earlier, treat the context extension as not applied and re-run. No quality or speed result has been published for the corrected path.
A checkpoint whose RoPE block is already scaled is never replaced. If the model's rope_type is anything but default, extending it with linear, dynamic or yarn is refused, naming the checkpoint's rope_type and factor; only llama3 on a native llama3 block composes (below). A Gemma 3-style config with nested per-layer RoPE sections is refused too. A data.max_length at or below the model's native max_position_embeddings changes nothing.
Dynamic NTK
data:
max_length: 65536
training:
rope_scaling_type: dynamicDynamic NTK has no factor key, and neither do linear or llama3. The scaling factor is derived from data.max_length against the model's native context, so you ask for a longer context by raising max_length. The yarn_* keys are refused unless rope_scaling_type: yarn.
LongLoRA S² shifted-sparse attention (refused since v0.76.0)
training.use_longlora: true is refused at config load (#1240), in every spelling (yes, on, 1). The override this page described as live through v0.75.2 rolled the query and key projections of half the attention heads along the sequence with wrap-around while attention stayed full causal, so earlier positions could read keys computed from the last tokens of the sequence (future tokens leaked into the training loss), and no grouped attention ran at all. It stays refused until real S² attention exists. To extend the context, set training.rope_scaling_type and train plain LoRA. If you trained with it on an earlier version, upstream's account is that future tokens leaked into the loss; re-run with rope_scaling_type and plain LoRA.
Llama 3.1 NTK-aware scaling
Set rope_scaling_type: llama3 and Soup wires up the Llama 3.1-style NTK-aware schedule, with the same derived factor as the other types rather than a fixed 8. Naming the type is required: the SFT trainer only applies long-context scaling when rope_scaling_type is set, so there is no auto-detect of a Llama 3.1 base from soup train.
On a Llama 3.1 checkpoint (which already ships a native llama3 block: max_position_embeddings: 131072, factor 8 over an original 8192 tokens), llama3 composes with that block since v0.76.0 instead of replacing it (#1239). It keeps the checkpoint's original_max_position_embeddings, low_freq_factor and high_freq_factor, and multiplies the block's factor by data.max_length / max_position_embeddings: extending Llama-3.1-8B to 262144 tokens trains with factor 16 over 8192. Through v0.75.2 the block was rebuilt as factor 2 over 131072, so 35 of the 64 frequency pairs of an 8B head rotated up to 8x faster than in pretraining (upstream's arithmetic, not reproduced here), and the run printed only Long-context enabled. If you extended a Llama 3.1 checkpoint that way, re-run.
Pair with Multipack to keep variable-length samples efficient on long-context runs.
Soup is free and Apache-2.0. If it saved you a training run, starring the repo costs nothing and helps most. You can also fund the GPU time behind the work a 4 GB laptop cannot reach.