| { |
| "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" |
| ] |
| } |
| ] |
| } |
|
|