Dataset Viewer
Auto-converted to Parquet Duplicate
program
stringlengths
1
13
length
uint8
1
13
depth
uint8
0
10
n_attn
uint8
0
10
width
uint8
0
5
output_class
stringclasses
7 values
class_param
uint8
0
255
preperiod
uint16
0
4.1k
period
uint16
0
1.37k
zlib_size
uint16
8
4.11k
T
1
0
0
0
ends_in_zeros
0
0
1
8
1
1
0
0
0
eventually_constant
0
0
1
27
2
1
0
0
0
eventually_constant
0
0
1
27
3
1
0
0
0
eventually_constant
0
0
1
27
1C
2
1
1
1
polynomial
1
0
256
315
1P
2
1
1
1
eventually_constant
0
1
1
27
2P
2
1
1
1
eventually_constant
0
1
1
27
3P
2
1
1
1
eventually_constant
0
1
1
27
T0=
3
0
0
0
recurrence_1
255
0
2
27
T1-
3
0
0
0
polynomial
1
0
256
315
T2+
3
0
0
0
polynomial
1
0
128
180
T2-
3
0
0
0
polynomial
1
0
128
180
T3+
3
0
0
0
polynomial
1
0
256
315
T3-
3
0
0
0
polynomial
1
0
256
315
01-
3
0
0
0
eventually_constant
0
0
1
26
02-
3
0
0
0
eventually_constant
0
0
1
27
03-
3
0
0
0
eventually_constant
0
0
1
27
13+
3
0
0
0
eventually_constant
0
0
1
27
1CP
3
2
2
1
polynomial
1
0
256
315
1P!
3
1
1
1
ends_in_zeros
0
1
1
9
1PP
3
2
2
1
eventually_constant
0
2
1
27
2T-
3
0
0
0
recurrence_1
127
0
2
28
23+
3
0
0
0
eventually_constant
0
0
1
27
2PP
3
2
2
1
eventually_constant
0
2
1
27
3T-
3
0
0
0
recurrence_1
255
0
2
28
33+
3
0
0
0
eventually_constant
0
0
1
27
3PP
3
2
2
1
eventually_constant
0
2
1
28
TT1M
4
1
1
1
eventually_constant
0
3
1
27
TT2M
4
1
1
1
eventually_constant
0
3
1
28
TT3M
4
1
1
1
eventually_constant
0
3
1
28
TTP=
4
1
1
1
recurrence_2
0
0
3
28
T0=P
4
1
1
1
recurrence_2
0
0
4
29
T1+P
4
1
1
1
recurrence_2
0
0
512
584
T1-P
4
1
1
1
recurrence_2
0
0
512
584
T1C+
4
1
1
1
polynomial
2
0
512
584
T1C-
4
1
1
1
polynomial
2
0
512
584
T1C=
4
1
1
1
eventually_periodic
0
1
256
52
T1C<
4
1
1
1
eventually_periodic
0
0
256
44
T1P-
4
1
1
1
polynomial
1
0
256
315
T1P<
4
1
1
1
recurrence_1
255
0
2
27
T2+P
4
1
1
1
polynomial
8
0
256
315
T2-P
4
1
1
1
polynomial
8
0
256
315
T2<C
4
1
1
1
eventually_constant
0
1
1
27
T2P+
4
1
1
1
polynomial
1
0
128
180
T2P-
4
1
1
1
polynomial
1
0
128
180
T3+P
4
1
1
1
recurrence_2
0
0
512
584
T3-P
4
1
1
1
recurrence_2
0
0
512
584
T3<C
4
1
1
1
eventually_constant
0
2
1
28
T3P+
4
1
1
1
polynomial
1
0
256
315
T3P-
4
1
1
1
polynomial
1
0
256
315
TP0=
4
1
1
1
recurrence_2
0
0
4
29
TP1+
4
1
1
1
recurrence_2
0
0
512
584
TP1-
4
1
1
1
recurrence_2
0
0
512
584
TP2+
4
1
1
1
polynomial
8
0
256
315
TP2-
4
1
1
1
polynomial
8
0
256
315
TP3+
4
1
1
1
recurrence_2
0
0
512
584
TP3-
4
1
1
1
recurrence_2
0
0
512
584
0T2M
4
1
1
1
recurrence_1
127
0
2
28
0T3M
4
1
1
1
recurrence_1
255
0
2
28
01-P
4
1
1
1
eventually_constant
0
1
1
27
01C=
4
1
1
1
eventually_periodic
0
0
256
44
02-P
4
1
1
1
eventually_constant
0
1
1
27
03-P
4
1
1
1
eventually_constant
0
1
1
27
11C+
4
1
1
1
polynomial
1
0
256
315
11C%
4
1
1
1
eventually_periodic
0
0
256
44
11C=
4
1
1
1
eventually_periodic
0
0
256
44
11C<
4
1
1
1
eventually_periodic
0
0
256
55
12P+
4
1
1
1
eventually_constant
0
1
1
27
12P-
4
1
1
1
eventually_constant
0
1
1
27
13+P
4
1
1
1
eventually_constant
0
1
1
28
13P+
4
1
1
1
eventually_constant
0
1
1
27
13P-
4
1
1
1
eventually_constant
0
1
1
27
1CT%
4
1
1
1
eventually_periodic
0
0
256
215
1C2+
4
1
1
1
polynomial
1
0
256
315
1C2-
4
1
1
1
polynomial
1
0
256
315
1C2=
4
1
1
1
eventually_periodic
0
0
256
39
1C2<
4
1
1
1
eventually_periodic
0
0
256
53
1C3+
4
1
1
1
polynomial
1
0
256
315
1C3-
4
1
1
1
polynomial
1
0
256
315
1C3%
4
1
1
1
eventually_periodic
0
0
256
46
1C3=
4
1
1
1
eventually_periodic
0
0
256
39
1C3<
4
1
1
1
eventually_periodic
0
0
256
42
1CPP
4
3
3
1
polynomial
1
1
256
315
1P1-
4
1
1
1
ends_in_zeros
0
1
1
9
1P2+
4
1
1
1
eventually_constant
0
1
1
27
1P2-
4
1
1
1
eventually_constant
0
1
1
27
1P3+
4
1
1
1
eventually_constant
0
1
1
28
1P3-
4
1
1
1
eventually_constant
0
1
1
27
1P!P
4
2
2
1
ends_in_zeros
0
2
1
10
1PP!
4
2
2
1
ends_in_zeros
0
2
1
10
1PPP
4
3
3
1
eventually_constant
0
3
1
28
2T-P
4
1
1
1
recurrence_2
0
0
4
29
2TP-
4
1
1
1
recurrence_2
0
0
4
29
21C-
4
1
1
1
polynomial
1
0
256
315
21C%
4
1
1
1
eventually_periodic
0
0
256
54
21C<
4
1
1
1
eventually_periodic
0
0
256
41
21P-
4
1
1
1
eventually_constant
0
1
1
27
21P%
4
1
1
1
ends_in_zeros
0
1
1
9
22P+
4
1
1
1
eventually_constant
0
1
1
27
23+P
4
1
1
1
eventually_constant
0
1
1
28
End of preview. Expand in Data Studio

