Skip to content
QFT.org

Search QFT.org

Enter a word or phrase.

    You can also browse the main navigation and chapter contents.

    Adaptive Channels and Event Unweighting

    A narrow resonance can make most uniformly generated events contribute almost nothing. Sampling near several resonances solves part of that problem, but introduces two decisions: how often to use each channel, and how to account for the overlap between them. Turning those weighted events into unit-weight events poses a further problem: a good average variance does not guarantee a good rejection bound.

    We generate an actual two-channel resonance sample, adapt its channel probabilities on an independent pilot, and compare integration errors at equal target-evaluation budgets. We then test valid rejection sampling and a deliberately underestimated envelope. The latter gives a visibly biased unit-weight sample; a prescribed compensation restores the integral by retaining nonunit event weights.

    Preparation: Phase-space maps and importance sampling. The example is a positive, incoherent scalar decay model. It does not replace a coherent amplitude calculation or a signed higher-order event sample.

    A resonance target with an exact integral

    Use the massless three-body invariant x=s12/M2x=s_{12}/M^2 on (0,1)(0,1), with all four angular coordinates sampled isotropically. Define two normalized truncated Cauchy densities,

    bj(x)=γjΔj[(x−μj)2+γj2],Δj=arctan⁡1−μjγj−arctan⁡−μjγj.b_j(x)=\frac{\gamma_j}{\Delta_j[(x-\mu_j)^2+\gamma_j^2]},\qquad \Delta_j=\arctan\frac{1-\mu_j}{\gamma_j} -\arctan\frac{-\mu_j}{\gamma_j}.

    The fixed parameters are

    (μ1,γ1)=(0.23,0.015),(μ2,γ2)=(0.71,0.035),cR=0.35.(\mu_1,\gamma_1)=(0.23,0.015),\qquad (\mu_2,\gamma_2)=(0.71,0.035),\qquad c_R=0.35.

    In resonance notation, μj=mRj2/M2\mu_j=m_{Rj}^2/M^2 and γj=mRjΓRj/M2\gamma_j=m_{Rj}\Gamma_{Rj}/M^2. No narrow-width approximation is made. Choose the dimensionless squared amplitude b1(x)+cRb2(x)b_1(x)+c_Rb_2(x). The phase-space factor gives the one-dimensional target

    F(x)=(1−x)[b1(x)+cRb2(x)],I=∫01F(x) dx.F(x)=(1-x)[b_1(x)+c_Rb_2(x)],\qquad I=\int_0^1F(x)\,\mathrm dx.

    For distinguishable daughters its absolute decay width is MI/(256π3)MI/(256\pi^3). The normalized invariant-mass distribution is F/IF/I.

    We add the two positive channel contributions incoherently. The selected sampling channel is an auxiliary random label; it is not an observed resonance history.

    The integral and every histogram-bin reference follow from the elementary primitive

    Jj(x)=1−μjΔjarctan⁡x−μjγj−γj2Δjlog⁡[(x−μj)2+γj2].\mathcal J_j(x)=\frac{1-\mu_j}{\Delta_j} \arctan\frac{x-\mu_j}{\gamma_j} -\frac{\gamma_j}{2\Delta_j}\log[(x-\mu_j)^2+\gamma_j^2].

    Consequently

    I=[J1(x)+cRJ2(x)]01=0.8692460701476208.I=[\mathcal J_1(x)+c_R\mathcal J_2(x)]_0^1 =0.8692460701476208.

    A separately evaluated split Gauss rule agrees to 1.5×10−151.5\times10^{-15}. The exact reference tests the algorithm; it is never used to select a favorable pilot iteration or random sample.

    Draw a channel, divide by the full mixture

    Let αj>0\alpha_j>0, α1+α2=1\alpha_1+\alpha_2=1. Draw a channel jj with probability αj\alpha_j, then draw uu uniformly and set

    aj=arctan⁡−μjγj,x=μj+γjtan⁡(aj+uΔj).a_j=\arctan\frac{-\mu_j}{\gamma_j},\qquad x=\mu_j+\gamma_j\tan(a_j+u\Delta_j).

    Differentiating gives du/dx=bj(x)\mathrm du/\mathrm dx=b_j(x). Thus the marginal density of the returned invariant is

    gα(x)=α1b1(x)+α2b2(x),w(x)=F(x)gα(x),I^=1N∑kw(xk).g_\alpha(x)=\alpha_1b_1(x)+\alpha_2b_2(x),\qquad w(x)=\frac{F(x)}{g_\alpha(x)},\qquad \widehat I=\frac1N\sum_k w(x_k).

    Both channels cover the whole interval, so a point sampled from channel 1 can also lie under channel 2. The full mixture accounts for this overlap. This is the balance-mixture estimator used here. Kleiss and Pittau, Eqs. (1)–(2), printed pp. 1–2 (PDF).

    One specific wrong estimator divides by the joint density αjbj(x)\alpha_jb_j(x) and then forgets to partition the target between channels. Its expectation is

    ∑j=12αj∫01bj(x)F(x)αjbj(x) dx=2I.\sum_{j=1}^2\alpha_j\int_0^1b_j(x) \frac{F(x)}{\alpha_jb_j(x)}\,\mathrm dx=2I.

    The retained control measures 1.8129±0.06811.8129\pm0.0681, consistent with that doubled expectation rather than with II. This does not mean that every estimator using a single-channel denominator is biased. For example, F/bjF/b_j is unbiased here because each normalized channel covers the full target; it simply has a different variance. The estimator and its sampling law must be specified together.

    The inverse CDF also needs numerical endpoint care. The subtraction in μ+γtan⁡(a+uΔ)\mu+\gamma\tan(a+u\Delta) can round an interior point to zero. Only if this happens within a roundoff-size guard, the code uses

    x=γsin⁡(uΔ)cos⁡acos⁡(a+uΔ),x=\frac{\gamma\sin(u\Delta)}{\cos a\cos(a+u\Delta)},

    or the corresponding expression for 1−x1-x near the upper endpoint. These follow from the tangent-difference identity. Forced first-cell and last-cell tests retain strictly interior invariant masses; no physical mass cut is introduced.

    Adapt variance on a pilot, then freeze

    For a fixed proposal, the variance of the ordinary mean is

    Var⁡(I^)=W(α)−I2N,W(α)=∫01F(x)2gα(x) dx.\operatorname{Var}(\widehat I)=\frac{W(\alpha)-I^2}{N},\qquad W(\alpha)=\int_0^1\frac{F(x)^2}{g_\alpha(x)}\,\mathrm dx.

    Differentiation defines useful channel sensitivities,

    −∂W∂αj=Wj(α)=∫01bj(x)F(x)2gα(x)2 dx.-\frac{\partial W}{\partial\alpha_j} =W_j(\alpha) =\int_0^1 b_j(x)\frac{F(x)^2}{g_\alpha(x)^2}\,\mathrm dx.

    A sample from the current gαg_\alpha estimates these by

    W^j=1Np∑kbj(xk)gα(xk)w(xk)2.\widehat W_j=\frac1{N_p}\sum_k \frac{b_j(x_k)}{g_\alpha(x_k)}w(x_k)^2.

    Use the Kleiss–Pittau update

    αjnew=αjW^j∑iαiW^i.\alpha_j^{\rm new}= \frac{\alpha_j\sqrt{\widehat W_j}} {\sum_i\alpha_i\sqrt{\widehat W_i}}.

    It shifts probability toward channels whose undercoverage contributes more to the second moment. Finite pilot estimates fluctuate, so successive updates need not improve the true variance monotonically. Kleiss and Pittau, Eqs. (6)–(7) and accompanying qualifications, printed pp. 2–3 (PDF).

    The frozen experiment starts at (0.5,0.5)(0.5,0.5) and performs exactly six rounds of 1,024 new pilot points. After each update it clips α1\alpha_1 to [0.05,0.95][0.05,0.95] and sets α2=1−α1\alpha_2=1-\alpha_1. It then freezes the result and uses an independent production stream. The pilot is not included as if it were an independent sample from the final proposal. Conditional on any resulting proposal, the independent production estimator remains unbiased; the pilot's randomness can still change its variance.

    There are 16 independent experiments. Each method spends 65,536 target evaluations per experiment: the learned method uses 6,144 pilot and 59,392 production evaluations; the other methods use 65,536 production evaluations. Both channel densities are evaluated per target call, giving 131,072 individual density values. Independent reference quadrature and validation are additional checks, outside that common sampling budget. No universal wall-time speedup is inferred from this inexpensive one-dimensional example.

    A useful fixed comparison is the coefficient-balanced proposal,

    α=(1,cR)1+cR,w(x)=(1+cR)(1−x)=1.35(1−x).\alpha=\frac{(1,c_R)}{1+c_R},\qquad w(x)=(1+c_R)(1-x)=1.35(1-x).

    It captures both resonance peaks but leaves the smooth phase-space factor in the weight.

    ProposalMean of 16 estimatesStandard error of that mean from replicasRMS exact standard error of one run
    Uniform xx0.869490.869490.002620.002620.0095410.009541
    Equal channels0.868900.868900.0005620.0005620.0025740.002574
    Learned channels0.8692820.8692820.00007900.00007900.00033610.0003361
    Coefficient-balanced0.8690160.8690160.0001990.0001990.0011480.001148

    The last column comes from independently integrated second moments, with orders 64 and 128 compared on intervals split around the resonances. For learned proposals it averages the conditional variances over the 16 retained pilots. The standard errors estimated directly from production weights closely reproduce those scales. The finite replica scatter need not match them exactly: for coefficient-balanced sampling, the observed single-run replica standard deviation is 0.0007950.000795, smaller than its theoretical 0.0011480.001148.

    The learned values of α1\alpha_1 range from 0.88220.8822 to 0.89680.8968. They favor the lower resonance, where 1−x1-x is larger. Five of the sixteen learned estimates lie outside their own one-standard-error intervals about the reference. Such fluctuations are part of the output, not failed seeds to replace.

    Unweighting requires a bound, not a small variance

    Suppose a proven constant BB bounds w(x)w(x) everywhere. Accept a proposal with probability w/Bw/B. Then

    P(accept,x∈dx)=F(x)B dx,P(accept)=IB,p(x∣accept)=F(x)I.\mathbb P(\text{accept},x\in\mathrm dx)=\frac{F(x)}B\,\mathrm dx, \qquad \mathbb P(\text{accept})=\frac IB, \qquad p(x\mid\text{accept})=\frac{F(x)}I.

    Accepted events are unit weight for shape sampling. The absolute normalization is recovered from I^=BNacc/Nprop\widehat I=B N_{\rm acc}/N_{\rm prop}, not from the normalized accepted histogram alone. Its exact variance is

    Var⁡(I^)=BI−I2Nprop.\operatorname{Var}(\widehat I)=\frac{BI-I^2}{N_{\rm prop}}.

    For this model a global bound follows without scanning for a maximum:

    Bα=max⁡(1α1,cRα2),F(x)≤(1−x)Bαgα(x)≤Bαgα(x).B_\alpha=\max\left(\frac1{\alpha_1},\frac{c_R}{\alpha_2}\right), \qquad F(x)\leq (1-x)B_\alpha g_\alpha(x)\leq B_\alpha g_\alpha(x).

    The bound is conservative but proved. An empirical maximum from a pilot would not establish the same property. Each production proposal is also checked for a material violation of the stated bound.

    Using 131,072 proposals for each condition gives:

    ProposalCertified boundPredicted acceptanceObserved acceptance
    Equal channels220.4346230.4346230.4308170.430817
    Replica-0 learned channels3.2172793.2172790.2701800.2701800.2715070.271507
    Coefficient-balanced1.351.350.6438860.6438860.6436310.643631

    The learned proposal has the best integration variance in this comparison and the worst efficiency under these certified bounds. It assigns a small probability to the upper channel, increasing cR/α2c_R/\alpha_2. The coefficient-balanced proposal minimizes this particular bound: if both ratios are at most BB, their sum implies 1+cR≤B1+c_R\leq B, with equality at the coefficient-balanced choice. This need not be the same as minimizing the true maximum weight, much less the second moment.

    The equal-channel acceptance is about 2.82.8 binomial standard errors below its expectation; its normalization estimate is 0.86163±0.002740.86163\pm0.00274. All accepted events are converted to full three-body momenta using independent angular draws, and their mass shells and momentum conservation are checked.

    What an underestimated envelope actually samples

    Use equal channels and deliberately choose

    Bbad=0.7 w(μ1)=1.076370304.B_{\rm bad}=0.7\,w(\mu_1)=1.076370304.

    This is a known false bound: the center itself proves an overshoot on a neighborhood. Replay the same equal-channel proposals and acceptance uniforms with

    a(x)=min⁡(1,w(x)Bbad).a(x)=\min\left(1,\frac{w(x)}{B_{\rm bad}}\right).

    If every accepted event is mistakenly called unit weight, the unnormalized selected density is proportional to

    Bbadgα(x)a(x)=min⁡(F(x),Bbadgα(x)).B_{\rm bad}g_\alpha(x)a(x) =\min\bigl(F(x),B_{\rm bad}g_\alpha(x)\bigr).

    High-weight regions are clipped. The exact clipped integral is 0.64639458340.6463945834, far below I=0.8692460701I=0.8692460701. The run estimates 0.64346±0.001460.64346\pm0.00146 for that clipped integral. About 48.9%48.9\% of the proposals exceed the false bound, and the largest observed ratio is w/Bbad=1.61449w/B_{\rm bad}=1.61449.

    A predetermined compensation instead gives each accepted event the residual weight

    r(x)=max⁡(1,w(x)Bbad).r(x)=\max\left(1,\frac{w(x)}{B_{\rm bad}}\right).

    Since a(x)r(x)=w(x)/Bbada(x)r(x)=w(x)/B_{\rm bad}, the per-proposal variable

    Y=Bbad 1accepted r(x)Y=B_{\rm bad}\,\boldsymbol1_{\rm accepted}\,r(x)

    has expectation II. The retained events now have nonunit weights. This is the basic overweight correction used in partially unweighted sampling; it is distinct from the neural-network proposal and two-stage construction in the cited application. Danziger et al., §2, Eqs. (4)–(7) and Algorithm 1.

    For the actual replay, compensation gives 0.86460±0.002000.86460\pm0.00200, about 2.32.3 estimated standard errors below II. Every rejected proposal contributes a zero when estimating this variance. Treating the retained weighted events as an independent sample of fixed size and forgetting the rejected proposals would use the wrong normalization experiment. The compensated and clipped estimates also share their proposals and acceptance uniforms: the uncertainty in their difference is 0.0006440.000644, calculated from the paired differences, not by adding two independent variances.

    Multichannel pilot probabilities stabilize near a strong lower-resonance preference; resonance histograms compare valid rejection, biased clipping and weighted compensation with exact bin integrals.

    The pilot trace is replica 0, whose proposal is then frozen. The invariant-mass histogram uses the same 131,072 equal-channel proposals for valid rejection, unsafe clipping, and compensation. Each bin estimates ∫binF(x) dx\int_{\rm bin}F(x)\,\mathrm dx, with no normalization to unit area. Clipping changes the target; residual weights restore its expectation while retaining statistical fluctuations.

    If an unexpected overweight occurs in a run intended to have unit weights, simply raising a running maximum does not repair earlier acceptances. Use a previously specified compensation law and retain its weights, or discard and restart the affected unit-weight production after establishing a valid bound. A larger empirical maximum alone is still not proof of a bound. The valid unit-weight runs here use the analytic envelope throughout.

    Reproduce the comparison

    The pure density and inverse maps are in resonance_channels.py. Run:

    python3 examples/computational-qft/event-generation/adaptive_events.py
    

    The pilot streams are SeedSequence([911025,1,replica,round]); independent production uses [911025,2,method_id,replica]. Rejection and angular reconstruction use [911025,3,method_id] and [911025,4,method_id]. The JSON output retains every pilot update, production estimate, conditional variance check, histogram, envelope, and overweight diagnostic. --refresh-kinematics only replays the already fixed accepted-event kinematics and asserts unchanged retained acceptance counts and bins; it does not regenerate or select integration estimates.

    The measured efficiency belongs to this smooth positive target, these proposals, and these budgets. Signed weights, interference or detector acceptance would change the proposal and its uncertainty analysis.

    Exercises

    1. Variance adaptation and envelope optimization

    For a positive target FF and normalized channels bjb_j, derive the interior stationarity condition for W(α)W(\alpha) under ∑jαj=1\sum_j\alpha_j=1. Show its second variation is nonnegative. Then prove the bound above and find the α\alpha that minimizes that bound for the present two coefficients.

    Solution

    Because gα=∑jαjbjg_\alpha=\sum_j\alpha_jb_j,

    ∂W∂αj=−∫F2bjgα2 dx=−Wj.\frac{\partial W}{\partial\alpha_j} =-\int\frac{F^2b_j}{g_\alpha^2}\,\mathrm dx=-W_j.

    A Lagrange multiplier gives Wj=λW_j=\lambda for every active channel at an interior optimum. Multiplying by αj\alpha_j and summing shows

    ∑jαjWj=∫F2gα dx=W,\sum_j\alpha_jW_j =\int\frac{F^2}{g_\alpha}\,\mathrm dx=W,

    so the common value is WW itself. For an allowed direction δα\delta\alpha with zero sum,

    δ2W=2∫F2(∑jδαjbj)2gα3 dx≥0.\delta^2W=2\int\frac{F^2(\sum_j\delta\alpha_jb_j)^2}{g_\alpha^3}\,\mathrm dx\geq0.

    Equality can occur if the channels are redundant along that direction. A clipped or boundary-constrained optimum instead obeys the corresponding inequality conditions; it need not equalize all WjW_j.

    If Bα1≥1B\alpha_1\geq1 and Bα2≥cRB\alpha_2\geq c_R, then Bgα≥b1+cRb2≥FBg_\alpha\geq b_1+c_Rb_2\geq F, giving the claimed envelope. Adding those coefficient inequalities yields B≥1+cRB\geq1+c_R. Equality requires α1=1/(1+cR)\alpha_1=1/(1+c_R) and α2=cR/(1+cR)\alpha_2=c_R/(1+c_R).

    The variance objective integrates F2/gαF^2/g_\alpha over the target, whereas this envelope uses a worst coefficient ratio. Neither minimization condition implies the other. The retained learned proposal explicitly demonstrates the distinction.

    2. Derive the compensated estimator and its variance

    For any positive trial bound BB, set a=min⁡(1,w/B)a=\min(1,w/B) and r=max⁡(1,w/B)r=\max(1,w/B). Derive the density sampled by wrongly unit-weighting accepted events, and prove that Y=B1acceptedrY=B\boldsymbol1_{\rm accepted}r is unbiased. Give its second moment and explain why zeros from rejected proposals must be retained.

    Solution

    At fixed xx, acceptance is Bernoulli with probability a(x)a(x). Consequently the falsely unit-weighted contribution has mean

    E[B1accepted]=∫min⁡(F,Bg) dx.\mathbb E[B\boldsymbol1_{\rm accepted}] =\int \min(F,Bg)\,\mathrm dx.

    Its conditional accepted density is min⁡(F,Bg)\min(F,Bg) divided by that clipped integral, rather than F/IF/I. For compensation, ar=w/Bar=w/B pointwise, hence

    E[Y∣x]=Bar=w,E[Y]=∫gw dx=I.\mathbb E[Y\mid x]=Bar=w, \qquad \mathbb E[Y]=\int gw\,\mathrm dx=I.

    The conditional second moment is B2ar2B^2ar^2. Splitting the domain gives

    E[Y2]=∫w≤BBF(x) dx+∫w>BF(x)2g(x) dx.\mathbb E[Y^2]= \int_{w\leq B} B F(x)\,\mathrm dx +\int_{w>B}\frac{F(x)^2}{g(x)}\,\mathrm dx.

    Thus independent proposals give variance [E(Y2)−I2]/N[\mathbb E(Y^2)-I^2]/N for their mean. Rejected proposals are genuine outcomes Y=0Y=0 of this random variable. Removing them and dividing by the random accepted count estimates a different quantity. To form a normalized shape from accepted weights, use their ratio of weighted sums and propagate the numerator–denominator covariance.

    For two estimators built from the same proposal and uniform acceptance draw, use the sample variance of their per-proposal difference. The covariance term is part of the experiment, not an optional correction. Finally, r>1r>1 on overweight events: the compensated sample is partially weighted and cannot honestly be described as unit weight.

    Summary

    A multichannel event estimator divides by the actual marginal proposal and preserves its normalization. Independent pilot adaptation can substantially reduce integration variance at a counted cost. Unit-weight production additionally needs a valid envelope; a variance-optimized mixture can have a poorer conservative acceptance rate. Underestimated envelopes change the selected density unless a specified residual-weight correction is retained. Both systematic bias and ordinary statistical misses remain visible in the worked experiment.

    References

    • K. Danziger, T. Janßen, S. Schumann and F. Siegert, “Accelerating Monte Carlo event generation—rejection sampling using neural network event-weight estimates,” SciPost Physics 12, 164 (2022), arXiv:2109.11964v2, §2, Eqs. (4)–(7) and Algorithm 1. The present example uses the basic overweight correction, not the paper's neural-network acceleration. Article.
    • R. Kleiss and R. Pittau, “Weight optimization in multichannel Monte Carlo,” Computer Physics Communications 83, 141–146 (1994), hep-ph/9405257v2, Eqs. (1), (2), (6), (7), printed pp. 1–3, PDF pp. 2–4. Paper (PDF).

    Scrollable formula. Use Left and Right arrow keys to reveal hidden content.

    Scrollable table. Use Left and Right arrow keys to reveal hidden columns.

    Scrollable figure. Use Left and Right arrow keys to reveal hidden content.