pulsatrix 1.1.0
Loading...
Searching...
No Matches
null_model_baseline.hpp File Reference

The baseline rule as one call (roadmap XAI-6): run any explainer, probe or featurizer on the trained model and on a re-initialized ("null") model, and compare. More...

#include <cstdint>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "pulsatrix/explanation_metrics.hpp"
#include "pulsatrix/module.hpp"
Include dependency graph for null_model_baseline.hpp:

Go to the source code of this file.

Classes

class  pulsatrix::ParameterSnapshot
 Saves every parameter of a module and restores them exactly when it goes out of scope. More...
 
struct  pulsatrix::NullModelComparison< Result >
 NullModelBaseline()'s result: the analysis on the trained model and on the null model. More...
 
struct  pulsatrix::AttributionNullReport
 NullModelBaseline() for an explanation of one input. More...
 

Namespaces

namespace  pulsatrix
 

Functions

void pulsatrix::ReinitializeParameters (Module &model, uint64_t seed, const std::string &prefix="")
 Replaces each parameter tensor with Gaussian noise of mean 0 and that tensor's own standard deviation, from a portable generator seeded by seed.
 
template<typename Analysis >
auto pulsatrix::NullModelBaseline (Module &model, Analysis &&analysis, uint64_t seed) -> NullModelComparison< std::decay_t< std::invoke_result_t< Analysis & > > >
 Runs analysis() on model, then again after ReinitializeParameters(model, seed), then restores the model exactly (also if analysis throws).
 
AttributionNullReport pulsatrix::NullModelBaseline (Module &model, const ExplainFn &explain, const Tensor &input, uint64_t seed)
 Explains input with the trained and the null model and compares the two.
 

Detailed Description

The baseline rule as one call (roadmap XAI-6): run any explainer, probe or featurizer on the trained model and on a re-initialized ("null") model, and compare.

Note
Why: attribution maps, probes, sparse autoencoders and causal analyses all produce plausible-looking output on randomly initialized networks (Méloux et al., "The Dead Salmons of AI Interpretability", 2025; Adebayo et al. 2018; Heap et al. 2025). A result that looks the same on the null model says nothing about the trained one.