NVIDIA-NeMo/RL #4105 —
all links pinned to f31f793.
Four pages on this PR — this one: what every packing config key does, and how to set them.
Energon SFT packing is configured from two places at once, and two of the keys are named almost
identically: data.energon.max_samples_per_sequence and
policy.sequence_packing.max_sequences_per_bin. Both read as "max <thing> per
<other thing>" using the same two words with the meanings swapped. Only one of them packs.
Both count samples, and a sample is one whole conversation — system prompt, user turn, assistant turn, a tool call and its reply, all of it. Turn count does not matter and token count only matters for the second knob. The figure below starts by pinning that down, then shows what each knob changes.
| Key | Required? | What it does |
|---|---|---|
data.energon.packing_buffer_size | yes | The master switch. Non-null is what makes setup treat this as an Energon-packing run. Also how many samples Energon buffers before choosing bins. |
policy.sequence_packing.enabled | yes | Must be true, or setup rejects the config. |
policy.sequence_packing.fuse_loss | yes | Must be true, same check. |
policy.sequence_packing.algorithm | yes | Which packer. Any of the six; the recipes use balanced_greedy_knapsack. |
data.max_input_seq_length | yes | The pack width. Passed to the packer as its bin capacity, and every pack is padded out to it. |
policy.make_sequence_length_divisible_by | yes | Each conversation is padded up to a multiple of this before packing. Must divide max_input_seq_length and match the parallelism — checked at startup. |
policy.sequence_packing.max_sequences_per_bin | no | Caps conversations per pack. Unset means only the token budget limits it. |
data.energon.max_samples_per_sequence | no | Shard read order. Nothing to do with packing. |
policy.dynamic_batching.enabled | must be off | Rejected together with Energon packing. |
policy.sequence_packing.train_mb_tokens | unclear | See the note at the bottom — the type says required, the packing path does not appear to use it, and no recipe sets it. |
The smallest config that satisfies every check, with the two optional knobs shown for contrast:
policy.sequence_packing — so you set keys in both blocks. The only key that controls how
many conversations share a pack is max_sequences_per_bin. The similarly named
max_samples_per_sequence changes what order samples come off disk in, which affects
shuffling, not layout.
train_mb_tokens is declared a required key of
SequencePackingConfig,
and _packing_args
reads it with a plain subscript whenever sequence packing is on. But the pack width on this path comes
from max_input_seq_length, and none of the three new recipes set train_mb_tokens —
nor does anything in their defaults: chain. Either something outside the chain supplies it, or
it is unused here and the type should say so. Asked on the PR; this page will be updated with the answer.