Direct Logit Attribution

~12 mincode completion

Implement logit_attribution(components, W_U, token) returning the array of the contributions followed by their total (length ).

Where this shows up

~12 min

8 employers weight this skill

4 frontier labs, 3 AI product companies, 1 enterprise vendor. Top match scores 93.

Python
import numpy as np


def logit_attribution(components, W_U, token):
    """
    Per-component contributions to one token's logit.

    Args:
        components: residual-stream writes, shape (m, d)
        W_U:        unembedding matrix, shape (V, d)
        token:      index of the token to explain

    Returns:
        array of length m + 1: each contribution, then their sum
    """
    # YOUR CODE HERE
    pass
Loading docs…

The AI Mentor needs an account

It reads your code and the failing tests and nudges you toward the fix without handing you the answer. Free accounts get it on every problem you're working on today.