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