bf-rasp-minimal-13

Every distinct output of every program of up to 13 symbols in bf-rasp, a small transformer-like language, each paired with a shortest program that produces it. That is 238,698,194 outputs in total, found by search over all programs in order of length. Each row is one output, stored as its shortest program plus metadata. The outputs themselves are not stored, because they are fully determined by the program: running it with the included code (code/bfrasp.py, code/bfrasp_run.c) gives the 4,095 bytes back.

bf-rasp is a compact variant of RASP (Weiss et al., 2021), the programming language whose operations correspond to transformer components, written as stack strings so that programs can be enumerated by length. Every program generates a byte sequence from nothing, one token at a time, like a decoder-only transformer. The intended use is pretraining and evaluating sequence models on algorithmically generated data whose description length, in a transformer-shaped language, is known.

It is a companion to bf-minimal-14, the same kind of corpus for a Brainf*ck-style tape machine, and uses the same output length (4,095 bytes), the same output classes and the same file layout, so the two can be compared directly.

Shortest, with an estimated error rate. Lengths 1–9 were checked against brute force over every valid program and are exact. Lengths 10–13 come from a search that compares partial programs on test sequences, which can very rarely merge two different ones. About 1 output in 100,000 at length 11 is missing or has a program longer than the shortest, and lengths 12–13 are probably somewhat worse. See "How the search works" below.

