Stopping a Survey: Settings and Trade-offs¶
A survey stops by a stopping rule when more effort would add little to its archive. This page explains how to set that rule for a study. It covers the parameters that control stopping, how the default stopping rule behaves on surveys of real genes, how to choose its threshold, how to read the warning of a survey that uses its whole variation budget without stopping, and the alternative stopping rule. The theory of the stopping rules, with their sources, is in Section 6 of the theory overview.
The measurements on this page come from one set of surveys of core genes of the
Nucleocytoviricota,
made in notebooks/halt_rule.py. They describe those surveys and are not
properties of the rules.
1. Parameters that control stopping¶
A survey applies its stopping rule when converge is set and force_full_run
is not. With force_full_run, a survey uses its whole variation budget,
n_iters, and does not stop early.
halt_rule selects the stopping rule. "qd_score", the QD-score rule, is the
default, and "rate" selects the rate rule of Section 5. A parameter of the
rule that is not in use must keep its default value, or the parameters are
refused at validation.
qd_tau is the threshold \(\tau\) of the QD-score rule. It lies between 0 and 1,
exclusive. The default is HALT_QD_TAU \(= 0.25\): a survey stops when a doubling
of effort adds \(2^{0.25} - 1 \approx 19\%\) or less to its QD-score, at a
checkpoint and at its half checkpoint. Section 3 discusses the choice.
The guard is the constant HALT_QD_GUARD_DOUBLINGS \(= 2\), not a parameter.
The QD-score rule judges no checkpoint before four times the variations of the
first checkpoint. The variation budget must therefore hold enough checkpoints
to pass the guard and to leave several after it. When the driver sets the
checkpoint cadence, it caps the cadence at n_iters divided by
HALT_QD_MIN_CHECKPOINTS \(= 8\). When the user sets checkpoint_every, a
variation budget with too few checkpoints to pass the guard gives a
RuntimeWarning before the survey starts. The warning gives the number of
checkpoints at which the survey can stop, and it asks for a larger n_iters or
a smaller checkpoint_every.
A survey that resumes a record continues the QD-score rows of that record, so
it decides when to stop from the whole record and not only from the resumed
run. hifuku.analysis.qd_history reads the QD-score and the growth exponent at
every checkpoint of a survey file. Use it to see how far a survey was from
stopping.
2. The QD-score rule on surveys of Nucleocytoviricota genes¶
QD-score and growth exponent of 100 surveys of four Nucleocytoviricota core genes

The QD-score \(Q\) (left) and its growth exponent \(\beta\) (right) at every
checkpoint, one row per gene and one line per survey, colored by the share
of topological moves, five shares from 1% to 65%. Both axes of \(Q\) are logarithmic, so the slope of a
curve is \(\beta\). The surveys ran with \(\tau = 0.1\). Circles mark where
they stopped, and crosses mark surveys that used their whole variation
budget without stopping. Open diamonds mark the checkpoint at which
\(\tau = 0.25\) would have stopped the same survey. \(\beta\) is drawn from the
guard on. Faint lines are segments that each survey ran past its stopping
point with the stopping rule turned off. Data:
surveys/move-mix/explore-20261124T041851Z.
On each gene the QD-score bends over on logarithmic axes as the archive settles, and the growth exponent falls with it. The growth exponent does not fall smoothly. On primase, several surveys fall below 0.25 and then rise above it again late in the run. The QD-score rule requires a low reading at two consecutive doublings, so a survey does not stop on one low reading.
The genes differ in the effort that stopping needs. At \(\tau = 0.1\) the surveys of rnapol2 with 5% or more topological moves stop between about 2 and 7 million variations. Only 1 of the 25 surveys of vltf3 stops before its variation budget of about 24 million. A variation budget that suffices for one gene therefore does not suffice for every gene.
The move mix also changes the effort. With fewer topological moves the growth exponent stays high for longer. At 1% topological moves, only the surveys of rnapol2 stop at \(\tau = 0.1\) within their records, and they need about 17 to 28 million variations. Section 4 describes what a survey reports when it uses its whole variation budget.
3. Choosing the threshold τ: effort against a settled archive¶
\(\tau\) sets how settled the archive is when the survey stops. A smaller \(\tau\) gives a more settled archive at the cost of more variations.
Effort, niches filled and later gain at six values of τ

