executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
importance_sampling_generationEstimate residual EBM partition terms and select text continuations by importance reweighting fixed-LM proposal samples.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this skill when evaluating or generating from a residual text EBM with a fixed language-model proposal. It provides the paper's practical mechanism for avoiding MCMC over discrete text.
Do not use this skill to claim full perplexity from a tiny sample set. Small candidate sets are reduced/proxy evidence unless they match the paper's estimator scale and data protocol.
log_z_estimate: sample estimate of log E_{P_LM}[exp(-E)].exp(-E).log mean exp(-energy) across proposal samples.exp(-energy) into candidate weights.exp(-E) weight, using proposal log probability only as a tie-break when energy weights are exactly tied. Keep lm_logprob - energy as an evaluation/ranking diagnostic, not the default generation selector.Run:
python scripts/importance_sampling.py --demo
python -m pytest tests
The tests verify stable log-mean-exp behavior, normalized weights, increased weight for lower energy, and generation selection by energy weight even when a negative candidate has a high proposal log probability.
Importance sampling quality depends on proposal coverage. A poor base LM can make residual search inefficient, exactly as the paper notes. Record sample count and proposal source in recovery artifacts.