def zip_tokens_and_attention_activations(
    activation_records: list[ActivationRecord],
) -> list[list[TokenAndRawAttentionScalars]]:
    """
    This function takes a list of activation records and returns a list of lists of TokenAndRawAttentionScalars, one
    outer list element per sequence, and one inner list element per sequence token.
    There are multiple attention activations per sequence token (one per token in the "attended to sequence" for that sequence token).
    Because the activation record holds the activations in a flattened form, where (sequence token index, attended to sequence token index)
    are combined into a single index, we need to reconstruct the nested list structure, inferring it from the number of flattened
    activations and the number of sequence tokens.
    """

    sequences: list[list[TokenAndRawAttentionScalars]] = []
    for activation_record in activation_records:
        sequence = convert_token_sequence_to_token_and_raw_attention_scalars(
            activation_record.tokens, activation_record.activations
        )
        sequences.append(sequence)
    return sequences

    This function takes a list of activation records and returns a list of lists of TokenAndRawAttentionScalars, one
    outer list element per sequence, and one inner list element per sequence token.
    There are multiple attention activations per sequence token (one per token in the "attended to sequence" for that sequence token).
    Because the activation record holds the activations in a flattened form, where (sequence token index, attended to sequence token index)
    are combined into a single index, we need to reconstruct the nested list structure, inferring it from the number of flattened
    activations and the number of sequence tokens.
    
neuron_explainer/activation_server/read_routes.py