|
pulsatrix 1.1.0
|
Explaining a masked diffusion LM's generation (DIFF-3): commitment-graph LRP, which explains tokens written at any step back to the prompt by chaining AttnLRP through the tokens committed in between, and the checks that test it by replaying the trajectory. More...
#include <cstdint>#include <optional>#include <vector>#include "pulsatrix/attnlrp_parity.hpp"#include "pulsatrix/encoder_lm.hpp"#include "pulsatrix/masked_diffusion.hpp"
Go to the source code of this file.
Classes | |
| class | pulsatrix::StepRelevanceModel |
| One denoising step's model as the explainer sees it: a forward pass that keeps what the relevance pass needs, and the relevance pass. EncoderLMStepModel wraps an EncoderLM. More... | |
| class | pulsatrix::EncoderLMStepModel |
An EncoderLM as a StepRelevanceModel: one sequence per pass, AttnLRP with config (LXT's rules by default, as EncoderExplainer uses). More... | |
| class | pulsatrix::CausalLMStepModel |
| A CausalLM with bidirectional attention (an A2D diffusion model, DIFF-4) as a StepRelevanceModel, with the same rules as EncoderLMStepModel. More... | |
| struct | pulsatrix::CommitmentTarget |
| A generated token to explain. More... | |
| struct | pulsatrix::CommitmentHop |
| One step's relevance pass: what went in and where it landed. More... | |
| struct | pulsatrix::CommitmentRelevance |
| Where the relevance of the explained tokens went. Every vector has one value per position. The ledger balances exactly: value = prompt + mask + leak (+ relayed in CommitmentMode::StepLocal, where it is an endpoint). More... | |
| struct | pulsatrix::CommitmentDeletionCurve |
| A prompt-deletion curve against its random baseline. More... | |
| struct | pulsatrix::CommitmentPatchResult |
| Step-resolved patching against the relevance relayed through each committed token. More... | |
Namespaces | |
| namespace | pulsatrix |
Enumerations | |
| enum class | pulsatrix::CommitmentMode { pulsatrix::Graph , pulsatrix::StepLocal } |
| How far relevance travels. More... | |
Functions | |
| CommitmentRelevance | pulsatrix::ExplainCommitments (StepRelevanceModel &model, const MaskedDiffusionResult &trajectory, int64_t mask_token_id, const std::vector< CommitmentTarget > &targets, CommitmentMode mode=CommitmentMode::Graph) |
Explains targets on trajectory, which SampleMaskedDiffusion produced with model's logits. Each step's input is rerun, so the model must give the logits it gave then. | |
| MaskedDiffusionResult | pulsatrix::ReplayMaskedDiffusion (const DenoiserFn &model, const MaskedDiffusionResult &trajectory, const std::vector< int64_t > &input, const MaskedDiffusionConfig &config, const std::vector< int64_t > &skipped={}) |
Reruns trajectory from input with its write order frozen: each step writes the same positions as before, each taking the model's most likely allowed token for the new sequence (greedy, as explanation runs are). Positions in skipped are never written, and a position input masks that the trajectory never wrote (a deleted prompt token) stays masked, so the result may keep mask tokens. | |
| double | pulsatrix::ReplayCommitmentValue (const DenoiserFn &model, const MaskedDiffusionResult &trajectory, const std::vector< int64_t > &input, const MaskedDiffusionConfig &config, const std::vector< CommitmentTarget > &targets, const std::vector< int64_t > &skipped={}) |
The explained value on a replay (ReplayMaskedDiffusion): each target's logit at the step that wrote it in trajectory, for the token the trajectory wrote there (or the target's fixed token), summed. A target in skipped still counts at that step. | |
| CommitmentDeletionCurve | pulsatrix::CommitmentDeletionCheck (const DenoiserFn &model, const MaskedDiffusionResult &trajectory, const MaskedDiffusionConfig &config, const std::vector< CommitmentTarget > &targets, const std::vector< float > &prompt_relevance, int64_t steps=10, int64_t random_orders=3, uint64_t seed=0) |
Deletes prompt tokens (replaces them with the mask token) in order of how much they support the value (prompt_relevance of the value's sign, largest first), replays the trajectory each time (ReplayCommitmentValue), and records the value, beside random_orders random orders. | |
| CommitmentPatchResult | pulsatrix::CommitmentPatchCheck (const DenoiserFn &model, const MaskedDiffusionResult &trajectory, const MaskedDiffusionConfig &config, const std::vector< CommitmentTarget > &targets, const CommitmentRelevance &graph) |
Leaves each committed intermediate token masked in turn, replays the trajectory, and compares the change in the value with the relevance graph relayed through that token. | |
Explaining a masked diffusion LM's generation (DIFF-3): commitment-graph LRP, which explains tokens written at any step back to the prompt by chaining AttnLRP through the tokens committed in between, and the checks that test it by replaying the trajectory.
In a carry-over sampler (MDLM's, LLaDA's) no hidden state passes from one step to the next: each step is one forward pass over the current sequence, and the committed tokens are the only channel between steps. So relevance that one step's pass puts on a token committed earlier is re-seeded at the step that wrote it, onto the logit that produced it, and the steps are walked in reverse. With the forward activations fixed every rule in use is linear in the incoming relevance, so each step needs one relevance pass however many tokens it seeds. See docs/interpretability/diffusion-lrp.md (D2) for the derivation and its limits.