diff options
| author | Void Agent <void@jayrup.hermes> | 2026-08-02 14:20:05 +0100 |
|---|---|---|
| committer | Void Agent <void@jayrup.hermes> | 2026-08-02 14:20:05 +0100 |
| commit | 2ba0e14c3559e5786c324a89f26f159363a230b5 (patch) | |
| tree | 401683167a9541e066c3a30c83037bf7cc89e83a /src/jlens_v3.py | |
| parent | 42660815eef000bcb662287a97cbb3012b6c90b8 (diff) | |
Document n_pairs denominator (exact count) and ctrl_random gradient-mass caveat (comment-only)
Diffstat (limited to 'src/jlens_v3.py')
| -rw-r--r-- | src/jlens_v3.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/jlens_v3.py b/src/jlens_v3.py index b5f59ed..69299dc 100644 --- a/src/jlens_v3.py +++ b/src/jlens_v3.py @@ -115,6 +115,9 @@ def compute_faithful_jlens(model, layer_idx, batches, device, chunk=32): torch.cuda.empty_cache() n_pairs += B * T * (T + 1) // 2 # valid (t, t' >= t) pairs + # NOTE: count = T(T+1)/2 per sequence (all source positions t and all + # futures t' >= t). Pairs with t' < t contribute zero gradient by + # causality, so summing over all t' and dividing by this count is exact. del logits, loss, h_l, h_final, h_final_sum torch.cuda.empty_cache() |
