Run Parameters¶
Every value that controls a survey is a field of one of these two classes, one
key of the plan file, and one command-line flag. The command-line surface is
generated from dataclasses.fields(), so a new field reaches all three places.
ArchiveParams holds the values with the same meaning on every backend.
GpuParams holds the values only a device backend can use. The two stay
separate so that a device value on a host run is an error and not a setting with
no effect.
A caller gives ordered override layers to resolve: the backend capability
defaults, then the plan file, then the command-line flags. A later layer wins.
Halt parameters¶
halt_rule selects the rule that halts a survey. Each other halt parameter
belongs to one rule.
| Parameter | Rule | Default |
|---|---|---|
halt_rule |
both | "qd_score"; the other value is "rate" |
qd_tau |
QD-score | HALT_QD_TAU = 0.25 |
rate_window |
rate | HALT_RATE_WINDOW = 10 checkpoints |
rate_coverage_eps |
rate | HALT_RATE_COVERAGE_EPS = 2.0e-4 |
rate_precision_eps |
rate | HALT_RATE_PRECISION_EPS = 1.0e-4 |
converge and force_full_run have the same meaning under both rules.
qd_tau must lie between 0 and 1, exclusive. A parameter of the rule not in
use must keep its default value. Otherwise validation raises ValueError, and
the message names the rule in use. The guard of the QD-score rule is the
constant HALT_QD_GUARD_DOUBLINGS, not a parameter.
When checkpoint_every is auto and a halt is asked for, fitted caps the
cadence so that the budget holds enough checkpoints for the rule. Under the
QD-score rule the cap is n_iters // HALT_QD_MIN_CHECKPOINTS. Under the rate
rule it is n_iters // rate_window.
Parameters of a stored record¶
The task digest of a record hashes the fields named in DIGESTED_FIELDS, with
their stored values. A test holds DIGESTED_FIELDS equal to
digested_fields(ArchiveParams), so a field added without a schema step stops
the suite.
ArchiveParams.from_record rebuilds the parameters of a stored record.
Verification and replay both rebuild parameters through it. A record of schema
15 written before 2026-11-25 stores two fields that no parameter set has any
more, legacy_qd_halt in its parameters and legacy_binning in its device
parameters, both as False. stored_fields leaves them out of a copy and does
not change the stored mapping, so the seal of the record still holds. A
retired field set to any other value is refused.
Classes¶
ArchiveParams
dataclass
¶
Survey parameters with the same meaning on every backend.
Every field is declared with :func:_asked or :func:_tuning, which says
whether it decides what the survey is looking for or only how the engine
goes about looking. :func:digested_fields reads that back, and the task
digest covers the first group alone, so one batch keeps one identity
wherever it runs.
Attributes:
| Name | Type | Description |
|---|---|---|
cell |
float or 'auto'
|
Niche side in barycentric units. The grid is unbounded. Two runs may set it differently inside one framework: it bins the plane the charts define rather than moving that plane, so a coarse sketch and a fine survey stay commensurable.
|
origin |
float
|
Grid origin on both axes. The niche lattice is anchored here, so zero
puts the corner of niche |
n_iters |
int
|
The survey budget cap in variations. |
seed |
int
|
RNG seed. |
sigma_slide, scale_width |
float
|
Proposal widths for the branch moves. |
p_move_spr, p_move_nni, p_move_slide, p_move_scale |
float
|
How often a walk step takes each move: a prune-regraft, a
nearest-neighbor interchange, a branch slide, and a branch scale. The
four are one distribution over the moves and must sum to 1, which is
checked and refused rather than corrected. Each carries at most three
decimal places, and a finer one is refused as well, so the sum is
checked in whole thousandths rather than against a tolerance.
The two topological moves are what carry a walk across the chart, since the niche side is set to the step one interchange makes. The defaults are not measured. No measurement of the move mix is current. |
logl_margin |
(float, optional)
|
Relative log-likelihood gate as a fixed number of nats below the best
tree found. None leaves the gate to |
logl_margin_coeff |
(float, optional)
|
Relative log-likelihood gate as this coefficient times the square root
of the site count, used when |
logl_floor |
(float, optional)
|
Absolute log-likelihood gate. Not permitted together with
|
converge |
bool
|
Halt by |
force_full_run |
bool
|
Run the full budget and ignore the halt. |
halt_rule |
str
|
The rule that decides when a survey halts: |
qd_tau |
float
|
The growth exponent at which a survey halts under the QD-score rule. It lies between 0 and 1, exclusive. |
rate_window |
int
|
Trailing window in checkpoints for the halt rates. Used only under the rate rule. |
rate_coverage_eps, rate_precision_eps |
float
|
Halt thresholds on the windowed coverage and precision rates. Used only under the rate rule. |
checkpoint_every |
int or 'auto'
|
Variations between two checkpoints. This sets the halt granularity and
the monitor resolution on both engines. |
n_walkers |
int or 'auto'
|
Parents drawn per pass. The GPU runs the walkers in parallel. The CPU
runs them in a loop. |
walk_steps |
int
|
Moves each walker makes per pass. Each move writes one candidate. |
Source code in src/hifuku/params.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | |
move_thresholds
property
¶
The move frequencies as the bounds a single draw is tested against.
The running total of the four, which is what turns one Uniform(0,1) draw into a move: below the first bound is a prune-regraft, below the second a nearest-neighbor interchange, below the third a branch slide, and at or above it a branch scale. The fourth bound is 1 and needs no test, so three are returned.
Both engines read the mix here and nowhere else, so the host and the device cannot drift apart on what a walk step does.
needs_fitting
property
¶
True while a field is still the word "auto".
The driver settles such a run before it starts, so a backend and a monitor never see parameters for which this is True.
needs_a_cell
property
¶
True while the cell is still the word "auto".
The cell comes from the chart and the gene rather than from the engine,
so the driver reads it off the run context and both engines are then
given the same grid. See :meth:with_cell.
passes_per_checkpoint
property
¶
Passes that run between two checkpoints.
A backend submits this many passes and then lets the driver read the statistics. The count is 1 or more, so a checkpoint cadence smaller than one pass still makes progress.
variation_budget
property
¶
Variations the full budget makes, counted as the driver runs them.
n_iters is the budget a caller asks for. What a run makes is a whole
number of checkpoints of a whole number of passes, so the count lands on
a multiple of the pass size and a short budget still buys one checkpoint.
This reads that count rather than n_iters, so that a caller sizing an
allocation against it is never given a figure the run can pass.
A halt can stop a survey early. This is the budget, so it is an upper bound on the variations made and on the niches they can occupy.
from_record
classmethod
¶
Rebuild the parameters a stored record names.
The retired fields are left out as :func:stored_fields says.
Source code in src/hifuku/params.py
resolve
classmethod
¶
Build the parameters from ordered override layers.
A later layer wins over an earlier one. Give the layers in this order:
the backend capability defaults, the plan file, then the command-line
flags. An unknown field name raises ValueError.
Source code in src/hifuku/params.py
with_cell
¶
These parameters with the niche side settled.
Returns them unchanged when the caller stated a cell of its own.
Source code in src/hifuku/params.py
fitted
¶
These parameters with the sizable fields settled on a walker count.
n_walkers is what the engine measured that it holds. It is taken
only where the parameters asked for it: a layer that named a count keeps
that count, because a stated shape is what the caller wanted and no
measurement overrides it.
The cadence follows the walkers. It is set so that
passes_per_checkpoint holds at
DEVICE_PASSES_PER_CHECKPOINT whatever the walker count, which keeps
a sized run the same distance from the point where too many device
passes share one parent snapshot. When a halt is asked for, the cadence
is then capped. Under the rate rule the cap makes the budget hold a
full rate_window of checkpoints: the rate rule reads a trailing
window, and a budget with fewer checkpoints than that can never fire
it. Under the QD-score rule the cap is n_iters divided by
HALT_QD_MIN_CHECKPOINTS, so that the budget holds the guard and
several checkpoints after it. The cap never takes the cadence below
one pass, which would report a cadence no engine keeps.
The grid is not settled here. The cell and the origin come from the
chart and the gene rather than from the machine, so the driver reads
them off the run context with :meth:on_grid before it asks an engine
for anything.
Returns these parameters unchanged when nothing asked to be sized.
Source code in src/hifuku/params.py
GpuParams
dataclass
¶
Survey parameters that only a device backend can use.
Attributes:
| Name | Type | Description |
|---|---|---|
extent |
float or 'auto'
|
Half-extent of the device niche allocation, measured from
A number instead is a memory bound and not a limit on the chart domain: a tree outside it is placed in the sink and dropped. The extent never changes which niche a tree is in. |
Source code in src/hifuku/params.py
resolve
classmethod
¶
Build the parameters from ordered override layers.
A later layer wins over an earlier one. An unknown field name raises
ValueError.