The language

A program is a string over 18 symbols. It describes a column: one byte value at every position of a token sequence, computed only from the tokens up to and including that position (it is causal). The column is the model's prediction of the next token.

Stack evaluation. Read the program left to right with a stack of columns. Each symbol pops its inputs from the top of the stack (in the order they were pushed: a b - computes a − b) and pushes its result. A program is valid if every symbol finds enough inputs of the right types and exactly one column is left at the end.

Symbol Inputs (in push order) Output column at position q Transformer part
T — the token x[q] token input
0 1 — the constant 0 or 1 (a boolean) bias
2 3 — the constant 2 or 3 (a number) bias
+ - a, b a + b, a − b, mod 256 MLP
% a, b a mod b; a when b = 0 MLP
= < a, b 1 if a = b (a < b), else 0 (a boolean) MLP
! boolean c 1 − c MLP
& booleans c, d c and d MLP
? boolean c, a, b a where c is 1, else b MLP
C boolean c the number of positions k ≤ q with c[k] = 1, mod 256 attention (counting)
P x x[q − 1]; 0 at q = 0 attention (previous position)
M K, Q, V V[k] at the latest k < q with K[k] = Q[q]; 0 if there is none attention (match and copy)
D x x, x (duplicate) wiring
S x, y y, x (swap) wiring

Values and types. Every value is a byte (0–255) and arithmetic wraps mod 256. There are two types: a boolean is a value that is 0 or 1 and may be used anywhere a number is expected. 0, 1, =, <, ! and & produce booleans; !, &, C and the first input of ? require them. ? produces a boolean when both of its branches are boolean; P and M keep the type of their (value) input; everything else produces numbers.

Generation. There is no input. The sequence starts as the single token 0 at position 0. At each step the program's column is evaluated at the last position, and its value is appended as the next token. The output is the first 4,095 generated tokens (bytes), so the sequence x[0..4095] is 0 followed by the output. Every valid program generates exactly 4,095 bytes; nothing halts or runs out of time. Because every column depends only on earlier positions, generating T tokens costs O(length × T) with a running count per C, a register per P and a 256-entry table per M.

Measures (columns of the dataset): length is the number of symbols. depth is the largest number of attention symbols (C, P, M) on any path from an input to the output, i.e. the number of attention layers a transformer needs. n_attn is the number of attention symbols, and width the largest number of them at the same depth (heads per layer). D and S let a column be used twice, so length counts the size of a circuit, not of a formula.

Order. Programs are ordered by length, then alphabetically with the symbol order T0123+-%=<!&?CPMDS. The program stored for an output is the first in this order that generates it.

Examples.

Program What it computes Output (first 16 bytes)
T0= 1 if the current token is 0 1 0 1 0 1 0 1 0 …
1C3% (number of positions so far) mod 3 1 2 0 1 2 0 1 2 …
TT1+P3++ x + (previous x + 1) + 3: xn+1 = xn + xn−1 + 4 3 7 14 25 43 72 119 195 62 5 …
1C2=DC+ uses the count twice through D 0 2 1 1 1 1 1 1 …
TPTTM induction head: the token that followed the latest earlier occurrence of the current token 0 0 0 0 … (on its own); on the sequence 0 1 2 3 1 it predicts 2 at the last position

Step by step for TT1+P3++: T pushes the tokens; T 1 + pushes x + 1; P shifts it to x[q−1] + 1; 3 + adds 3; the final + adds the tokens pushed first, giving x[q] + x[q−1] + 4 at every position q.

