Skip to content

addition

addition

AdditionConfig(*, samples: dict[str, int] = field('data/addition/samples'), seeds: dict[str, int] = field('data/addition/seeds'), left_min: int = field('data/addition/left_min'), left_max: int = field('data/addition/left_max'), right_min: int = field('data/addition/right_min'), right_max: int = field('data/addition/right_max'), operand_width: int = field('data/addition/operand_width'), answer_width: int = field('data/addition/answer_width'), tokens: dict[str, int] = field('data/addition/tokens'), split: str = field('data/addition/split', default='train')) dataclass

Deterministic task parameters, owned by this dataset family.

Addition()

Bases: StringDataset

Fixed-width addition serialized for TrivialTokenizer.

The config owns the IDs for <eos>, <bos>, <mid>, +, =, |, and the first digit. With IDs 0..5 and digit offset 6, the example 237 + 682 = 0919 is presented to the model as::

1 8 9 13 3 12 14 8 4 2 6 15 7 15 0

deserialize renders that same sequence for result artifacts as::

<bos> 2 3 7 + 6 8 2 = <mid> 0 9 1 9 <eos>

Thus <mid> ends the evaluation prompt, the four digit IDs are the expected generation, and <eos> terminates it.

deserialize(token_ids: Sequence[int]) -> str

Render model token IDs as the task symbols used in result artifacts.