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