code/bfrasp.py is the executable specification: evaluate (about 50 lines of plain Python, computing whole columns from the definitions above), generate (the incremental generator), compile_program (validity and types) and measures.

How the search works

Programs were searched by length. Two partial programs (prefixes) that leave the same stack of columns, with the same types, have exactly the same completions, so only the first in the order above is extended. The search compares columns by their values on a fixed battery of 311 test sequences of 4,095 tokens: random bytes and small alphabets, constants, counters, periodic patterns, and 256 outputs of shorter programs (the sequences programs actually read, since they read their own output). At the last length (13) programs are not compared on the battery: every one-column program is run and compared by its output. The run took about 12,500 CPU core-hours on a cluster.

Two different columns that agree on all 311 test sequences are merged, so an output can be missed or found only with a longer program. Checks:

  • Lengths 1–9 at 4,095 tokens: identical, length for length, to brute force over every valid program (369 million programs at length 9). Three outputs at length 9 store a different program of the same length than brute force would.
  • Lengths 10–11: compared with an independent search with a larger battery (567 sequences): 2 outputs at length 10 have a program one symbol too long, 66 outputs at length 11 are missing (or appear at length 12–13), and 41 store a different program of the same length. The larger battery itself missed 2 outputs that this search found.
  • With outputs of 256 tokens instead of 4,095, the same battery recipe (311 test sequences) found every output up to length 11 at its exact shortest length, checked against brute force over all 70 billion valid programs; a 128-sequence battery got 3 of 3.6 million wrong and a 567-sequence one 1.

So expect about 1 in 100,000 rows at length 11, and probably somewhat more at lengths 12–13, to have a program longer than the shortest, and a similar number of outputs to be absent. Every stored program does produce its output, and every row is a distinct output.

Data fields

Column Type Description
program string The shortest program found
length uint8 Program length, 1–13
depth uint8 Attention layers: most attention symbols on any input–output path
n_attn uint8 Number of attention symbols (C, P, M)
width uint8 Most attention symbols at one depth
output_class string First class that fits the 4,095-byte output (below)
class_param uint8 Degree for polynomial (1 = arithmetic progression), coefficient a for recurrence_1, else 0
preperiod uint16 Index where the repeating part starts
period uint16 Length of the repeating part; 0 if none was found
zlib_size uint16 Size of the output (trailing zero bytes removed) compressed with zlib at level 6

Output classes, in the order they are tried (the same classifier as bf-minimal-14):

output_class Meaning
ends_in_zeros The output is 0 from some point on (bf-rasp programs never halt; this is the counterpart of a halting program)
eventually_constant After a prefix, one nonzero byte repeats
polynomial After a prefix, a polynomial mod 256 in the position (degree in class_param)
recurrence_1 After a prefix, xn+1 = a·xn + b mod 256 with a ≠ 1
recurrence_2 After a prefix, xn+2 = a·xn+1 + b·xn + c mod 256 (for example Fibonacci)
eventually_periodic Repeats with period, but fits none of the above
not_periodic_in_window No period found that repeats at least three times within the window

A tail is only claimed when it covers at least half of the output, and a period only when it repeats at least three times. These labels describe the 4,095-byte window, not the infinite sequence. In fact every bf-rasp output is eventually periodic, because a program's whole state (its counts mod 256, previous values and lookup tables) is finite; not_periodic_in_window means the period or the prefix is longer than the window.

Files and configs

  • data/length_LL/part-PPP.parquet: one folder per program length. Lengths 1–11 are one file each, length 12 is 4 files and length 13 is 32 files. Within a length, rows are split between files by a hash of the output, so each file is a uniform random sample of its length. Within a file, rows are sorted by program in enumeration order.
  • Configs: default (all lengths), length_01 … length_13, and samples_with_outputs.
  • samples/with_outputs.parquet (samples_with_outputs): up to 20,000 random rows per length (all of them for lengths 1–7), with an extra output column holding the 4,095 output bytes.
  • code/: bfrasp.py (reference evaluator, generator and measures), bfrasp_run.c (fast generator, library and command-line tool), validate.py (checks a copy of the dataset), LICENSE.
  • stats/classes_by_length.tsv: rows per length and class. figures/: the plots below.