The stopping point of each Nucleocytoviricota survey at six values of \(\tau\), found exactly from its recorded QD-scores. Left: the variations at the stopping point. Middle: the niches filled at the stopping point, as a share of the niches in the survey's final archive. Right: the best log-likelihood that the survey gained after the stopping point. A smaller \(\tau\) costs more variations and leaves less to gain. Open points are surveys that did not reach the stopping point within their record.
On the Nucleocytoviricota surveys, the default \(\tau = 0.25\) stops most surveys with about 78% to 97% of the niches of the final archive filled, and a few surveys of primase with about 61% to 67%. The best log-likelihood gains up to about 176 log units after that point. At \(\tau = 0.1\) at least 93% of the niches are filled, and the later gain is below 0.25 log units. The default suits a survey whose purpose is a first map or a measure of feasibility. A survey whose archive is the result to report needs a smaller \(\tau\).
The Nucleocytoviricota surveys on this page ran with \(\tau = 0.1\). Because every checkpoint records the rows of the QD-score rule, the stopping point at any larger \(\tau\) can be found from the record of a survey that ran with a smaller one. A survey run with a small \(\tau\) therefore also shows where a larger \(\tau\) would have stopped it, at no extra cost.
4. Surveys that use their whole variation budget without stopping¶
A survey that uses its whole variation budget before the QD-score rule stops it
ends with converged = False. The driver then issues a RuntimeWarning. The
warning gives \(\beta\) at the last checkpoint, \(\tau\), the variations spent, and
three projections of the total variations at which the survey would stop, one
for each accumulation function of
Section 6.5 of
the theory overview. An example of the text, with example numbers:
The QD-score is still growing (beta = 0.41 per doubling at 4.2 million variations); the landscape has not settled to tau = 0.25. Projected total variations to the halt: about 17 million (negative exponential), about 34 million (Clench (Michaelis-Menten)), about 260 million (logarithmic). The models disagree by design; read them as a range, not an estimate.
The warning prints each count to two significant figures. A count of \(10^{12}\) or more is in scientific notation. A model that does not describe the growth of the survey gives no total, and the warning names it in a separate clause. When no model gives a total above the variations spent, the warning says that no fitted model can project the cost.
The projections answer one question: whether the task is feasible at these parameters. They are not results of the survey, and the three functions fit the same data and disagree when they extrapolate.
Fitted accumulation functions do not predict the final QD-score

Each of the three accumulation functions is fitted to the QD-scores of one Nucleocytoviricota survey up to its stopping point, and compared with the QD-score that the survey reached at the end of its record. A ratio above 1 is an over-prediction. (a) Fitted at the stopping point for \(\tau = 0.25\). (b) Fitted at the stopping point for \(\tau = 0.1\), closer to the end of the record. The two saturating functions under-predict and the logarithmic function over-predicts: the three fit the same data and disagree when they extrapolate.
The projections were tested on the Nucleocytoviricota surveys at \(\tau = 0.25\). Each survey was cut short at variation budgets below its stopping point, and the projections of the warning at each budget were compared with the actual stopping point. The 91 surveys that reach the stopping point at \(\tau = 0.25\) within their records were used. The other 9 have no actual stopping point to compare with. On these surveys:
- The logarithmic projection was within a factor of 10 of the stopping point for 90% or more of the budgets from about 50 variations per filled niche. From about 1/256 of the stopping point on, it erred high, by a median factor of about 1.2 to 1.8.
- The Clench and negative-exponential projections erred low at almost every stage. They reached the same reliability only from about 800 and about 1,600 variations per filled niche.
Thus the stopping point usually lies between the two saturating projections and the logarithmic one. A variation budget taken from the logarithmic projection usually reaches the stopping point, and the other two projections are lower bounds. None of the three functions is reliable below about 50 variations per filled niche.
Accuracy of the projected variations to the stopping point

The projected stopping point over the actual stopping point, against the variation budget as a fraction of the actual stopping point, one line per Nucleocytoviricota survey and function, at \(\tau = 0.25\). The gray band is a factor of 10 on either side of the actual stopping point. Above the line at 1 a projection is pessimistic: it asks for more variations than the survey needed. Below the line it is optimistic, and a budget taken from it ends before the survey stops. The dashed line is a naive guess of twice the budget. Faint points are projections that the warning does not show.
To continue a survey that used its whole variation budget, resume it with a larger budget. The resumed survey continues the QD-score rows of its record (Section 1).
5. The rate rule, an alternative stopping rule¶
The rate rule of
Section 6.6 of the
theory overview stops a survey on two rates instead of the QD-score. It reads
the rates over a trailing window of rate_window checkpoints,
HALT_RATE_WINDOW \(= 10\) by default. It stops a survey when the coverage rate
is at or below rate_coverage_eps (\(2 \times 10^{-4}\) by default) and the
precision rate is at or below rate_precision_eps (\(10^{-4}\) by default). When
the driver sets the checkpoint cadence under the rate rule, it caps the cadence
so that the variation budget holds a full window. A variation budget that holds
fewer checkpoints than the window gives a RuntimeWarning before the survey
starts.
Stopping points of the rate rule and the QD-score rule on the Nucleocytoviricota surveys

(a) The variations at which the rate rule, at its default thresholds, would have stopped each Nucleocytoviricota survey, against the stopping point of the QD-score rule at \(\tau = 0.25\) (open) and \(\tau = 0.1\) (filled). Every checkpoint records both rates, so both stopping points are found from the record. (b) The niches filled at each stopping point, as a share of the final archive. The rate rule stops most surveys within a narrow range of variations whatever the gene, and leaves more of the archive unfilled than either value of \(\tau\).
On the Nucleocytoviricota surveys, the rate rule stops at about the same effort for every gene, so it does not follow the differences among genes that Section 2 shows. Its thresholds are rates per checkpoint, so their meaning changes with the checkpoint cadence. The threshold of the QD-score rule has no unit (Section 6.2 of the theory overview).
Sources
- The theory of the stopping rules and its sources are in Section 6 of the theory overview.
- The measurements and figures on this page are made in
notebooks/halt_rule.py, fromsurveys/move-mix/explore-20261124T041851Z. -
hifuku.halt·qd_halts·budget_message·run_survey·qd_history