Antik Khan commited on
Commit ·
3d3ae36
1
Parent(s): 7482ec9
Add annotations
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- annotations/case_101.jsonAdded+157
- annotations/case_102.jsonAdded+157
- annotations/case_103.jsonAdded+200
- annotations/case_104.jsonAdded+157
- annotations/case_105.jsonAdded+157
- annotations/case_106.jsonAdded+157
- annotations/case_11.jsonAdded+172
- annotations/case_110.jsonAdded+172
- annotations/case_111.jsonAdded+214
- annotations/case_113.jsonAdded+291
- annotations/case_114.jsonAdded+157
- annotations/case_121.jsonAdded+157
- annotations/case_122.jsonAdded+157
- annotations/case_123.jsonAdded+157
- annotations/case_124.jsonAdded+216
- annotations/case_129.jsonAdded+200
- annotations/case_13.jsonAdded+171
- annotations/case_130.jsonAdded+187
- annotations/case_14.jsonAdded+171
- annotations/case_15.jsonAdded+135
- annotations/case_18.jsonAdded+203
- annotations/case_19.jsonAdded+221
- annotations/case_2.jsonAdded+215
- annotations/case_20.jsonAdded+158
- annotations/case_21.jsonAdded+214
- annotations/case_24.jsonAdded+157
- annotations/case_25.jsonAdded+203
- annotations/case_26.jsonAdded+157
- annotations/case_29.jsonAdded+157
- annotations/case_3.jsonAdded+122
- annotations/case_30.jsonAdded+157
- annotations/case_31.jsonAdded+157
- annotations/case_33.jsonAdded+157
- annotations/case_34.jsonAdded+157
- annotations/case_35.jsonAdded+157
- annotations/case_36.jsonAdded+157
- annotations/case_37.jsonAdded+157
- annotations/case_39.jsonAdded+671
- annotations/case_4.jsonAdded+188
- annotations/case_40.jsonAdded+171
- annotations/case_41.jsonAdded+157
- annotations/case_43.jsonAdded+157
- annotations/case_44.jsonAdded+172
- annotations/case_45.jsonAdded+200
- annotations/case_46.jsonAdded+157
- annotations/case_49.jsonAdded+157
- annotations/case_50.jsonAdded+157
- annotations/case_51.jsonAdded+157
- annotations/case_52.jsonAdded+157
- annotations/case_53.jsonAdded+171
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_101", "name": "check_square", "summary": "Check if each element is a square of an integer.", "examples": [ { "input": [ "BOS", 6, 19, 28, 14, 10, 7, 28, 20, 6 ], "output": [ "BOS", 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 25, 18, 22, 10, 10, 23, 20, 3, 7 ], "output": [ "BOS", 1, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 24, 16, 26, 26, 9, 27, 27, 15, 14 ], "output": [ "BOS", 0, 1, 0, 0, 1, 0, 0, 0, 0 ] }, { "input": [ "BOS", 1, 27, 20, 0, 11, 25, 21, 28, 11 ], "output": [ "BOS", 1, 0, 0, 1, 0, 1, 0, 0, 0 ] }, { "input": [ "BOS", 23, 2, 21, 20, 1, 23, 11, 29, 5 ], "output": [ "BOS", 0, 0, 0, 0, 1, 0, 0, 0, 0 ] } ], "is_categorical": true }, "program": "check_square = rasp.Map(lambda x: 1 if x ** 0.5 == int(x ** 0.5) else 0, rasp.tokens).named(\"check_square\")\nreturn check_square", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "INDICATOR", "note": "Evaluates each element independently and checks if it is a perfect square." }, "rasp_vars": [ "check_square" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_102", "name": "reflect_into_range", "summary": "Reflects each element within a range (default is [2, 7]).", "examples": [ { "input": [ "BOS", -3, -17, 4, -7, -12, 5, -19, -1, 7 ], "output": [ "BOS", 7, 3, 4, 3, 6, 5, 3, 5, 7 ] }, { "input": [ "BOS", -10, 3, 15, 19, 3, -18, 1, -19, 3 ], "output": [ "BOS", 4, 3, 5, 5, 3, 2, 3, 3, 3 ] }, { "input": [ "BOS", 18, 8, -6, -13, 0, 18, -2, 2, -10 ], "output": [ "BOS", 6, 6, 4, 7, 4, 6, 6, 2, 4 ] }, { "input": [ "BOS", 9, 17, -19, 0, 12, -9, 1, 4, 6 ], "output": [ "BOS", 5, 7, 3, 4, 2, 3, 3, 4, 6 ] }, { "input": [ "BOS", 7, -5, -6, -18, 16, -14, 0, -12, 18 ], "output": [ "BOS", 7, 5, 4, 2, 6, 6, 4, 6, 6 ] } ], "is_categorical": true }, "program": "return rasp.Map(lambda x: reflect_into_range(max_val, min_val, x), rasp.tokens)", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Applies a per-element reflection rule to fold values back into the target range." }, "rasp_vars": [ "reflected_sequence" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200{ "task": { "id": "case_103", "name": "swap_consecutive", "summary": "Swap consecutive numbers in a list.", "examples": [ { "input": [ "BOS", 2, 4, 2, 6, 4, 8, 6, 1, 3 ], "output": [ "BOS", 4.0, 2.0, 6.0, 2.0, 8.0, 4.0, 1.0, 6.0, 3.0 ] }, { "input": [ "BOS", 4, 1, 7, 5, 1, 4, 0, 9, 5 ], "output": [ "BOS", 1.0, 4.0, 5.0, 7.0, 4.0, 1.0, 9.0, 0.0, 5.0 ] }, { "input": [ "BOS", 10, 10, 7, 4, 3, 7, 7, 2, 5 ], "output": [ "BOS", 10.0, 10.0, 4.0, 7.0, 7.0, 3.0, 2.0, 7.0, 5.0 ] }, { "input": [ "BOS", 8, 0, 10, 10, 9, 2, 6, 3, 8 ], "output": [ "BOS", 0.0, 8.0, 10.0, 10.0, 2.0, 9.0, 3.0, 6.0, 8.0 ] }, { "input": [ "BOS", 6, 3, 10, 7, 4, 6, 9, 2, 6 ], "output": [ "BOS", 3.0, 6.0, 7.0, 10.0, 6.0, 4.0, 2.0, 9.0, 6.0 ] } ], "is_categorical": true }, "program": "len = rasp.SelectorWidth(rasp.Select(rasp.indices, rasp.indices, rasp.Comparison.TRUE)).named('len')\nswaper = rasp.SequenceMap(lambda idx, L: idx if (idx == L - 1 and idx % 2 == 0) else (idx + 1 if idx % 2 == 0 else idx - 1), rasp.indices, len).named('swaper')\nswap_selector = rasp.Select(rasp.indices, swaper, rasp.Comparison.EQ).named('swap_selector')\nswapped = rasp.Aggregate(swap_selector, rasp.tokens).named('swapped')\nreturn swapped", "components": [ { "id": "L0H0_ATTN", "hook": "blocks.0.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Produces a shared sequence-level size signal used to handle the last element correctly during swapping." }, "rasp_vars": [ "len" ], "labels": [ "selector_width_4_selector_width_attn_output" ] }, { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Turns the length-related signal into a sequence-length feature." }, "rasp_vars": [ "len" ], "labels": [ "selector_width_4_selector_width_attn_output", "selector_width_4" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "COMBINER", "note": "For each position, computes the index of the element it should swap with (neighbor, with end-of-sequence handling)." }, "rasp_vars": [ "swaper" ], "labels": [ "sequence_map_3" ] }, { "id": "L2H0_ATTN", "hook": "blocks.2.attn.hook_result[0]", "role": { "tag": "ROUTER", "note": "Moves values so each position receives the value from its swap partner." }, "rasp_vars": [ "swapped" ], "labels": [ "aggregate_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_104", "name": "exponential", "summary": "Apply exponential function to all elements of the input sequence.", "examples": [ { "input": [ "BOS", 2, 4, 2, 6, 4, 8, 6, 1, 3 ], "output": [ "BOS", 7.38905609893065, 54.598150033144236, 7.38905609893065, 403.4287934927351, 54.598150033144236, 2980.9579870417283, 403.4287934927351, 2.718281828459045, 20.085536923187668 ] }, { "input": [ "BOS", 4, 1, 7, 5, 1, 4, 0, 9, 5 ], "output": [ "BOS", 54.598150033144236, 2.718281828459045, 1096.6331584284585, 148.4131591025766, 2.718281828459045, 54.598150033144236, 1.0, 8103.083927575384, 148.4131591025766 ] }, { "input": [ "BOS", 10, 10, 7, 4, 3, 7, 7, 2, 5 ], "output": [ "BOS", 22026.465794806718, 22026.465794806718, 1096.6331584284585, 54.598150033144236, 20.085536923187668, 1096.6331584284585, 1096.6331584284585, 7.38905609893065, 148.4131591025766 ] }, { "input": [ "BOS", 8, 0, 10, 10, 9, 2, 6, 3, 8 ], "output": [ "BOS", 2980.9579870417283, 1.0, 22026.465794806718, 22026.465794806718, 8103.083927575384, 7.38905609893065, 403.4287934927351, 20.085536923187668, 2980.9579870417283 ] }, { "input": [ "BOS", 6, 3, 10, 7, 4, 6, 9, 2, 6 ], "output": [ "BOS", 403.4287934927351, 20.085536923187668, 22026.465794806718, 1096.6331584284585, 54.598150033144236, 403.4287934927351, 8103.083927575384, 7.38905609893065, 403.4287934927351 ] } ], "is_categorical": true }, "program": "exp_approx = rasp.Map(lambda x: math.exp(x), rasp.tokens)\nreturn exp_approx", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Applies an element-wise exponential transformation to each input element." }, "rasp_vars": [ "exp_approx" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_105", "name": "next_prime", "summary": "Replaces each number with the next prime after that number.", "examples": [ { "input": [ "BOS", 6, 19, 28, 14, 10, 7, 28, 20, 6 ], "output": [ "BOS", 7, 19, 29, 17, 11, 7, 29, 23, 7 ] }, { "input": [ "BOS", 25, 18, 22, 10, 10, 23, 20, 3, 7 ], "output": [ "BOS", 29, 19, 23, 11, 11, 23, 23, 3, 7 ] }, { "input": [ "BOS", 24, 16, 26, 26, 9, 27, 27, 15, 14 ], "output": [ "BOS", 29, 17, 29, 29, 11, 29, 29, 17, 17 ] }, { "input": [ "BOS", 1, 27, 20, 0, 11, 25, 21, 28, 11 ], "output": [ "BOS", 2, 29, 23, 2, 11, 29, 23, 29, 11 ] }, { "input": [ "BOS", 23, 2, 21, 20, 1, 23, 11, 29, 5 ], "output": [ "BOS", 23, 2, 23, 23, 2, 23, 11, 29, 5 ] } ], "is_categorical": true }, "program": "return rasp.Map(next_prime, rasp.tokens).named(\"next_prime\")", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Maps each input number to the next prime number at or above it, producing a per-position replacement value." }, "rasp_vars": [ "next_prime" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_106", "name": "mask_sequence_index_1", "summary": "Sets all elements to zero except for the element at index 1.", "examples": [ { "input": [ "BOS", 2, 4, 2, 6, 4, 8, 6, 1, 3 ], "output": [ "BOS", 0, 4, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 4, 1, 7, 5, 1, 4, 0, 9, 5 ], "output": [ "BOS", 0, 1, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 10, 10, 7, 4, 3, 7, 7, 2, 5 ], "output": [ "BOS", 0, 10, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 8, 0, 10, 10, 9, 2, 6, 3, 8 ], "output": [ "BOS", 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 6, 3, 10, 7, 4, 6, 9, 2, 6 ], "output": [ "BOS", 0, 3, 0, 0, 0, 0, 0, 0, 0 ] } ], "is_categorical": true }, "program": "return rasp.SequenceMap(lambda x, y: x if y == index else 0, rasp.tokens, rasp.indices)", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Combines token content with position information to keep only one chosen position." }, "rasp_vars": [ "mask_sequence" ], "labels": [ "sequence_map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172{ "task": { "id": "case_11", "name": "word_count_by_length", "summary": "Returns the length of each word in the input sequence.", "examples": [ { "input": [ "BOS", "oCLrZaW", "V", "b", "oCLrZaW", "TPSI", "poiVg", "b", "b", "oCLrZaW" ], "output": [ "BOS", 7.0, 1.0, 1.0, 7.0, 4.0, 5.0, 1.0, 1.0, 7.0 ] }, { "input": [ "BOS", "LB", "TPSI", "oCLrZaW", "TPSI", "TPSI", "poiVg", "b", "V", "poiVg" ], "output": [ "BOS", 2.0, 4.0, 7.0, 4.0, 4.0, 5.0, 1.0, 1.0, 5.0 ] }, { "input": [ "BOS", "poiVg", "TPSI", "no", "b", "LB", "poiVg", "V", "no", "no" ], "output": [ "BOS", 5.0, 4.0, 2.0, 1.0, 2.0, 5.0, 1.0, 2.0, 2.0 ] }, { "input": [ "BOS", "V", "J", "J", "TPSI", "TPSI", "oCLrZaW", "LB", "poiVg", "V" ], "output": [ "BOS", 1.0, 1.0, 1.0, 4.0, 4.0, 7.0, 2.0, 5.0, 1.0 ] }, { "input": [ "BOS", "LB", "poiVg", "V", "b", "J", "V", "LB", "no", "b" ], "output": [ "BOS", 2.0, 5.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 1.0 ] } ], "is_categorical": true }, "program": "word_length = rasp.Map(lambda x: len(x), sop)\nlength_selector = rasp.Select(word_length, word_length, rasp.Comparison.EQ)\nword_count = rasp.Aggregate(length_selector, word_length, default=None)\nreturn word_count", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Computes a per-token length feature that will be used to group tokens by equal length." }, "rasp_vars": [ "word_length" ], "labels": [ "map_3" ] }, { "id": "L1H0_ATTN", "hook": "blocks.1.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Groups positions by matching word length and aggregates to produce the per-length count-style output." }, "rasp_vars": [ "length_selector", "word_count" ], "labels": [ "aggregate_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172{ "task": { "id": "case_110", "name": "insert_zeros", "summary": "Inserts zeros between each element, removing the latter half of the list.", "examples": [ { "input": [ "BOS", 2, 4, 2, 6, 4, 8, 6, 1, 3 ], "output": [ "BOS", 2.0, 0, 4.0, 0, 2.0, 0, 6.0, 0, 4.0 ] }, { "input": [ "BOS", 4, 1, 7, 5, 1, 4, 0, 9, 5 ], "output": [ "BOS", 4.0, 0, 1.0, 0, 7.0, 0, 5.0, 0, 1.0 ] }, { "input": [ "BOS", 10, 10, 7, 4, 3, 7, 7, 2, 5 ], "output": [ "BOS", 10.0, 0, 10.0, 0, 7.0, 0, 4.0, 0, 3.0 ] }, { "input": [ "BOS", 8, 0, 10, 10, 9, 2, 6, 3, 8 ], "output": [ "BOS", 8.0, 0, 0.0, 0, 10.0, 0, 10.0, 0, 9.0 ] }, { "input": [ "BOS", 6, 3, 10, 7, 4, 6, 9, 2, 6 ], "output": [ "BOS", 6.0, 0, 3.0, 0, 10.0, 0, 7.0, 0, 4.0 ] } ], "is_categorical": true }, "program": "shifter = rasp.Select(rasp.indices, rasp.indices, lambda x, y: x == int(y / 2))\nshifted = rasp.Aggregate(shifter, rasp.tokens)\nreturn rasp.SequenceMap(lambda x, y: x if y % 2 == 0 else 0, shifted, rasp.indices)", "components": [ { "id": "L0H0_ATTN", "hook": "blocks.0.attn.hook_result[0]", "role": { "tag": "ROUTER", "note": "Routes each output position to a source input position (floor(i/2)) so the first half gets expanded into even indices." }, "rasp_vars": [ "shifter", "shifted" ], "labels": [ "aggregate_2" ] }, { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Uses the routed value and the position index to emit the value on even positions and 0 on odd positions." }, "rasp_vars": [ "sequence_map" ], "labels": [ "sequence_map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214{ "task": { "id": "case_111", "name": "last_element_with_zero_padding", "summary": "Returns the last element of the sequence and pads the rest with zeros.", "examples": [ { "input": [ "BOS", 2, 4, 2, 6, 4, 8, 6, 1, 3 ], "output": [ "BOS", 3.0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 4, 1, 7, 5, 1, 4, 0, 9, 5 ], "output": [ "BOS", 5.0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 10, 10, 7, 4, 3, 7, 7, 2, 5 ], "output": [ "BOS", 5.0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 8, 0, 10, 10, 9, 2, 6, 3, 8 ], "output": [ "BOS", 8.0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 6, 3, 10, 7, 4, 6, 9, 2, 6 ], "output": [ "BOS", 6.0, 0, 0, 0, 0, 0, 0, 0, 0 ] } ], "is_categorical": true }, "program": "length = rasp.SelectorWidth(rasp.Select(rasp.tokens, rasp.tokens, rasp.Comparison.TRUE)).named(\"length\")\nlast_element_selector = rasp.Select(rasp.indices, rasp.Map(lambda x: x - 1, length), rasp.Comparison.EQ).named(\"last_element_selector\")\nlast_element_sequence = rasp.Aggregate(last_element_selector, rasp.tokens).named(\"last_element_sequence\")\nreturn rasp.SequenceMap(lambda x, y: x if y == 0 else 0, last_element_sequence, rasp.indices)", "components": [ { "id": "L0H0_ATTN", "hook": "blocks.0.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Produces a shared sequence length signal used to identify the last position." }, "rasp_vars": [ "length" ], "labels": [ "length_5_selector_width_attn_output" ] }, { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Turns the length-related signal into a sequence-length feature." }, "rasp_vars": [ "length" ], "labels": [ "length_5", "length_5_selector_width_attn_output" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Computes the last element's index by applying element-wise subtraction to the sequence-length feature." }, "rasp_vars": [ "last_index" ], "labels": [ "map_4" ] }, { "id": "L2H0_ATTN", "hook": "blocks.2.attn.hook_result[0]", "role": { "tag": "ROUTER", "note": "Retrieves the last token and makes it available for placement into the output sequence." }, "rasp_vars": [ "last_element_sequence" ], "labels": [ "last_element_sequence_2" ] }, { "id": "L2_MLP", "hook": "blocks.2.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Outputs the last token in the first slot and writes zeros in every other slot." }, "rasp_vars": [ "output_sequence" ], "labels": [ "sequence_map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291{ "task": { "id": "case_113", "name": "invert_if_sorted", "summary": "Inverts the sequence if it is sorted in ascending order, otherwise leaves it unchanged.", "examples": [ { "input": [ "BOS", 6, 19, 28, 14, 10, 7, 28, 20, 6 ], "output": [ "BOS", 6.0, 19.0, 28.0, 14.0, 10.0, 7.0, 28.0, 20.0, 6.0 ] }, { "input": [ "BOS", 25, 18, 22, 10, 10, 23, 20, 3, 7 ], "output": [ "BOS", 25.0, 18.0, 22.0, 10.0, 10.0, 23.0, 20.0, 3.0, 7.0 ] }, { "input": [ "BOS", 24, 16, 26, 26, 9, 27, 27, 15, 14 ], "output": [ "BOS", 24.0, 16.0, 26.0, 26.0, 9.0, 27.0, 27.0, 15.0, 14.0 ] }, { "input": [ "BOS", 1, 27, 20, 0, 11, 25, 21, 28, 11 ], "output": [ "BOS", 1.0, 27.0, 20.0, 0.0, 11.0, 25.0, 21.0, 28.0, 11.0 ] }, { "input": [ "BOS", 23, 2, 21, 20, 1, 23, 11, 29, 5 ], "output": [ "BOS", 23.0, 2.0, 21.0, 20.0, 1.0, 23.0, 11.0, 29.0, 5.0 ] } ], "is_categorical": true }, "program": "shifter = rasp.Select(rasp.indices, rasp.indices, lambda x, y: x == y - 1 or (x == 0 and y == 0))\nshifted = rasp.Aggregate(shifter, rasp.tokens)\nchecks = rasp.SequenceMap(lambda x, y: 1 if x <= y else 0, shifted, rasp.tokens)\nzero_selector = rasp.Select(checks, rasp.Map(lambda x: 0, rasp.indices), rasp.Comparison.EQ)\ninvert_decider = rasp.Map(lambda x: 1 if x > 0 else -1, rasp.SelectorWidth(zero_selector))\navg_idx = rasp.Map(lambda x: x / 2 - 0.5, rasp.SelectorWidth(rasp.Select(rasp.indices, rasp.indices, rasp.Comparison.TRUE)))\ndiff_to_avg_idx = rasp.SequenceMap(lambda x, y: x - y, rasp.indices, avg_idx)\ninverter = rasp.SequenceMap(lambda x, y: x + y, avg_idx, rasp.SequenceMap(lambda x, y: x * y, invert_decider, diff_to_avg_idx))\ninvert_selector = rasp.Select(inverter, rasp.indices, rasp.Comparison.EQ)\nreturn rasp.Aggregate(invert_selector, rasp.tokens)", "components": [ { "id": "L0H0_ATTN", "hook": "blocks.0.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Counts the number of non-increasing steps in the sequence by attending over positions where the sortedness check fails" }, "rasp_vars": [ "shifter" ], "labels": [ "selector_width_6_selector_width_attn_output" ] }, { "id": "L0H1_ATTN", "hook": "blocks.0.attn.hook_result[1]", "role": { "tag": "ROUTER", "note": "Produces the shifted token stream that aligns each token with its predecessor." }, "rasp_vars": [ "shifted" ], "labels": [ "aggregate_14" ] }, { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Converts the attention-derived selector-width signal into sortedness evidence used by the global invert/keep decision." }, "rasp_vars": [ "checks", "zero_selector" ], "labels": [ "selector_width_6", "selector_width_6_selector_width_attn_output", "map_13" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Converts the sortedness evidence into a single invert/keep control signal for the rest of the circuit." }, "rasp_vars": [ "checks", "invert_decider" ], "labels": [ "map_4", "sequence_map_12" ] }, { "id": "L2H0_ATTN", "hook": "blocks.2.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Provides the sequence-length-style signal that is later turned into a center index reference for inversion." }, "rasp_vars": [ "length_helper" ], "labels": [ "selector_width_10_selector_width_attn_output" ] }, { "id": "L2_MLP", "hook": "blocks.2.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Turns the length/position information into a center reference and a per-position offset-from-center signal used for inversion arithmetic." }, "rasp_vars": [ "avg_idx", "diff_to_avg_idx" ], "labels": [ "selector_width_10", "selector_width_10_selector_width_attn_output", "sequence_map_8" ] }, { "id": "L3_MLP", "hook": "blocks.3.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Prepares an intermediate numeric signal for building the inverted index mapping." }, "rasp_vars": [ "inversion_prep" ], "labels": [ "map_7" ] }, { "id": "L4_MLP", "hook": "blocks.4.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Combines the center reference, per-position offset, and the invert/keep control to produce the target source index for each position." }, "rasp_vars": [ "inverter" ], "labels": [ "sequence_map_5" ] }, { "id": "L5_MLP", "hook": "blocks.5.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Finalizes the per-position index routing plan that will be used to either invert the sequence or leave it unchanged." }, "rasp_vars": [ "invert_selector" ], "labels": [ "sequence_map_3" ] }, { "id": "L6H0_ATTN", "hook": "blocks.6.attn.hook_result[0]", "role": { "tag": "ROUTER", "note": "Executes the final token movement: each position copies from its computed source index, yielding either the inverted or original sequence." }, "rasp_vars": [ "output" ], "labels": [ "aggregate_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_114", "name": "logarithm_base10", "summary": "Apply a logarithm base 10 to each element of the input sequence.", "examples": [ { "input": [ "BOS", 7, 4, 8, 5, 7, 10, 3, 7, 8 ], "output": [ "BOS", 0.8450980400142567, 0.6020599913279623, 0.9030899869919434, 0.6989700043360187, 0.8450980400142567, 1.0, 0.47712125471966244, 0.8450980400142567, 0.9030899869919434 ] }, { "input": [ "BOS", 3, 7, 4, 9, 3, 5, 3, 7, 5 ], "output": [ "BOS", 0.47712125471966244, 0.8450980400142567, 0.6020599913279623, 0.9542425094393249, 0.47712125471966244, 0.6989700043360187, 0.47712125471966244, 0.8450980400142567, 0.6989700043360187 ] }, { "input": [ "BOS", 6, 2, 5, 1, 10, 6, 9, 1, 10 ], "output": [ "BOS", 0.7781512503836435, 0.30102999566398114, 0.6989700043360187, 0.0, 1.0, 0.7781512503836435, 0.9542425094393249, 0.0, 1.0 ] }, { "input": [ "BOS", 5, 4, 8, 8, 3, 6, 5, 2, 8 ], "output": [ "BOS", 0.6989700043360187, 0.6020599913279623, 0.9030899869919434, 0.9030899869919434, 0.47712125471966244, 0.7781512503836435, 0.6989700043360187, 0.30102999566398114, 0.9030899869919434 ] }, { "input": [ "BOS", 9, 7, 2, 4, 9, 2, 10, 9, 10 ], "output": [ "BOS", 0.9542425094393249, 0.8450980400142567, 0.30102999566398114, 0.6020599913279623, 0.9542425094393249, 0.30102999566398114, 1.0, 0.9542425094393249, 1.0 ] } ], "is_categorical": true }, "program": "def apply_log(element):\n return math.log(element, 10)\n\nlogarithm = rasp.Map(apply_log, rasp.tokens).named(\"logarithm\")\nreturn logarithm", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Applies a base-10 logarithm to each element independently." }, "rasp_vars": [ "logarithm" ], "labels": [ "logarithm_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_121", "name": "arcsine", "summary": "Applies the arcsine function to each element.", "examples": [ { "input": [ "BOS", 0.7, -0.19999999999999996, -0.9, 0.8999999999999999, 0.3999999999999999, -0.4, 0.10000000000000009, -0.30000000000000004, 0.3999999999999999 ], "output": [ "BOS", 0.775397496610753, -0.20135792079033074, -1.1197695149986342, 1.119769514998634, 0.4115168460674879, -0.41151684606748806, 0.10016742116155988, -0.3046926540153976, 0.4115168460674879 ] }, { "input": [ "BOS", -0.8, -0.6, 0.8, -0.4, -0.19999999999999996, -0.4, 0.7, -0.7, 0.30000000000000004 ], "output": [ "BOS", -0.9272952180016123, -0.6435011087932844, 0.9272952180016123, -0.41151684606748806, -0.20135792079033074, -0.41151684606748806, 0.775397496610753, -0.775397496610753, 0.3046926540153976 ] }, { "input": [ "BOS", -0.4, 0.8999999999999999, 0.3999999999999999, 0.0, -0.30000000000000004, -0.4, 0.8, 0.0, 0.0 ], "output": [ "BOS", -0.41151684606748806, 1.119769514998634, 0.4115168460674879, 0.0, -0.3046926540153976, -0.41151684606748806, 0.9272952180016123, 0.0, 0.0 ] }, { "input": [ "BOS", -0.7, -0.30000000000000004, -0.8, -0.9, 0.10000000000000009, -0.5, -0.9, -1.0, 0.10000000000000009 ], "output": [ "BOS", -0.775397496610753, -0.3046926540153976, -0.9272952180016123, -1.1197695149986342, 0.10016742116155988, -0.5235987755982989, -1.1197695149986342, -1.5707963267948966, 0.10016742116155988 ] }, { "input": [ "BOS", 0.10000000000000009, 0.6000000000000001, -0.09999999999999998, 0.5, 0.3999999999999999, 0.3999999999999999, 0.8, 0.10000000000000009, 0.8999999999999999 ], "output": [ "BOS", 0.10016742116155988, 0.6435011087932845, -0.10016742116155977, 0.5235987755982989, 0.4115168460674879, 0.4115168460674879, 0.9272952180016123, 0.10016742116155988, 1.119769514998634 ] } ], "is_categorical": true }, "program": "return rasp.Map(lambda x: math.asin(x), rasp.tokens)", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Applies an arcsine nonlinear transformation to each input element independently." }, "rasp_vars": [ "arcsine" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_122", "name": "check_divisible_by_3", "summary": "Check if each number is divisible by 3.", "examples": [ { "input": [ "BOS", 6, 19, 28, 14, 10, 7, 28, 20, 6 ], "output": [ "BOS", 1, 0, 0, 0, 0, 0, 0, 0, 1 ] }, { "input": [ "BOS", 25, 18, 22, 10, 10, 23, 20, 3, 7 ], "output": [ "BOS", 0, 1, 0, 0, 0, 0, 0, 1, 0 ] }, { "input": [ "BOS", 24, 16, 26, 26, 9, 27, 27, 15, 14 ], "output": [ "BOS", 1, 0, 0, 0, 1, 1, 1, 1, 0 ] }, { "input": [ "BOS", 1, 27, 20, 0, 11, 25, 21, 28, 11 ], "output": [ "BOS", 0, 1, 0, 1, 0, 0, 1, 0, 0 ] }, { "input": [ "BOS", 23, 2, 21, 20, 1, 23, 11, 29, 5 ], "output": [ "BOS", 0, 0, 1, 0, 0, 0, 0, 0, 0 ] } ], "is_categorical": true }, "program": "check_divisible_by_3 = rasp.Map(lambda x: 1 if x % 3 == 0 else 0, rasp.tokens).named(\"check_divisible_by_3\")\nreturn check_divisible_by_3", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "INDICATOR", "note": "Outputs 1 when the input number is divisible by 3, otherwise outputs 0." }, "rasp_vars": [ "check_divisible_by_3" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_123", "name": "arccosine", "summary": "Apply arccosine to each element of the input sequence.", "examples": [ { "input": [ "BOS", 0.7, -0.19999999999999996, -0.9, 0.8999999999999999, 0.3999999999999999, -0.4, 0.10000000000000009, -0.30000000000000004, 0.3999999999999999 ], "output": [ "BOS", 0.7953988301841436, 1.7721542475852274, 2.6905658417935308, 0.45102681179626264, 1.1592794807274087, 1.9823131728623846, 1.4706289056333368, 1.8754889808102941, 1.1592794807274087 ] }, { "input": [ "BOS", -0.8, -0.6, 0.8, -0.4, -0.19999999999999996, -0.4, 0.7, -0.7, 0.30000000000000004 ], "output": [ "BOS", 2.498091544796509, 2.214297435588181, 0.6435011087932843, 1.9823131728623846, 1.7721542475852274, 1.9823131728623846, 0.7953988301841436, 2.3461938234056494, 1.266103672779499 ] }, { "input": [ "BOS", -0.4, 0.8999999999999999, 0.3999999999999999, 0.0, -0.30000000000000004, -0.4, 0.8, 0.0, 0.0 ], "output": [ "BOS", 1.9823131728623846, 0.45102681179626264, 1.1592794807274087, 1.5707963267948966, 1.8754889808102941, 1.9823131728623846, 0.6435011087932843, 1.5707963267948966, 1.5707963267948966 ] }, { "input": [ "BOS", -0.7, -0.30000000000000004, -0.8, -0.9, 0.10000000000000009, -0.5, -0.9, -1.0, 0.10000000000000009 ], "output": [ "BOS", 2.3461938234056494, 1.8754889808102941, 2.498091544796509, 2.6905658417935308, 1.4706289056333368, 2.0943951023931957, 2.6905658417935308, 3.141592653589793, 1.4706289056333368 ] }, { "input": [ "BOS", 0.10000000000000009, 0.6000000000000001, -0.09999999999999998, 0.5, 0.3999999999999999, 0.3999999999999999, 0.8, 0.10000000000000009, 0.8999999999999999 ], "output": [ "BOS", 1.4706289056333368, 0.9272952180016121, 1.6709637479564563, 1.0471975511965979, 1.1592794807274087, 1.1592794807274087, 0.6435011087932843, 1.4706289056333368, 0.45102681179626264 ] } ], "is_categorical": true }, "program": "return rasp.Map(lambda x: math.acos(x), rasp.tokens)", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Applies an arccosine nonlinear transformation to each input element independently." }, "rasp_vars": [ "arccosine" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216{ "task": { "id": "case_124", "name": "check_all_equal", "summary": "Check if all elements in a list are equal.", "examples": [ { "input": [ "BOS", 3, 3, 3, 3, 3, 3, 3, 3, 3 ], "output": [ "BOS", 1, 1, 1, 1, 1, 1, 1, 1, 1 ] }, { "input": [ "BOS", 9, 4, 0, 2, 5, 3, 7, 10, 8 ], "output": [ "BOS", 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 2, 1, 8, 9, 4, 3, 0, 6, 5 ], "output": [ "BOS", 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 0, 0, 0, 0, 0, 0, 0, 0, 0 ], "output": [ "BOS", 1, 1, 1, 1, 1, 1, 1, 1, 1 ] }, { "input": [ "BOS", 3, 8, 0, 10, 5, 6, 4, 7, 9 ], "output": [ "BOS", 0, 0, 0, 0, 0, 0, 0, 0, 0 ] } ], "is_categorical": true }, "program": "unequal_selector = rasp.Select(rasp.tokens, rasp.tokens, lambda x, y: x != y)\nchecks = rasp.SelectorWidth(unequal_selector)\nzero_selector = rasp.Select(checks, rasp.Map(lambda x: 0, rasp.indices), rasp.Comparison.EQ)\nreturn rasp.Map(lambda x: 1 if x > 0 else 0, rasp.SelectorWidth(zero_selector))", "components": [ { "id": "L0H0_ATTN", "hook": "blocks.0.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Aggregates positions holding tokens unequal to the current token into a per-position mismatch count." }, "rasp_vars": [ "unequal_selector" ], "labels": [ "selector_width_4_selector_width_attn_output" ] }, { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Turns the mismatch signal into a per-position mismatch count and prepares it for the global decision." }, "rasp_vars": [ "checks" ], "labels": [ "selector_width_4", "map_5", "selector_width_4_selector_width_attn_output" ] }, { "id": "L1H0_ATTN", "hook": "blocks.1.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Aggregates positions where the mismatch count is zero, producing a per-position count of zero-mismatch occurrences." }, "rasp_vars": [ "zero_selector" ], "labels": [ "selector_width_2_selector_width_attn_output" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Converts the zero-mismatch mask into a scalar-like summary signal that can be read out." }, "rasp_vars": [ "all_equal_signal" ], "labels": [ "selector_width_2", "selector_width_2_selector_width_attn_output" ] }, { "id": "L2_MLP", "hook": "blocks.2.mlp.hook_post", "role": { "tag": "INDICATOR", "note": "Outputs the final binary decision: 1 if all elements are equal, otherwise 0." }, "rasp_vars": [ "all_equal" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200{ "task": { "id": "case_129", "name": "check_multiple_of_n", "summary": "Checks if all elements are a multiple of n (default n=2).", "examples": [ { "input": [ "BOS", 0, 28, 2, 6, 22, 16, 26, 20, 10 ], "output": [ "BOS", 1, 1, 1, 1, 1, 1, 1, 1, 1 ] }, { "input": [ "BOS", 0, 8, 2, 26, 9, 6, 20, 24, 12 ], "output": [ "BOS", 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 4, 10, 14, 0, 6, 9, 12, 8, 18 ], "output": [ "BOS", 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 0, 22, 8, 6, 26, 4, 2, 16, 24 ], "output": [ "BOS", 1, 1, 1, 1, 1, 1, 1, 1, 1 ] }, { "input": [ "BOS", 2, 26, 8, 14, 29, 18, 0, 10, 16 ], "output": [ "BOS", 0, 0, 0, 0, 0, 0, 0, 0, 0 ] } ], "is_categorical": true }, "program": "checks = rasp.Map(lambda x: 1 if x % n == 0 else 0, rasp.tokens).named(f\"check_multiple_of_{n}\")\nzero_selector = rasp.Select(checks, rasp.Map(lambda x: 0, rasp.indices), rasp.Comparison.EQ)\nreturn rasp.Map(lambda x: 0 if x > 0 else 1, rasp.SelectorWidth(zero_selector))", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "INDICATOR", "note": "Computes a per-element pass/fail flag indicating whether each value is divisible by n." }, "rasp_vars": [ "checks" ], "labels": [ "check_multiple_of_2_4", "map_5" ] }, { "id": "L1H0_ATTN", "hook": "blocks.1.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Aggregates positions where the divisibility flag is zero, producing a per-position count of non-multiple occurrences." }, "rasp_vars": [ "zero_selector" ], "labels": [ "selector_width_2_selector_width_attn_output" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Summarizes the mismatch count signal into a single global indicator shared across positions." }, "rasp_vars": [ "mismatch_count" ], "labels": [ "selector_width_2" ] }, { "id": "L2_MLP", "hook": "blocks.2.mlp.hook_post", "role": { "tag": "INDICATOR", "note": "Converts the global mismatch indicator into the final decision: all-multiples vs not-all-multiples." }, "rasp_vars": [ "all_multiples" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171{ "task": { "id": "case_13", "name": "token_trend_analysis", "summary": "Analyzes the trend [increasing, decreasing, constant] of numeric tokens.", "examples": [ { "input": [ "BOS", 1, 1, 0, 0, 1, 1, 0, 0, 0 ], "output": [ "BOS", "constant", "decreasing", "constant", "increasing", "constant", "decreasing", "constant", "constant", null ] }, { "input": [ "BOS", 2, 2, 0, 2, 0, 2, 2, 0, 0 ], "output": [ "BOS", "constant", "decreasing", "increasing", "decreasing", "increasing", "constant", "decreasing", "constant", null ] }, { "input": [ "BOS", 2, 0, 2, 2, 0, 0, 2, 1, 2 ], "output": [ "BOS", "decreasing", "increasing", "constant", "decreasing", "constant", "increasing", "decreasing", "increasing", null ] }, { "input": [ "BOS", 2, 2, 2, 1, 2, 1, 1, 2, 1 ], "output": [ "BOS", "constant", "constant", "decreasing", "increasing", "decreasing", "constant", "increasing", "decreasing", null ] }, { "input": [ "BOS", 2, 2, 2, 0, 2, 1, 0, 1, 1 ], "output": [ "BOS", "constant", "constant", "decreasing", "increasing", "decreasing", "decreasing", "increasing", "constant", null ] } ], "is_categorical": true }, "program": "select_off_by_offset = rasp.Select[rasp.indices, rasp.indices, lambda k,q: q == k + offset]\nnext_token = rasp.Aggregate[select_off_by_offset, sop, default=None].named[\"shift_by(-1)\"]\ntrend_analysis = rasp.SequenceMap[second_part_fn, sop, next_token]\nreturn trend_analysis", "components": [ { "id": "L0H0_ATTN", "hook": "blocks.0.attn.hook_result[0]", "role": { "tag": "ROUTER", "note": "Shifts the sequence to provide each position with the next token (and pads the end)." }, "rasp_vars": [ "next_token" ], "labels": [ "shift_by(-1)_2" ] }, { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Compares the current token with the next token and outputs the trend class." }, "rasp_vars": [ "trend_analysis" ], "labels": [ "sequence_map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187{ "task": { "id": "case_130", "name": "clip", "summary": "Clips each element to be within a range (make the default range [2, 7]).", "examples": [ { "input": [ "BOS", -9, 4, 13, -1, -5, -8, 13, 5, -9 ], "output": [ "BOS", 2, 4, 7, 2, 2, 2, 7, 5, 2 ] }, { "input": [ "BOS", 10, 3, 7, -5, -5, 8, 5, -12, -8 ], "output": [ "BOS", 7, 3, 7, 2, 2, 7, 5, 2, 2 ] }, { "input": [ "BOS", 9, 1, 11, 11, -6, 12, 12, 0, -1 ], "output": [ "BOS", 7, 2, 7, 7, 2, 7, 7, 2, 2 ] }, { "input": [ "BOS", -14, 12, 5, -15, -4, 10, 6, 13, -4 ], "output": [ "BOS", 2, 7, 5, 2, 2, 7, 6, 7, 2 ] }, { "input": [ "BOS", 8, -13, 6, 5, -14, 8, -4, 14, -10 ], "output": [ "BOS", 7, 2, 6, 5, 2, 7, 2, 7, 2 ] } ], "is_categorical": true }, "program": "all_min_val = rasp.Map(lambda x: 2, rasp.tokens)\nall_max_val = rasp.Map(lambda x: 7, rasp.tokens)\nless_than_min = rasp.Map(lambda x: x < 2, rasp.tokens)\ngreater_than_max = rasp.Map(lambda x: x > 7, rasp.tokens)\nclip_min = rasp.SequenceMap(lambda orig, clip: clip if orig < 2 else orig, rasp.tokens, all_min_val)\nclip_max = rasp.SequenceMap(lambda clipped_min, clip: clip if clipped_min > 7 else clipped_min, clip_min, all_max_val)\nreturn clip_max", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Creates constant per-position helper values used as the lower and upper clipping bounds." }, "rasp_vars": [ "all_min_val", "all_max_val" ], "labels": [ "map_3", "map_4" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Applies the lower-bound clipping step, replacing values below the minimum with the minimum." }, "rasp_vars": [ "clip_min" ], "labels": [ "sequence_map_2" ] }, { "id": "L2_MLP", "hook": "blocks.2.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Applies the upper-bound clipping step, replacing values above the maximum with the maximum." }, "rasp_vars": [ "clip_max" ], "labels": [ "sequence_map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171{ "task": { "id": "case_14", "name": "count_a", "summary": "Returns the count of 'a' in the input sequence.", "examples": [ { "input": [ "BOS", "b", "b", "a", "a", "b", "b", "a", "a", "a" ], "output": [ "BOS", 5, 5, 5, 5, 5, 5, 5, 5, 5 ] }, { "input": [ "BOS", "c", "c", "a", "c", "a", "c", "c", "a", "a" ], "output": [ "BOS", 4, 4, 4, 4, 4, 4, 4, 4, 4 ] }, { "input": [ "BOS", "c", "a", "c", "c", "a", "a", "c", "b", "c" ], "output": [ "BOS", 3, 3, 3, 3, 3, 3, 3, 3, 3 ] }, { "input": [ "BOS", "c", "c", "c", "b", "c", "b", "b", "c", "b" ], "output": [ "BOS", 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", "c", "c", "c", "a", "c", "b", "a", "b", "b" ], "output": [ "BOS", 2, 2, 2, 2, 2, 2, 2, 2, 2 ] } ], "is_categorical": true }, "program": "count_a_selector = rasp.Select(sop, sop, lambda k, q: k == token).named(\"count_a_selector\")\ncount_a = rasp.SelectorWidth(count_a_selector).named(\"count_a\")\nreturn count_a", "components": [ { "id": "L0H0_ATTN", "hook": "blocks.0.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Aggregates positions containing the target token 'a' into a per-position match count." }, "rasp_vars": [ "count_a_selector" ], "labels": [ "count_a_1_selector_width_attn_output" ] }, { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Turns the match pattern into a per-position total count of 'a' in the sequence." }, "rasp_vars": [ "count_a" ], "labels": [ "count_a_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135{ "task": { "id": "case_15", "name": "double_minus_index", "summary": "Returns each token multiplied by two and subtracted by its index.", "examples": [ { "input": [ "BOS", 2, 4, 3, 2 ], "output": [ "BOS", 4, 7, 4, 1 ] }, { "input": [ "BOS", 4, 1, 3, 1 ], "output": [ "BOS", 8, 1, 4, -1 ] }, { "input": [ "BOS", 3, 4, 2, 4 ], "output": [ "BOS", 6, 7, 2, 5 ] }, { "input": [ "BOS", 3, 4, 0, 3 ], "output": [ "BOS", 6, 7, -2, 3 ] }, { "input": [ "BOS", 4, 1, 2, 2 ], "output": [ "BOS", 8, 1, 2, 1 ] } ], "is_categorical": true }, "program": "values, *sops = sops; for sop in sops: values = rasp.SequenceMap(lambda x, y: (*x, y) if isinstance(x, tuple) else (x, y), values, sop); return rasp.Map(lambda args: f(*args), values)", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Builds an intermediate representation that packages multiple per-position inputs together so they can be processed as a single combined object downstream." }, "rasp_vars": [ "values_tuple_stage_1" ], "labels": [ "sequence_map_3" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Extends the combined per-position representation by incorporating the position index, forming the final set of arguments needed for the arithmetic step." }, "rasp_vars": [ "values_tuple_stage_2" ], "labels": [ "sequence_map_2" ] }, { "id": "L2_MLP", "hook": "blocks.2.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Computes the final per-position arithmetic from the bundled arguments (equivalent to doubling the token value and subtracting the index)." }, "rasp_vars": [ "output" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203{ "task": { "id": "case_18", "name": "token_frequency_classifier", "summary": "Classify each token based on its frequency as 'rare', 'common', or 'frequent'.", "examples": [ { "input": [ "BOS", "a", "d", "b", "e", "d", "a", "a", "c", "c" ], "output": [ "BOS", "common", "rare", "rare", "rare", "rare", "common", "common", "rare", "rare" ] }, { "input": [ "BOS", "b", "d", "d", "c", "d", "d", "a", "c", "e" ], "output": [ "BOS", "rare", "common", "common", "rare", "common", "common", "rare", "rare", "rare" ] }, { "input": [ "BOS", "c", "e", "a", "b", "d", "a", "d", "b", "b" ], "output": [ "BOS", "rare", "rare", "rare", "common", "rare", "rare", "rare", "common", "common" ] }, { "input": [ "BOS", "e", "d", "c", "e", "b", "d", "b", "d", "e" ], "output": [ "BOS", "common", "common", "rare", "common", "rare", "common", "rare", "common", "common" ] }, { "input": [ "BOS", "d", "e", "c", "e", "e", "b", "c", "c", "c" ], "output": [ "BOS", "rare", "common", "common", "common", "common", "rare", "common", "common", "common" ] } ], "is_categorical": true }, "program": "frequency = make_hist()\ntotal_tokens = make_length()\nfrequency_classification = rasp.SequenceMap(\n lambda freq, total: \"frequent\" if freq > total/2 else (\"common\" if freq > total/4 else \"rare\"),\n frequency, total_tokens)\nreturn frequency_classification", "components": [ { "id": "L0H0_ATTN", "hook": "blocks.0.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Builds the token-equality matching structure used to count how often each token appears." }, "rasp_vars": [ "same_tok" ], "labels": [ "hist_2_selector_width_attn_output" ] }, { "id": "L0H1_ATTN", "hook": "blocks.0.attn.hook_result[1]", "role": { "tag": "AGGREGATOR", "note": "Builds the all-positions selector used as the basis for computing sequence length." }, "rasp_vars": [ "all_true_selector" ], "labels": [ "length_3_selector_width_attn_output" ] }, { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Turns the selector-width signals into usable numeric features for per-token frequency and total length." }, "rasp_vars": [ "frequency", "total_tokens" ], "labels": [ "hist_2", "length_3", "hist_2_selector_width_attn_output", "length_3_selector_width_attn_output" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Combines per-token frequency with total length to assign the label rare/common/frequent." }, "rasp_vars": [ "frequency_classification" ], "labels": [ "sequence_map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221{ "task": { "id": "case_19", "name": "sequential_duplicate_removal", "summary": "Removes consecutive duplicate tokens from a sequence.", "examples": [ { "input": [ "BOS", "c", "a", "c", "c", "a", "a", "c", "b", "c", "c", "c", "c", "a", "c" ], "output": [ "BOS", null, "a", "c", null, "a", null, "c", "b", "c", null, null, null, "a", "c" ] }, { "input": [ "BOS", "c", "c", "b", "c", "b", "b", "c", "b", "c", "c", "a", "c", "a", "c" ], "output": [ "BOS", null, null, "b", "c", "b", null, "c", "b", "c", null, "a", "c", "a", "c" ] }, { "input": [ "BOS", "c", "a", "a", "c", "b", "a", "b", "b", "b", "a", "b", "a", "b", "c" ], "output": [ "BOS", null, "a", null, "c", "b", "a", "b", null, null, "a", "b", "a", "b", "c" ] }, { "input": [ "BOS", "c", "a", "c", "c", "b", "a", "b", "b", "b", "b", "b", "b", "b", "a" ], "output": [ "BOS", null, "a", "c", null, "b", "a", "b", null, null, null, null, null, null, "a" ] }, { "input": [ "BOS", "b", "a", "b", "b", "b", "b", "a", "a", "b", "b", "a", "a", "a", "c" ], "output": [ "BOS", null, "a", "b", null, null, null, "a", null, "b", null, "a", null, null, "c" ] } ], "is_categorical": true }, "program": "shifted_sop = shift_by(1, sop)\nduplicate_removal_sop = rasp.SequenceMap(lambda x, y: x if x != y else None, sop, shifted_sop).named(\"sequential_duplicate_removal\")\nreturn duplicate_removal_sop", "components": [ { "id": "L0H0_ATTN", "hook": "blocks.0.attn.hook_result[0]", "role": { "tag": "ROUTER", "note": "Shifts the sequence by one position to expose the previous token at each index for comparison." }, "rasp_vars": [ "shifted_sop" ], "labels": [ "shift_by(1)_2" ] }, { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Compares each token to the previous token and outputs the token only when it differs; otherwise outputs None to remove consecutive duplicates." }, "rasp_vars": [ "sequential_duplicate_removal" ], "labels": [ "sequential_duplicate_removal_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215{ "task": { "id": "case_2", "name": "reverse_sequence", "summary": "Reverse the input sequence.", "examples": [ { "input": [ "BOS", "l", "z", "v", "l", "y", "q", "j", "p", "o" ], "output": [ "BOS", "o", "p", "j", "q", "y", "l", "v", "z", "l" ] }, { "input": [ "BOS", "w", "k", "k", "x", "u", "d", "h", "x", "c" ], "output": [ "BOS", "c", "x", "h", "d", "u", "x", "k", "k", "w" ] }, { "input": [ "BOS", "v", "u", "b", "x", "l", "f", "b", "u", "a" ], "output": [ "BOS", "a", "u", "b", "f", "l", "x", "b", "u", "v" ] }, { "input": [ "BOS", "g", "t", "o", "k", "h", "u", "g", "z", "s" ], "output": [ "BOS", "s", "z", "g", "u", "h", "k", "o", "t", "g" ] }, { "input": [ "BOS", "o", "s", "l", "w", "t", "y", "c", "e", "s" ], "output": [ "BOS", "s", "e", "c", "y", "t", "w", "l", "s", "o" ] } ], "is_categorical": true }, "program": "length = make_length(); opp_idx = length - indices; opp_idx_minus_1 = opp_idx - 1; reverse_selector = Select(indices, opp_idx_minus_1, EQ); reverse = Aggregate(reverse_selector, tokens)", "components": [ { "id": "L0H0_ATTN", "hook": "blocks.0.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Produces a sequence-length signal by counting tokens via the attention output width." }, "rasp_vars": [ "length" ], "labels": [ "length_5_selector_width_attn_output" ] }, { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Computes sequence length feature from the length-related signal produced by the attention head." }, "rasp_vars": [ "length" ], "labels": [ "length_5", "length_5_selector_width_attn_output" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "COMBINER", "note": "For each position, computes which position it should pull from to create the reversed order." }, "rasp_vars": [ "opp_idx" ], "labels": [ "opp_idx_4" ] }, { "id": "L2_MLP", "hook": "blocks.2.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Adjusts the computed source position so it lines up with the correct reverse indexing." }, "rasp_vars": [ "opp_idx_minus_1" ], "labels": [ "opp_idx-1_3" ] }, { "id": "L3H0_ATTN", "hook": "blocks.3.attn.hook_result[0]", "role": { "tag": "ROUTER", "note": "Moves tokens so every output position receives the token from its mirrored position, producing the reversed sequence." }, "rasp_vars": [ "reverse_selector", "reverse" ], "labels": [ "reverse_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158{ "task": { "id": "case_20", "name": "spam_message_detector", "summary": "Detect spam messages based on appearance of spam keywords.", "examples": [ { "input": [ "BOS", "poiVg", "poiVg", "now", "b", "V", "now", "now", "TPSI", "click" ], "output": [ "BOS", "not spam", "not spam", "spam", "not spam", "not spam", "spam", "spam", "not spam", "spam" ] }, { "input": [ "BOS", "spam", "offer", "click", "spam", "oCLrZaW", "J", "poiVg", "poiVg", "offer" ], "output": [ "BOS", "not spam", "spam", "spam", "not spam", "not spam", "not spam", "not spam", "not spam", "spam" ] }, { "input": [ "BOS", "no", "V", "poiVg", "now", "b", "no", "offer", "TPSI", "no" ], "output": [ "BOS", "not spam", "not spam", "not spam", "spam", "not spam", "not spam", "spam", "not spam", "not spam" ] }, { "input": [ "BOS", "spam", "spam", "TPSI", "spam", "no", "V", "oCLrZaW", "TPSI", "b" ], "output": [ "BOS", "not spam", "not spam", "not spam", "not spam", "not spam", "not spam", "not spam", "not spam", "not spam" ] }, { "input": [ "BOS", "b", "LB", "now", "spam", "click", "LB", "spam", "b", "J" ], "output": [ "BOS", "not spam", "not spam", "spam", "not spam", "spam", "not spam", "not spam", "not spam", "not spam" ] } ], "is_categorical": true }, "program": "spam_keywords = {\"free\", \"offer\", \"click\", \"now\"}\nkeyword_count = rasp.Map(lambda x: sum(x == keyword for keyword in spam_keywords), sop)\nis_spam = rasp.Map(lambda x: \"spam\" if x > 0 else \"not spam\", keyword_count)\nreturn is_spam", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Checks each token for membership in a spam-keyword set and emits a spam/not-spam label for that position." }, "rasp_vars": [ "keyword_count", "is_spam" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214{ "task": { "id": "case_21", "name": "unique_token_extractor", "summary": "Extract unique tokens from a string", "examples": [ { "input": [ "BOS", "b", "b", "a", "a", "b", "b", "a", "a", "a" ], "output": [ "BOS", "b", null, "a", null, null, null, null, null, null ] }, { "input": [ "BOS", "c", "c", "a", "c", "a", "c", "c", "a", "a" ], "output": [ "BOS", "c", null, "a", null, null, null, null, null, null ] }, { "input": [ "BOS", "c", "a", "c", "c", "a", "a", "c", "b", "c" ], "output": [ "BOS", "c", "a", null, null, null, null, null, "b", null ] }, { "input": [ "BOS", "c", "c", "c", "b", "c", "b", "b", "c", "b" ], "output": [ "BOS", "c", null, null, "b", null, null, null, null, null ] }, { "input": [ "BOS", "c", "c", "c", "a", "c", "b", "a", "b", "b" ], "output": [ "BOS", "c", null, null, "a", null, "b", null, null, null ] } ], "is_categorical": true }, "program": "tokens_with_indices = rasp.SequenceMap(lambda x, i: (x, i), sop, rasp.indices)\noccurrences_selector = rasp.Select(tokens_with_indices, tokens_with_indices, lambda k, q: k[0] == q[0] and k[1] <= q[1])\noccurrences_per_row = rasp.SelectorWidth(occurrences_selector)\nfirst_occurrences_indices = rasp.SequenceMap(lambda count, i: i if count == 1 else -1, occurrences_per_row, rasp.indices)\ntokens_selector = rasp.Select(first_occurrences_indices, rasp.indices, rasp.Comparison.EQ).named(\"unique_tokens_selector\")\nreturn rasp.Aggregate(tokens_selector, sop, default=None).named(\"unique_tokens\")", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Creates a combined 'token + position' representation so later steps can tell which token occurred where." }, "rasp_vars": [ "tokens_with_indices" ], "labels": [ "sequence_map_6" ] }, { "id": "L1H0_ATTN", "hook": "blocks.1.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Aggregates matching positions (same token, earlier-or-equal index) into a per-position count of how many times each token has appeared up to and including the current position." }, "rasp_vars": [ "occurrences_selector" ], "labels": [ "selector_width_4_selector_width_attn_output" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Converts the per-position summary into the explicit running count of that token's occurrences so far. (how many times this token has appeared up to here)." }, "rasp_vars": [ "occurrences_per_row" ], "labels": [ "selector_width_4", "selector_width_4_selector_width_attn_output" ] }, { "id": "L2_MLP", "hook": "blocks.2.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Computes a per-position routing key that marks the first occurrence positions and marks all others as an invalid index." }, "rasp_vars": [ "first_occurrences_indices" ], "labels": [ "sequence_map_3" ] }, { "id": "L3H0_ATTN", "hook": "blocks.3.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Attends to the position (if any) whose 'first occurrences indices' equals the current index, and aggregates the token value from there, or None if no such position exists." }, "rasp_vars": [ "unique_tokens" ], "labels": [ "unique_tokens_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_24", "name": "first_occurrence", "summary": "Copies each token in the sequence to the output unchanged.", "examples": [ { "input": [ "BOS", "b", "b", "a", "a", "b", "b", "a", "a", "a" ], "output": [ "BOS", "b", "b", "a", "a", "b", "b", "a", "a", "a" ] }, { "input": [ "BOS", "c", "c", "a", "c", "a", "c", "c", "a", "a" ], "output": [ "BOS", "c", "c", "a", "c", "a", "c", "c", "a", "a" ] }, { "input": [ "BOS", "c", "a", "c", "c", "a", "a", "c", "b", "c" ], "output": [ "BOS", "c", "a", "c", "c", "a", "a", "c", "b", "c" ] }, { "input": [ "BOS", "c", "c", "c", "b", "c", "b", "b", "c", "b" ], "output": [ "BOS", "c", "c", "c", "b", "c", "b", "b", "c", "b" ] }, { "input": [ "BOS", "c", "c", "c", "a", "c", "b", "a", "b", "b" ], "output": [ "BOS", "c", "c", "c", "a", "c", "b", "a", "b", "b" ] } ], "is_categorical": true }, "program": "first_occurrence = rasp.Aggregate(rasp.Select(rasp.indices, rasp.indices, rasp.Comparison.EQ), sop, default=None).named(\"first_occurrence\"); return first_occurrence", "components": [ { "id": "L0H0_ATTN", "hook": "blocks.0.attn.hook_result[0]", "role": { "tag": "ROUTER", "note": "Routes each position's token value to itself via an identity attention pattern. Each query position attends exclusively to its own key position, acting as a pass-through." }, "rasp_vars": [ "first_occurrence" ], "labels": [ "first_occurrence_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203{ "task": { "id": "case_25", "name": "token_frequency_normalization", "summary": "Normalizes token frequencies in a sequence to a range between 0 and 1.", "examples": [ { "input": [ "BOS", "b", "b", "a", "a", "b", "b", "a", "a", "a" ], "output": [ "BOS", 0.4444444444444444, 0.4444444444444444, 0.5555555555555556, 0.5555555555555556, 0.4444444444444444, 0.4444444444444444, 0.5555555555555556, 0.5555555555555556, 0.5555555555555556 ] }, { "input": [ "BOS", "c", "c", "a", "c", "a", "c", "c", "a", "a" ], "output": [ "BOS", 0.5555555555555556, 0.5555555555555556, 0.4444444444444444, 0.5555555555555556, 0.4444444444444444, 0.5555555555555556, 0.5555555555555556, 0.4444444444444444, 0.4444444444444444 ] }, { "input": [ "BOS", "c", "a", "c", "c", "a", "a", "c", "b", "c" ], "output": [ "BOS", 0.5555555555555556, 0.3333333333333333, 0.5555555555555556, 0.5555555555555556, 0.3333333333333333, 0.3333333333333333, 0.5555555555555556, 0.1111111111111111, 0.5555555555555556 ] }, { "input": [ "BOS", "c", "c", "c", "b", "c", "b", "b", "c", "b" ], "output": [ "BOS", 0.5555555555555556, 0.5555555555555556, 0.5555555555555556, 0.4444444444444444, 0.5555555555555556, 0.4444444444444444, 0.4444444444444444, 0.5555555555555556, 0.4444444444444444 ] }, { "input": [ "BOS", "c", "c", "c", "a", "c", "b", "a", "b", "b" ], "output": [ "BOS", 0.4444444444444444, 0.4444444444444444, 0.4444444444444444, 0.2222222222222222, 0.4444444444444444, 0.3333333333333333, 0.2222222222222222, 0.3333333333333333, 0.3333333333333333 ] } ], "is_categorical": true }, "program": "normalized_freq = rasp.SequenceMap(lambda x, y: (x / y) if y > 0 else None, make_hist(), make_length())\nreturn normalized_freq", "components": [ { "id": "L0H0_ATTN", "hook": "blocks.0.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Builds the token-matching pattern used to count how often each token appears." }, "rasp_vars": [ "same_tok" ], "labels": [ "hist_2_selector_width_attn_output" ] }, { "id": "L0H1_ATTN", "hook": "blocks.0.attn.hook_result[1]", "role": { "tag": "AGGREGATOR", "note": "Builds the all-positions pattern used to compute the sequence length." }, "rasp_vars": [ "all_true_selector" ], "labels": [ "length_3_selector_width_attn_output" ] }, { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Post-processes the two attention outputs into usable per-position features of token frequency count and sequence length." }, "rasp_vars": [ "hist", "length" ], "labels": [ "hist_2", "length_3", "hist_2_selector_width_attn_output", "length_3_selector_width_attn_output" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Combines the per-token frequency with the sequence length to output normalized frequencies in the 0-1 range." }, "rasp_vars": [ "normalized_freq" ], "labels": [ "sequence_map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_26", "name": "token_cascade", "summary": "Creates a cascading effect by repeating each token in sequence incrementally.", "examples": [ { "input": [ "BOS", "b", "b", "a", "a", "b", "b", "a", "a", "a" ], "output": [ "BOS", "b", "bb", "aaa", "aaaa", "bbbbb", "bbbbbb", "aaaaaaa", "aaaaaaaa", "aaaaaaaaa" ] }, { "input": [ "BOS", "c", "c", "a", "c", "a", "c", "c", "a", "a" ], "output": [ "BOS", "c", "cc", "aaa", "cccc", "aaaaa", "cccccc", "ccccccc", "aaaaaaaa", "aaaaaaaaa" ] }, { "input": [ "BOS", "c", "a", "c", "c", "a", "a", "c", "b", "c" ], "output": [ "BOS", "c", "aa", "ccc", "cccc", "aaaaa", "aaaaaa", "ccccccc", "bbbbbbbb", "ccccccccc" ] }, { "input": [ "BOS", "c", "c", "c", "b", "c", "b", "b", "c", "b" ], "output": [ "BOS", "c", "cc", "ccc", "bbbb", "ccccc", "bbbbbb", "bbbbbbb", "cccccccc", "bbbbbbbbb" ] }, { "input": [ "BOS", "c", "c", "c", "a", "c", "b", "a", "b", "b" ], "output": [ "BOS", "c", "cc", "ccc", "aaaa", "ccccc", "bbbbbb", "aaaaaaa", "bbbbbbbb", "bbbbbbbbb" ] } ], "is_categorical": true }, "program": "cascade_sop = rasp.SequenceMap(lambda x, i: x * (i + 1), sop, rasp.indices)\nreturn cascade_sop", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Combines each token with its position index to repeat the token an increasing number of times across the sequence." }, "rasp_vars": [ "cascade_sop" ], "labels": [ "sequence_map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_29", "name": "token_abbreviation", "summary": "Creates abbreviations for each token in the sequence.", "examples": [ { "input": [ "BOS", "oCLrZaW", "V", "b", "oCLrZaW", "TPSI", "poiVg", "b", "b", "oCLrZaW" ], "output": [ "BOS", "oCL", "V", "b", "oCL", "TPS", "poi", "b", "b", "oCL" ] }, { "input": [ "BOS", "LB", "TPSI", "oCLrZaW", "TPSI", "TPSI", "poiVg", "b", "V", "poiVg" ], "output": [ "BOS", "LB", "TPS", "oCL", "TPS", "TPS", "poi", "b", "V", "poi" ] }, { "input": [ "BOS", "poiVg", "TPSI", "no", "b", "LB", "poiVg", "V", "no", "no" ], "output": [ "BOS", "poi", "TPS", "no", "b", "LB", "poi", "V", "no", "no" ] }, { "input": [ "BOS", "V", "J", "J", "TPSI", "TPSI", "oCLrZaW", "LB", "poiVg", "V" ], "output": [ "BOS", "V", "J", "J", "TPS", "TPS", "oCL", "LB", "poi", "V" ] }, { "input": [ "BOS", "LB", "poiVg", "V", "b", "J", "V", "LB", "no", "b" ], "output": [ "BOS", "LB", "poi", "V", "b", "J", "V", "LB", "no", "b" ] } ], "is_categorical": true }, "program": "abbreviation = rasp.Map(lambda x: x[:3] if len(x) > 3 else x, sop); return abbreviation", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Applies elementwise abbreviation rule, truncates to first 3 chars if len>3, else keeps token." }, "rasp_vars": [ "abbreviation" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122{ "task": { "id": "case_3", "name": "frac_prevs", "summary": "Returns the fraction of 'x' in the input up to the i-th position for all i.", "examples": [ { "input": [ "BOS", "c", "x", "a", "c" ], "output": [ "BOS", 0.0, 0.5, 0.3333333333333333, 0.25 ] }, { "input": [ "BOS", "c", "b", "c", "c" ], "output": [ "BOS", 0.0, 0.0, 0.0, 0.0 ] }, { "input": [ "BOS", "c", "c", "x", "a" ], "output": [ "BOS", 0.0, 0.0, 0.3333333333333333, 0.25 ] }, { "input": [ "BOS", "c", "x", "a", "a" ], "output": [ "BOS", 0.0, 0.5, 0.3333333333333333, 0.25 ] }, { "input": [ "BOS", "x", "x", "x", "c" ], "output": [ "BOS", 1.0, 1.0, 1.0, 0.75 ] } ], "is_categorical": false }, "program": "is_x = (rasp.tokens == \"x\").named(\"is_x\"); bools = rasp.numerical(is_x); prevs = rasp.Select(rasp.indices, rasp.indices, rasp.Comparison.LEQ); return rasp.numerical(rasp.Aggregate(prevs, bools, default=0)).named(\"frac_prevs\")", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "INDICATOR", "note": "Computes per-position feature indicating whether the token at that position is 'x' or not." }, "rasp_vars": [ "is_x" ], "labels": [ "is_x_3" ] }, { "id": "L1H2_ATTN", "hook": "blocks.1.attn.hook_result[2]", "role": { "tag": "AGGREGATOR", "note": "Aggregates prefix fraction by attending over previous positions." }, "rasp_vars": [ "prevs", "frac_prevs" ], "labels": [ "frac_prevs_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_30", "name": "numeric_range_tagging", "summary": "Tags numeric tokens in a sequence based on whether they fall within a given range.", "examples": [ { "input": [ "BOS", "14", "26", "8", "21", "18", "15", "8", "27", "14" ], "output": [ "BOS", true, false, false, false, true, true, false, false, true ] }, { "input": [ "BOS", "5", "25", "29", "18", "18", "3", "27", "11", "15" ], "output": [ "BOS", false, false, false, true, true, false, false, true, true ] }, { "input": [ "BOS", "4", "23", "6", "6", "17", "7", "7", "22", "21" ], "output": [ "BOS", false, false, false, false, true, false, false, false, false ] }, { "input": [ "BOS", "1", "7", "27", "0", "19", "5", "28", "8", "19" ], "output": [ "BOS", false, false, false, false, true, false, false, false, true ] }, { "input": [ "BOS", "3", "10", "28", "27", "1", "3", "19", "9", "13" ], "output": [ "BOS", false, true, false, false, false, false, true, false, true ] } ], "is_categorical": true }, "program": "range_tagging = rasp.Map(lambda x: lower_bound <= int(x) <= upper_bound if x.isdigit() else False, sop)\nreturn range_tagging", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "INDICATOR", "note": "Applies a per-token range test and outputs a boolean tag for each position." }, "rasp_vars": [ "range_tagging" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_31", "name": "token_anagram_identifier", "summary": "Identify if tokens in the sequence are anagrams of the word 'listen'.", "examples": [ { "input": [ "BOS", "V", "poiVg", "LB", "poiVg", "b", "LB", "V", "no", "oCLrZaW" ], "output": [ "BOS", false, false, false, false, false, false, false, false, false ] }, { "input": [ "BOS", "poiVg", "TPSI", "b", "TPSI", "no", "b", "poiVg", "no", "LB" ], "output": [ "BOS", false, false, false, false, false, false, false, false, false ] }, { "input": [ "BOS", "no", "V", "oCLrZaW", "b", "no", "TPSI", "no", "oCLrZaW", "b" ], "output": [ "BOS", false, false, false, false, false, false, false, false, false ] }, { "input": [ "BOS", "V", "oCLrZaW", "oCLrZaW", "TPSI", "listen", "b", "LB", "oCLrZaW", "listen" ], "output": [ "BOS", false, false, false, false, true, false, false, false, true ] }, { "input": [ "BOS", "LB", "b", "J", "listen", "poiVg", "J", "TPSI", "no", "V" ], "output": [ "BOS", false, false, false, true, false, false, false, false, false ] } ], "is_categorical": true }, "program": "sorted_target = sorted(target)\nanagram_identifier = rasp.Map(lambda x: sorted(x) == sorted_target, sop)\nreturn anagram_identifier", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "INDICATOR", "note": "Checks each token against the target anagram condition and outputs a boolean." }, "rasp_vars": [ "anagram_identifier" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_33", "name": "token_length_parity", "summary": "Checks if each token's length is odd or even.", "examples": [ { "input": [ "BOS", "oCLrZaW", "V", "b", "oCLrZaW", "TPSI", "poiVg", "b", "b", "oCLrZaW" ], "output": [ "BOS", false, false, false, false, true, false, false, false, false ] }, { "input": [ "BOS", "LB", "TPSI", "oCLrZaW", "TPSI", "TPSI", "poiVg", "b", "V", "poiVg" ], "output": [ "BOS", true, true, false, true, true, false, false, false, false ] }, { "input": [ "BOS", "poiVg", "TPSI", "no", "b", "LB", "poiVg", "V", "no", "no" ], "output": [ "BOS", false, true, true, false, true, false, false, true, true ] }, { "input": [ "BOS", "V", "J", "J", "TPSI", "TPSI", "oCLrZaW", "LB", "poiVg", "V" ], "output": [ "BOS", false, false, false, true, true, false, true, false, false ] }, { "input": [ "BOS", "LB", "poiVg", "V", "b", "J", "V", "LB", "no", "b" ], "output": [ "BOS", true, false, false, false, false, false, true, true, false ] } ], "is_categorical": true }, "program": "length_parity_checker = rasp.Map(lambda x: len(x) % 2 == 0, sop)\nreturn length_parity_checker", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Computes a boolean per token indicating whether its length is even." }, "rasp_vars": [ "length_parity_checker" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_34", "name": "vowel_consonant_ratio", "summary": "Calculate the ratio of vowels to consonants in each word.", "examples": [ { "input": [ "BOS", "oCLrZaW", "V", "b", "oCLrZaW", "TPSI", "poiVg", "b", "b", "oCLrZaW" ], "output": [ "BOS", 0.4, 0.0, 0.0, 0.4, 0.3333333333333333, 0.6666666666666666, 0.0, 0.0, 0.4 ] }, { "input": [ "BOS", "LB", "TPSI", "oCLrZaW", "TPSI", "TPSI", "poiVg", "b", "V", "poiVg" ], "output": [ "BOS", 0.0, 0.3333333333333333, 0.4, 0.3333333333333333, 0.3333333333333333, 0.6666666666666666, 0.0, 0.0, 0.6666666666666666 ] }, { "input": [ "BOS", "poiVg", "TPSI", "no", "b", "LB", "poiVg", "V", "no", "no" ], "output": [ "BOS", 0.6666666666666666, 0.3333333333333333, 1.0, 0.0, 0.0, 0.6666666666666666, 0.0, 1.0, 1.0 ] }, { "input": [ "BOS", "V", "J", "J", "TPSI", "TPSI", "oCLrZaW", "LB", "poiVg", "V" ], "output": [ "BOS", 0.0, 0.0, 0.0, 0.3333333333333333, 0.3333333333333333, 0.4, 0.0, 0.6666666666666666, 0.0 ] }, { "input": [ "BOS", "LB", "poiVg", "V", "b", "J", "V", "LB", "no", "b" ], "output": [ "BOS", 0.0, 0.6666666666666666, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 ] } ], "is_categorical": true }, "program": "ratio_calculator = rasp.Map(calc_ratio, sop)\nreturn ratio_calculator", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Computes, for each token, the vowel-to-consonant ratio (with an infinity output when there are no consonants)." }, "rasp_vars": [ "ratio_calculator" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_35", "name": "token_capitalization_alternator", "summary": "Alternates capitalization of each character in words.", "examples": [ { "input": [ "BOS", "oCLrZaW", "V", "b", "oCLrZaW", "TPSI", "poiVg", "b", "b", "oCLrZaW" ], "output": [ "BOS", "OcLrZaW", "V", "B", "OcLrZaW", "TpSi", "PoIvG", "B", "B", "OcLrZaW" ] }, { "input": [ "BOS", "LB", "TPSI", "oCLrZaW", "TPSI", "TPSI", "poiVg", "b", "V", "poiVg" ], "output": [ "BOS", "Lb", "TpSi", "OcLrZaW", "TpSi", "TpSi", "PoIvG", "B", "V", "PoIvG" ] }, { "input": [ "BOS", "poiVg", "TPSI", "no", "b", "LB", "poiVg", "V", "no", "no" ], "output": [ "BOS", "PoIvG", "TpSi", "No", "B", "Lb", "PoIvG", "V", "No", "No" ] }, { "input": [ "BOS", "V", "J", "J", "TPSI", "TPSI", "oCLrZaW", "LB", "poiVg", "V" ], "output": [ "BOS", "V", "J", "J", "TpSi", "TpSi", "OcLrZaW", "Lb", "PoIvG", "V" ] }, { "input": [ "BOS", "LB", "poiVg", "V", "b", "J", "V", "LB", "no", "b" ], "output": [ "BOS", "Lb", "PoIvG", "V", "B", "J", "V", "Lb", "No", "B" ] } ], "is_categorical": true }, "program": "def alternate_capitalization(word):\n return ''.join(c.upper() if i % 2 == 0 else c.lower() for i, c in enumerate(word))\n\nalternator = rasp.Map(alternate_capitalization, sop)\nreturn alternator", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Transforms each token independently by applying a consistent per-character formatting rule." }, "rasp_vars": [ "alternator" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_36", "name": "emoji_sentiment_classifier", "summary": "Classifies each token as 'positive', 'negative', or 'neutral' based on emojis.", "examples": [ { "input": [ "BOS", "😊", "😊", "📘", "📘", "😊", "😊", "📘", "📘", "📘" ], "output": [ "BOS", "positive", "positive", "neutral", "neutral", "positive", "positive", "neutral", "neutral", "neutral" ] }, { "input": [ "BOS", "😢", "😢", "📘", "😢", "📘", "😢", "😢", "📘", "📘" ], "output": [ "BOS", "negative", "negative", "neutral", "negative", "neutral", "negative", "negative", "neutral", "neutral" ] }, { "input": [ "BOS", "😢", "📘", "😢", "😢", "📘", "📘", "😢", "😊", "😢" ], "output": [ "BOS", "negative", "neutral", "negative", "negative", "neutral", "neutral", "negative", "positive", "negative" ] }, { "input": [ "BOS", "😢", "😢", "😢", "😊", "😢", "😊", "😊", "😢", "😊" ], "output": [ "BOS", "negative", "negative", "negative", "positive", "negative", "positive", "positive", "negative", "positive" ] }, { "input": [ "BOS", "😢", "😢", "😢", "📘", "😢", "😊", "📘", "😊", "😊" ], "output": [ "BOS", "negative", "negative", "negative", "neutral", "negative", "positive", "neutral", "positive", "positive" ] } ], "is_categorical": true }, "program": "emoji_sentiments = {\"😊\": \"positive\", \"😢\": \"negative\", \"📘\": \"neutral\"}\nclassify_sentiment = rasp.Map(lambda x: emoji_sentiments.get(x, \"neutral\"), sop)\nreturn classify_sentiment", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Assigns a category to each token using a fixed lookup rule." }, "rasp_vars": [ "classify_sentiment" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_37", "name": "token_reversal_with_exclusion", "summary": "Reverses each word in the sequence except for specified exclusions.", "examples": [ { "input": [ "BOS", "oCLrZaW", "V", "b", "oCLrZaW", "TPSI", "poiVg", "b", "b", "oCLrZaW" ], "output": [ "BOS", "WaZrLCo", "V", "b", "WaZrLCo", "ISPT", "gViop", "b", "b", "WaZrLCo" ] }, { "input": [ "BOS", "LB", "TPSI", "oCLrZaW", "TPSI", "TPSI", "poiVg", "b", "V", "poiVg" ], "output": [ "BOS", "BL", "ISPT", "WaZrLCo", "ISPT", "ISPT", "gViop", "b", "V", "gViop" ] }, { "input": [ "BOS", "poiVg", "TPSI", "no", "b", "LB", "poiVg", "V", "no", "no" ], "output": [ "BOS", "gViop", "ISPT", "on", "b", "BL", "gViop", "V", "on", "on" ] }, { "input": [ "BOS", "V", "J", "J", "TPSI", "TPSI", "oCLrZaW", "LB", "poiVg", "V" ], "output": [ "BOS", "V", "J", "J", "ISPT", "ISPT", "WaZrLCo", "BL", "gViop", "V" ] }, { "input": [ "BOS", "LB", "poiVg", "V", "b", "J", "V", "LB", "no", "b" ], "output": [ "BOS", "BL", "gViop", "V", "b", "J", "V", "BL", "on", "b" ] } ], "is_categorical": true }, "program": "reversal = rasp.Map(lambda x: x[::-1] if x != exclude else x, sop)\nreturn reversal", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Reverses each token unless it matches the excluded token, in which case it is passed through unchanged." }, "rasp_vars": [ "reversal" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671{ "task": { "id": "case_39", "name": "frac_prevs_long", "summary": "Returns the fraction of 'x' in the input up to the i-th position for all i (longer sequence length).", "examples": [ { "input": [ "BOS", "t", "o", "g", "l", "h", "o", "c", "n", "q", "d", "r", "h", "d", "b", "f", "v", "j", "d", "v", "r", "z", "l", "b", "j", "d", "n", "p", "o", "h", "n", "w", "y", "h", "u", "p", "m", "r", "o", "u", "x", "z", "y", "m", "i", "o", "m", "a", "y", "g", "i", "x", "a", "l", "h", "x", "k", "s", "q", "h" ], "output": [ "BOS", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.025, 0.024390243902439025, 0.023809523809523808, 0.023255813953488372, 0.022727272727272728, 0.022222222222222223, 0.021739130434782608, 0.02127659574468085, 0.020833333333333332, 0.02040816326530612, 0.02, 0.0392156862745098, 0.038461538461538464, 0.03773584905660377, 0.037037037037037035, 0.05454545454545454, 0.05357142857142857, 0.05263157894736842, 0.05172413793103448, 0.05084745762711865 ] }, { "input": [ "BOS", "j", "m", "y", "u", "f", "l", "l", "t", "k", "z", "w", "y", "g", "a", "a", "y", "y", "t", "m", "i", "c", "g", "f", "h", "i", "e", "a", "s", "j", "l", "x", "o", "v", "x", "i", "t", "q", "q", "z", "t", "l", "g", "b", "c", "q", "e", "q", "x", "q", "q", "b", "b", "v", "w", "e", "a", "a", "s", "b" ], "output": [ "BOS", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.03225806451612903, 0.03125, 0.030303030303030304, 0.058823529411764705, 0.05714285714285714, 0.05555555555555555, 0.05405405405405406, 0.05263157894736842, 0.05128205128205128, 0.05, 0.04878048780487805, 0.047619047619047616, 0.046511627906976744, 0.045454545454545456, 0.044444444444444446, 0.043478260869565216, 0.0425531914893617, 0.0625, 0.061224489795918366, 0.06, 0.058823529411764705, 0.057692307692307696, 0.05660377358490566, 0.05555555555555555, 0.05454545454545454, 0.05357142857142857, 0.05263157894736842, 0.05172413793103448, 0.05084745762711865 ] }, { "input": [ "BOS", "c", "c", "a", "e", "j", "g", "z", "i", "g", "i", "h", "l", "b", "a", "p", "w", "w", "x", "e", "c", "l", "h", "v", "c", "a", "c", "e", "o", "n", "c", "a", "e", "z", "w", "n", "g", "i", "o", "o", "z", "j", "m", "s", "g", "q", "t", "d", "e", "w", "g", "m", "o", "k", "d", "m", "g", "s", "v", "b" ], "output": [ "BOS", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.05555555555555555, 0.05263157894736842, 0.05, 0.047619047619047616, 0.045454545454545456, 0.043478260869565216, 0.041666666666666664, 0.04, 0.038461538461538464, 0.037037037037037035, 0.03571428571428571, 0.034482758620689655, 0.03333333333333333, 0.03225806451612903, 0.03125, 0.030303030303030304, 0.029411764705882353, 0.02857142857142857, 0.027777777777777776, 0.02702702702702703, 0.02631578947368421, 0.02564102564102564, 0.025, 0.024390243902439025, 0.023809523809523808, 0.023255813953488372, 0.022727272727272728, 0.022222222222222223, 0.021739130434782608, 0.02127659574468085, 0.020833333333333332, 0.02040816326530612, 0.02, 0.0196078431372549, 0.019230769230769232, 0.018867924528301886, 0.018518518518518517, 0.01818181818181818, 0.017857142857142856, 0.017543859649122806, 0.017241379310344827, 0.01694915254237288 ] }, { "input": [ "BOS", "g", "t", "o", "k", "h", "u", "g", "z", "s", "w", "k", "k", "x", "u", "d", "h", "x", "c", "v", "u", "b", "x", "l", "f", "b", "u", "a", "l", "z", "v", "l", "y", "q", "j", "p", "o", "o", "s", "l", "w", "t", "y", "c", "e", "s", "g", "u", "i", "g", "r", "d", "y", "n", "r", "z", "i", "z", "u", "b" ], "output": [ "BOS", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.07692307692307693, 0.07142857142857142, 0.06666666666666667, 0.0625, 0.11764705882352941, 0.1111111111111111, 0.10526315789473684, 0.1, 0.09523809523809523, 0.13636363636363635, 0.13043478260869565, 0.125, 0.12, 0.11538461538461539, 0.1111111111111111, 0.10714285714285714, 0.10344827586206896, 0.1, 0.0967741935483871, 0.09375, 0.09090909090909091, 0.08823529411764706, 0.08571428571428572, 0.08333333333333333, 0.08108108108108109, 0.07894736842105263, 0.07692307692307693, 0.075, 0.07317073170731707, 0.07142857142857142, 0.06976744186046512, 0.06818181818181818, 0.06666666666666667, 0.06521739130434782, 0.06382978723404255, 0.0625, 0.061224489795918366, 0.06, 0.058823529411764705, 0.057692307692307696, 0.05660377358490566, 0.05555555555555555, 0.05454545454545454, 0.05357142857142857, 0.05263157894736842, 0.05172413793103448, 0.05084745762711865 ] }, { "input": [ "BOS", "u", "l", "z", "f", "w", "d", "w", "k", "x", "q", "f", "x", "e", "t", "b", "f", "v", "k", "p", "p", "a", "i", "f", "p", "c", "t", "d", "s", "z", "c", "s", "t", "g", "t", "i", "a", "h", "g", "r", "h", "a", "k", "y", "y", "r", "w", "j", "c", "g", "p", "z", "p", "y", "t", "q", "b", "a", "p", "l" ], "output": [ "BOS", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1111111111111111, 0.1, 0.09090909090909091, 0.16666666666666666, 0.15384615384615385, 0.14285714285714285, 0.13333333333333333, 0.125, 0.11764705882352941, 0.1111111111111111, 0.10526315789473684, 0.1, 0.09523809523809523, 0.09090909090909091, 0.08695652173913043, 0.08333333333333333, 0.08, 0.07692307692307693, 0.07407407407407407, 0.07142857142857142, 0.06896551724137931, 0.06666666666666667, 0.06451612903225806, 0.0625, 0.06060606060606061, 0.058823529411764705, 0.05714285714285714, 0.05555555555555555, 0.05405405405405406, 0.05263157894736842, 0.05128205128205128, 0.05, 0.04878048780487805, 0.047619047619047616, 0.046511627906976744, 0.045454545454545456, 0.044444444444444446, 0.043478260869565216, 0.0425531914893617, 0.041666666666666664, 0.04081632653061224, 0.04, 0.0392156862745098, 0.038461538461538464, 0.03773584905660377, 0.037037037037037035, 0.03636363636363636, 0.03571428571428571, 0.03508771929824561, 0.034482758620689655, 0.03389830508474576 ] } ], "is_categorical": false }, "program": "is_x = (rasp.tokens == \"x\").named(\"is_x\")\nbools = rasp.numerical(is_x); prevs = rasp.Select(rasp.indices, rasp.indices, rasp.Comparison.LEQ); return rasp.numerical(rasp.Aggregate(prevs, bools, default=0)).named(\"frac_prevs\")", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "INDICATOR", "note": "Computes a per-position boolean feature indicating whether the current token is 'x'." }, "rasp_vars": [ "is_x" ], "labels": [ "is_x_3" ] }, { "id": "L1H0_ATTN", "hook": "blocks.1.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Aggregates the prefix of the sequence to produce the running fraction of 'x' up to each position." }, "rasp_vars": [ "frac_prevs" ], "labels": [ "frac_prevs_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188{ "task": { "id": "case_4", "name": "pair_balance", "summary": "Return fraction of previous open tokens minus the fraction of close tokens.", "examples": [ { "input": [ "BOS", "(", "b", ")", "c", "b", "(", "(", "a", "a" ], "output": [ "BOS", 1.0, 0.5, 0.0, 0.0, 0.0, 0.16666666666666666, 0.2857142857142857, 0.25, 0.2222222222222222 ] }, { "input": [ "BOS", ")", "b", "b", "a", "b", "b", "(", "a", "c" ], "output": [ "BOS", -1.0, -0.5, -0.3333333333333333, -0.25, -0.2, -0.16666666666666666, 0.0, 0.0, 0.0 ] }, { "input": [ "BOS", "a", "c", "(", ")", "b", "(", "b", ")", ")" ], "output": [ "BOS", 0.0, 0.0, 0.3333333333333333, 0.0, 0.0, 0.16666666666666666, 0.14285714285714285, 0.0, -0.1111111111111111 ] }, { "input": [ "BOS", "c", "b", "a", "c", ")", "b", ")", "b", "c" ], "output": [ "BOS", 0.0, 0.0, 0.0, 0.0, -0.2, -0.16666666666666666, -0.2857142857142857, -0.25, -0.2222222222222222 ] }, { "input": [ "BOS", "b", "c", "a", "c", "c", ")", "a", "a", "a" ], "output": [ "BOS", 0.0, 0.0, 0.0, 0.0, 0.0, -0.16666666666666666, -0.14285714285714285, -0.125, -0.1111111111111111 ] } ], "is_categorical": false }, "program": "bools_open = rasp.numerical(sop == open_token).named(\"bools_open\"); opens = rasp.numerical(make_frac_prevs(bools_open)).named(\"opens\"); bools_close = rasp.numerical(sop == close_token).named(\"bools_close\"); closes = rasp.numerical(make_frac_prevs(bools_close)).named(\"closes\"); pair_balance = rasp.numerical(rasp.LinearSequenceMap(opens, closes, 1, -1)); return pair_balance.named(\"pair_balance\")", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "INDICATOR", "note": "Computes per-token indicator features for open and close tokens." }, "rasp_vars": [ "bools_open", "bools_close" ] }, { "id": "L1H0_ATTN", "hook": "blocks.1.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Computes prefix aggregate for opens (fraction/count up to i) by attending over previous positions and reading the open-indicator via values." }, "rasp_vars": [ "opens" ] }, { "id": "L1H1_ATTN", "hook": "blocks.1.attn.hook_result[1]", "role": { "tag": "AGGREGATOR", "note": "Computes prefix aggregate for closes (fraction/count up to i) by attending over previous positions and reading the close-indicator via values." }, "rasp_vars": [ "closes" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Combines the open and close aggregates to compute the final balanced pair output." }, "rasp_vars": [ "pair_balance" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171{ "task": { "id": "case_40", "name": "sum_last_two_digits", "summary": "Sum the last and previous to last digits of a number", "examples": [ { "input": [ "BOS", 6, 19, 28, 14, 10, 7, 28, 20, 6 ], "output": [ "BOS", 6, 10, 10, 5, 1, 7, 10, 2, 6 ] }, { "input": [ "BOS", 25, 18, 22, 10, 10, 23, 20, 3, 7 ], "output": [ "BOS", 7, 9, 4, 1, 1, 5, 2, 3, 7 ] }, { "input": [ "BOS", 16, 26, 26, 9, 27, 27, 15, 14, 14 ], "output": [ "BOS", 7, 8, 8, 9, 9, 9, 6, 5, 5 ] }, { "input": [ "BOS", 27, 20, 0, 11, 25, 21, 28, 11, 24 ], "output": [ "BOS", 9, 2, 0, 2, 7, 3, 10, 2, 6 ] }, { "input": [ "BOS", 23, 2, 21, 20, 1, 23, 11, 5, 1 ], "output": [ "BOS", 5, 2, 3, 2, 1, 5, 2, 5, 1 ] } ], "is_categorical": true }, "program": "tens_place = rasp.Map(lambda x: x // 10, rasp.tokens).named(\"tens_place\")\nones_place = rasp.Map(lambda x: x % 10, rasp.tokens).named(\"ones_place\")\nsum_digits = rasp.SequenceMap(lambda x, y: x + y, tens_place, ones_place).named(\"sum_digits\")\nreturn sum_digits", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Derives the tens-place digit and also the ones-place digit from each input number." }, "rasp_vars": [ "tens_place, ones_place" ], "labels": [ "tens_place_2, ones_place_3" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Adds the tens-place and ones-place digits to produce the final per-token output." }, "rasp_vars": [ "sum_digits" ], "labels": [ "sum_digits_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_41", "name": "make_absolute", "summary": "Make each element of the input sequence absolute.", "examples": [ { "input": [ "BOS", 7, -2, -9, 9, 4, -4, 1, -3, 4 ], "output": [ "BOS", 7, 2, 9, 9, 4, 4, 1, 3, 4 ] }, { "input": [ "BOS", -8, -6, 8, -4, -2, -4, 7, -7, 3 ], "output": [ "BOS", 8, 6, 8, 4, 2, 4, 7, 7, 3 ] }, { "input": [ "BOS", -4, 9, 4, 0, -3, -4, 8, 0, 0 ], "output": [ "BOS", 4, 9, 4, 0, 3, 4, 8, 0, 0 ] }, { "input": [ "BOS", -7, -3, -8, -9, 1, -5, -9, -10, 1 ], "output": [ "BOS", 7, 3, 8, 9, 1, 5, 9, 10, 1 ] }, { "input": [ "BOS", 1, 6, -1, 5, 4, 4, 8, 1, 9 ], "output": [ "BOS", 1, 6, 1, 5, 4, 4, 8, 1, 9 ] } ], "is_categorical": true }, "program": "return rasp.Map(lambda x: x if x >= 0 else -x, rasp.tokens).named(\"make_absolute\")", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Applies an element-wise absolute-value transform to each input number." }, "rasp_vars": [ "make_absolute" ], "labels": [ "make_absolute_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_43", "name": "nth_fibonacci", "summary": "Returns the corresponding Fibonacci number for each element in the input sequence.", "examples": [ { "input": [ "BOS", 17, 8, 1, 19, 14, 6, 11, 7, 14 ], "output": [ "BOS", 1597, 21, 1, 4181, 377, 8, 89, 13, 377 ] }, { "input": [ "BOS", 2, 4, 18, 6, 8, 6, 17, 3, 13 ], "output": [ "BOS", 1, 3, 2584, 8, 21, 8, 1597, 2, 233 ] }, { "input": [ "BOS", 6, 19, 14, 10, 7, 6, 18, 10, 10 ], "output": [ "BOS", 8, 4181, 377, 55, 13, 8, 2584, 55, 55 ] }, { "input": [ "BOS", 3, 7, 2, 1, 11, 5, 1, 0, 11 ], "output": [ "BOS", 2, 13, 1, 1, 89, 5, 1, 0, 89 ] }, { "input": [ "BOS", 11, 16, 9, 15, 14, 14, 18, 11, 19 ], "output": [ "BOS", 89, 987, 34, 610, 377, 377, 2584, 89, 4181 ] } ], "is_categorical": true }, "program": "fib_sequence = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765]\nnth_fib = rasp.Map(lambda x: fib_sequence[x] if x < len(fib_sequence) else 0, rasp.tokens).named(\"nth_fib\")\nreturn nth_fib", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Maps each input index to its corresponding Fibonacci value using a fixed lookup table." }, "rasp_vars": [ "nth_fib" ], "labels": [ "nth_fib_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172{ "task": { "id": "case_44", "name": "count_greater_than", "summary": "Replaces each element with the number of elements greater than it in the sequence", "examples": [ { "input": [ "BOS", 2, 4, 2, 6, 4, 8, 6, 1, 3 ], "output": [ "BOS", 6, 3, 6, 1, 3, 0, 1, 8, 5 ] }, { "input": [ "BOS", 4, 1, 7, 5, 1, 4, 0, 9, 5 ], "output": [ "BOS", 4, 6, 1, 2, 6, 4, 8, 0, 2 ] }, { "input": [ "BOS", 10, 10, 7, 4, 3, 7, 7, 2, 5 ], "output": [ "BOS", 0, 0, 2, 6, 7, 2, 2, 8, 5 ] }, { "input": [ "BOS", 8, 0, 10, 10, 9, 2, 6, 3, 8 ], "output": [ "BOS", 3, 8, 0, 0, 2, 7, 5, 6, 3 ] }, { "input": [ "BOS", 6, 3, 10, 7, 4, 6, 9, 2, 6 ], "output": [ "BOS", 3, 7, 0, 2, 6, 3, 1, 8, 3 ] } ], "is_categorical": true }, "program": "greater_than_selector = rasp.Select(rasp.tokens, rasp.tokens, rasp.Comparison.GT).named(\"greater_than_selector\")\ncount_greater_than = rasp.SelectorWidth(greater_than_selector).named(\"count_greater_than\")\nreturn count_greater_than", "components": [ { "id": "L0H0_ATTN", "hook": "blocks.0.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Attends to all positions whose token value is greater than the current position's token and produces a count of those matches" }, "rasp_vars": [ "greater_than_selector" ], "labels": [ "count_greater_than_1_selector_width_attn_output" ] }, { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Converts the aggregated attention signal into per-position counts of how many elements are greater." }, "rasp_vars": [ "count_greater_than" ], "labels": [ "count_greater_than_1", "count_greater_than_1_selector_width_attn_output" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200{ "task": { "id": "case_45", "name": "double_first_half", "summary": "Doubles the first half of the sequence", "examples": [ { "input": [ "BOS", 2, 4, 2, 6, 4, 8, 6, 1, 3 ], "output": [ "BOS", 4, 8, 4, 12, 8, 8, 6, 1, 3 ] }, { "input": [ "BOS", 4, 1, 7, 5, 1, 4, 0, 9, 5 ], "output": [ "BOS", 8, 2, 14, 10, 2, 4, 0, 9, 5 ] }, { "input": [ "BOS", 10, 10, 7, 4, 3, 7, 7, 2, 5 ], "output": [ "BOS", 20, 20, 14, 8, 6, 7, 7, 2, 5 ] }, { "input": [ "BOS", 8, 0, 10, 10, 9, 2, 6, 3, 8 ], "output": [ "BOS", 16, 0, 20, 20, 18, 2, 6, 3, 8 ] }, { "input": [ "BOS", 6, 3, 10, 7, 4, 6, 9, 2, 6 ], "output": [ "BOS", 12, 6, 20, 14, 8, 6, 9, 2, 6 ] } ], "is_categorical": true }, "program": "length = rasp.SelectorWidth(rasp.Select(rasp.tokens, rasp.tokens, rasp.Comparison.TRUE)).named(\"length\")\nfirst_half_selector = rasp.SequenceMap(lambda idx, length: 1 if idx < length / 2 else 0, rasp.indices, length).named(\"first_half_selector\")\ndouble_first_half = rasp.SequenceMap(lambda x, sel: x * (1 + sel), rasp.tokens, first_half_selector).named(\"double_first_half\")\nreturn double_first_half", "components": [ { "id": "L0H0_ATTN", "hook": "blocks.0.attn.hook_result[0]", "role": { "tag": "AGGREGATOR", "note": "Produces a sequence-length signal by counting tokens via the attention output width." }, "rasp_vars": [ "length_helper" ], "labels": [ "length_3_selector_width_attn_output" ] }, { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Computes the sequence length feature used to split the sequence into halves." }, "rasp_vars": [ "length" ], "labels": [ "length_3", "length_3_selector_width_attn_output" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Builds a per-position mask indicating whether the position is in the first half." }, "rasp_vars": [ "first_half_selector" ], "labels": [ "first_half_selector_2" ] }, { "id": "L2_MLP", "hook": "blocks.2.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Conditionally doubles elements in the first half using the first-half mask." }, "rasp_vars": [ "double_first_half" ], "labels": [ "double_first_half_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_46", "name": "decrement_by_1", "summary": "Decrements each element in the sequence by 1.", "examples": [ { "input": [ "BOS", 2, 4, 2, 6, 4, 8, 6, 1, 3 ], "output": [ "BOS", 1, 3, 1, 5, 3, 7, 5, 0, 2 ] }, { "input": [ "BOS", 4, 1, 7, 5, 1, 4, 0, 9, 5 ], "output": [ "BOS", 3, 0, 6, 4, 0, 3, -1, 8, 4 ] }, { "input": [ "BOS", 10, 10, 7, 4, 3, 7, 7, 2, 5 ], "output": [ "BOS", 9, 9, 6, 3, 2, 6, 6, 1, 4 ] }, { "input": [ "BOS", 8, 0, 10, 10, 9, 2, 6, 3, 8 ], "output": [ "BOS", 7, -1, 9, 9, 8, 1, 5, 2, 7 ] }, { "input": [ "BOS", 6, 3, 10, 7, 4, 6, 9, 2, 6 ], "output": [ "BOS", 5, 2, 9, 6, 3, 5, 8, 1, 5 ] } ], "is_categorical": true }, "program": "return rasp.Map(lambda x: x - 1, rasp.tokens).named('decrement')", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Adjusts each value by a fixed amount (subtracting 1) across the entire sequence." }, "rasp_vars": [ "decrement" ], "labels": [ "decrement_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_49", "name": "decrement_to_multiple_of_three", "summary": "Decrements each element in the sequence until it becomes a multiple of 3.", "examples": [ { "input": [ "BOS", 2, 4, 2, 6, 4, 8, 6, 1, 3 ], "output": [ "BOS", 0, 3, 0, 6, 3, 6, 6, 0, 3 ] }, { "input": [ "BOS", 4, 1, 7, 5, 1, 4, 0, 9, 5 ], "output": [ "BOS", 3, 0, 6, 3, 0, 3, 0, 9, 3 ] }, { "input": [ "BOS", 10, 10, 7, 4, 3, 7, 7, 2, 5 ], "output": [ "BOS", 9, 9, 6, 3, 3, 6, 6, 0, 3 ] }, { "input": [ "BOS", 8, 0, 10, 10, 9, 2, 6, 3, 8 ], "output": [ "BOS", 6, 0, 9, 9, 9, 0, 6, 3, 6 ] }, { "input": [ "BOS", 6, 3, 10, 7, 4, 6, 9, 2, 6 ], "output": [ "BOS", 6, 3, 9, 6, 3, 6, 9, 0, 6 ] } ], "is_categorical": true }, "program": "decrement_to_multiple_of_three = rasp.Map(lambda x: x - (x % 3), rasp.tokens).named('decrement_to_multiple_of_three')\nreturn decrement_to_multiple_of_three", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Reduces each value to the nearest value that is a multiple of three." }, "rasp_vars": [ "decrement_to_multiple_of_three" ], "labels": [ "decrement_to_multiple_of_three_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_50", "name": "hyperbolic_cosine", "summary": "Applies the hyperbolic cosine to each element.", "examples": [ { "input": [ "BOS", 2, 4, 2, 6, 4, 8, 6, 1, 3 ], "output": [ "BOS", 3.7621956910836314, 27.308232836016487, 3.7621956910836314, 201.7156361224559, 27.308232836016487, 1490.479161252178, 201.7156361224559, 1.5430806348152437, 10.067661995777765 ] }, { "input": [ "BOS", 4, 1, 7, 5, 1, 4, 0, 9, 5 ], "output": [ "BOS", 27.308232836016487, 1.5430806348152437, 548.317035155212, 74.20994852478785, 1.5430806348152437, 27.308232836016487, 1.0, 4051.5420254925943, 74.20994852478785 ] }, { "input": [ "BOS", 10, 10, 7, 4, 3, 7, 7, 2, 5 ], "output": [ "BOS", 11013.232920103324, 11013.232920103324, 548.317035155212, 27.308232836016487, 10.067661995777765, 548.317035155212, 548.317035155212, 3.7621956910836314, 74.20994852478785 ] }, { "input": [ "BOS", 8, 0, 10, 10, 9, 2, 6, 3, 8 ], "output": [ "BOS", 1490.479161252178, 1.0, 11013.232920103324, 11013.232920103324, 4051.5420254925943, 3.7621956910836314, 201.7156361224559, 10.067661995777765, 1490.479161252178 ] }, { "input": [ "BOS", 6, 3, 10, 7, 4, 6, 9, 2, 6 ], "output": [ "BOS", 201.7156361224559, 10.067661995777765, 11013.232920103324, 548.317035155212, 27.308232836016487, 201.7156361224559, 4051.5420254925943, 3.7621956910836314, 201.7156361224559 ] } ], "is_categorical": true }, "program": "return rasp.Map(math.cosh, rasp.tokens)", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Applies an elementwise hyperbolic cosine transformation to each input value." }, "rasp_vars": [ "hyperbolic_cosine" ], "labels": [ "map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_51", "name": "check_fibonacci", "summary": "Checks if each element is a Fibonacci number", "examples": [ { "input": [ "BOS", 74, 87, 99, 23, 2, 21, 52, 1, 87 ], "output": [ "BOS", 0, 0, 0, 0, 1, 1, 0, 1, 0 ] }, { "input": [ "BOS", 51, 92, 14, 71, 60, 20, 82, 86, 74 ], "output": [ "BOS", 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 21, 88, 48, 90, 58, 41, 91, 59, 79 ], "output": [ "BOS", 1, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 29, 37, 1, 63, 59, 20, 32, 75, 57 ], "output": [ "BOS", 0, 0, 1, 0, 0, 0, 0, 0, 0 ] }, { "input": [ "BOS", 14, 61, 61, 46, 61, 50, 54, 63, 2 ], "output": [ "BOS", 0, 0, 0, 0, 0, 0, 0, 0, 1 ] } ], "is_categorical": true }, "program": "fib_sequence = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]\ncheck_fibonacci_map = rasp.Map(lambda x: 1 if x in fib_sequence else 0, rasp.tokens).named(\"check_fibonacci_map\")\nreturn check_fibonacci_map", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "INDICATOR", "note": "Marks each input element as Fibonacci or not using a fixed lookup set." }, "rasp_vars": [ "check_fibonacci_map" ], "labels": [ "check_fibonacci_map_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157{ "task": { "id": "case_52", "name": "square_root", "summary": "Apply square root to each token/value independently.", "examples": [ { "input": [ "BOS", 2, 4, 2, 6, 4, 8, 6, 1, 3 ], "output": [ "BOS", 1.4142135623730951, 2.0, 1.4142135623730951, 2.449489742783178, 2.0, 2.8284271247461903, 2.449489742783178, 1.0, 1.7320508075688772 ] }, { "input": [ "BOS", 4, 1, 7, 5, 1, 4, 0, 9, 5 ], "output": [ "BOS", 2.0, 1.0, 2.6457513110645907, 2.23606797749979, 1.0, 2.0, 0.0, 3.0, 2.23606797749979 ] }, { "input": [ "BOS", 10, 10, 7, 4, 3, 7, 7, 2, 5 ], "output": [ "BOS", 3.1622776601683795, 3.1622776601683795, 2.6457513110645907, 2.0, 1.7320508075688772, 2.6457513110645907, 2.6457513110645907, 1.4142135623730951, 2.23606797749979 ] }, { "input": [ "BOS", 8, 0, 10, 10, 9, 2, 6, 3, 8 ], "output": [ "BOS", 2.8284271247461903, 0.0, 3.1622776601683795, 3.1622776601683795, 3.0, 1.4142135623730951, 2.449489742783178, 1.7320508075688772, 2.8284271247461903 ] }, { "input": [ "BOS", 6, 3, 10, 7, 4, 6, 9, 2, 6 ], "output": [ "BOS", 2.449489742783178, 1.7320508075688772, 3.1622776601683795, 2.6457513110645907, 2.0, 2.449489742783178, 3.0, 1.4142135623730951, 2.449489742783178 ] } ], "is_categorical": true }, "program": "return rasp.Map(lambda x: x ** 0.5, rasp.tokens).named(\"square_root\")", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Applies a per-position numeric map by computing the square root for each element." }, "rasp_vars": [ "square_root" ], "labels": [ "square_root_1" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171{ "task": { "id": "case_53", "name": "increment_odd_indices", "summary": "Increment elements at odd indices by 1", "examples": [ { "input": [ "BOS", 2, 4, 2, 6, 4, 8, 6, 1, 3 ], "output": [ "BOS", 2, 5, 2, 7, 4, 9, 6, 2, 3 ] }, { "input": [ "BOS", 4, 1, 7, 5, 1, 4, 0, 9, 5 ], "output": [ "BOS", 4, 2, 7, 6, 1, 5, 0, 10, 5 ] }, { "input": [ "BOS", 10, 10, 7, 4, 3, 7, 7, 2, 5 ], "output": [ "BOS", 10, 11, 7, 5, 3, 8, 7, 3, 5 ] }, { "input": [ "BOS", 8, 0, 10, 10, 9, 2, 6, 3, 8 ], "output": [ "BOS", 8, 1, 10, 11, 9, 3, 6, 4, 8 ] }, { "input": [ "BOS", 6, 3, 10, 7, 4, 6, 9, 2, 6 ], "output": [ "BOS", 6, 4, 10, 8, 4, 7, 9, 3, 6 ] } ], "is_categorical": true }, "program": "odd_index_marker = rasp.Map(lambda x: x % 2, rasp.indices).named(\"odd_index_marker\")\nincremented_elements = rasp.SequenceMap(lambda elem, mark: elem + mark, rasp.tokens, odd_index_marker).named(\"incremented_elements\")\nreturn incremented_elements", "components": [ { "id": "L0_MLP", "hook": "blocks.0.mlp.hook_post", "role": { "tag": "MAPPER", "note": "Computes the parity of each position's index (index mod 2) to produce a per-position binary value used as an increment signal." }, "rasp_vars": [ "odd_index_marker" ], "labels": [ "odd_index_marker_2" ] }, { "id": "L1_MLP", "hook": "blocks.1.mlp.hook_post", "role": { "tag": "COMBINER", "note": "Adds the odd-index marker to each element so only odd positions are incremented." }, "rasp_vars": [ "incremented_elements" ], "labels": [ "incremented_elements_1" ] } ]}annotations/case_101.jsonAdded+157
annotations/case_102.jsonAdded+157
annotations/case_103.jsonAdded+200
annotations/case_104.jsonAdded+157
annotations/case_105.jsonAdded+157
annotations/case_106.jsonAdded+157
annotations/case_11.jsonAdded+172
annotations/case_110.jsonAdded+172
annotations/case_111.jsonAdded+214
annotations/case_113.jsonAdded+291
annotations/case_114.jsonAdded+157
annotations/case_121.jsonAdded+157
annotations/case_122.jsonAdded+157
annotations/case_123.jsonAdded+157
annotations/case_124.jsonAdded+216
annotations/case_129.jsonAdded+200
annotations/case_13.jsonAdded+171
annotations/case_130.jsonAdded+187
annotations/case_14.jsonAdded+171
annotations/case_15.jsonAdded+135
annotations/case_18.jsonAdded+203
annotations/case_19.jsonAdded+221
annotations/case_2.jsonAdded+215
annotations/case_20.jsonAdded+158
annotations/case_21.jsonAdded+214
annotations/case_24.jsonAdded+157
annotations/case_25.jsonAdded+203
annotations/case_26.jsonAdded+157
annotations/case_29.jsonAdded+157
annotations/case_3.jsonAdded+122
annotations/case_30.jsonAdded+157
annotations/case_31.jsonAdded+157
annotations/case_33.jsonAdded+157
annotations/case_34.jsonAdded+157
annotations/case_35.jsonAdded+157
annotations/case_36.jsonAdded+157
annotations/case_37.jsonAdded+157
annotations/case_39.jsonAdded+671
annotations/case_4.jsonAdded+188
annotations/case_40.jsonAdded+171
annotations/case_41.jsonAdded+157
annotations/case_43.jsonAdded+157
annotations/case_44.jsonAdded+172
annotations/case_45.jsonAdded+200
annotations/case_46.jsonAdded+157
annotations/case_49.jsonAdded+157
annotations/case_50.jsonAdded+157
annotations/case_51.jsonAdded+157
annotations/case_52.jsonAdded+157
annotations/case_53.jsonAdded+171