Statistics

Length Outputs Cumulative Ends in zeros Eventually periodic (all kinds) Not periodic in window
1 4 4 25.0% 75.0% 0.0%
2 4 8 0.0% 100.0% 0.0%
3 19 27 5.3% 94.7% 0.0%
4 94 121 7.4% 92.6% 0.0%
5 273 394 4.8% 91.2% 4.0%
6 1,429 1,823 2.9% 91.3% 5.7%
7 6,471 8,294 2.8% 86.4% 10.8%
8 32,112 40,406 2.4% 85.0% 12.6%
9 172,267 212,673 1.9% 80.3% 17.7%
10 934,531 1,147,204 1.7% 77.3% 20.9%
11 5,464,840 6,612,044 1.5% 73.1% 25.3%
12 32,431,478 39,043,522 1.4% 69.5% 29.0%
13 199,654,672 238,698,194 1.3% 66.0% 32.7%

"Eventually periodic (all kinds)" combines eventually_constant, polynomial, recurrence_1, recurrence_2 and eventually_periodic. New outputs grow about 6x per added symbol (bf-minimal-14: about 8x). Most periodic outputs come from counts wrapping mod 256: at length 10, 62% of eventually_periodic outputs have a period that is a multiple of 256.

New outputs per length, bf-rasp and Brainf*ck Class mix by length, Brainf*ck and bf-rasp Outputs of random length-13 programs

Usage

from datasets import load_dataset

ds = load_dataset("turtlecannon/bf-rasp-minimal-13", "length_10", split="train")
print(ds[0])
# {'program': ..., 'length': 10, 'depth': ..., 'n_attn': ..., 'width': ..., 'output_class': ..., ...}

# Length 13 is the bulk of the data: stream it, or load a few files (each is a random sample of length 13).
ds13 = load_dataset("turtlecannon/bf-rasp-minimal-13", "length_13", split="train", streaming=True)

Regenerate outputs with the included code (build the C library once for speed: cc -O2 -shared -fPIC -o code/libbfrasp_run.so code/bfrasp_run.c):

import sys; sys.path.insert(0, "code")      # from a local copy of the repository
import bfrasp

output = bfrasp.generate("TT1+P3++", 4095)  # bytes: 3 7 14 25 43 ...
column = bfrasp.evaluate("TPTTM", [0, 1, 2, 3, 1])   # the column on a given sequence: [0, 0, 0, 0, 2]

or from C: int bfrasp_generate(const char *program, int T, unsigned char *out); the command-line tool reads programs on stdin and writes T bytes per program. The C generator produces roughly 8,000 length-13 outputs of 4,095 bytes per second on one core.

Each length is about 6x larger than the one before, so sampling rows uniformly sees mostly length 13. Use the per-length configs to choose your own mixture.

Limitations

  • Approximate beyond length 9 (see "How the search works").
  • Window. Outputs are the first 4,095 bytes. Two programs whose outputs differ only later count as the same output, and class labels describe only the window.
  • One program per output. Only the first shortest program found (in enumeration order) is stored.
  • Outputs are not stored. They must be regenerated by running the programs.
  • No input. Programs only continue their own output. The same programs can also be run on a given prompt (bfrasp.evaluate computes a column on any sequence), but this dataset is about the unprompted outputs.

License and citation

Data: CC BY 4.0. Code in code/: MIT (see code/LICENSE).

@misc{bf_rasp_minimal_13,
  title        = {bf-rasp-minimal-13: shortest programs for all outputs of a compact RASP variant up to length 13},
  year         = {2026},
  howpublished = {Hugging Face dataset, turtlecannon/bf-rasp-minimal-13}
}

bf-rasp is a variant of RASP; please also cite it when you describe the language:

@inproceedings{weiss2021thinking,
  title     = {Thinking Like Transformers},
  author    = {Weiss, Gail and Goldberg, Yoav and Yahav, Eran},
  booktitle = {International Conference on Machine Learning},
  year      = {2021}
}
Downloads last month
102