REML through packed ssSNPBLUP equations
The experimental standalone YAML interface can estimate unstructured genetic and residual covariance matrices using the same conditional packed PCG equations as prediction. Natural covariance matrices in YAML are starting values. Numerical computation belongs to greml; the Python frontend validates inputs, prepares files and labels outputs. Existing R interfaces are unchanged.
Model and computation
The route supports an ordinary pedigree or a metafounder pedigree with supplied Γ, one genetic channel per trait, and a shared unstructured residual covariance across independent observation blocks. Missing traits are integrated using the observed submatrix of the current residual covariance. Fixed effects, including reference-coded inherited fixed-group contrasts, and additional identity random effects are retained. analysis.estimate selects whole genetic, residual and additional identity-effect covariance blocks; omitted blocks remain fixed. Genetic channels may include random-regression coefficients and need not have the same width as the residual trait vector. Marker centering, normalization, genomic scaling, ridge/blend and any pedigree adjustment are held fixed throughout REML. This is conditional on the supplied genomic construction, rather than simultaneous estimation of its base parameters.
Exact AI-REML in animal equations from the same PLINK inputs
Set execution.formulation: ss_gblup and analysis.task: reml on a single-step model that declares a PLINK input and genomic settings. GeneSuite prepares the same genomic covariance implied by the marker equations and computes exact likelihoods and traces with CHOLMOD selected inversion. The default execution uses threads: {default: 4, factor: 1, relationship: 1}. Leave packed probe and PCG controls out of the estimation recipe.
This route also supports the compiled AR(1), exponential, factor-analytic, genetic-group and supplied metafounder structures. The optional execution.relationship_workspace_bytes bounds owned genomic preparation and explicit pedigree-precision assembly arrays separately. The downstream mixed-model plan, solve and factorization can use additional RAM. The exact genomic correction can be dense among genotyped animals.
Use the same model and relationship in a separate ss_snp BLUP recipe and set covariances.from_fit to the accepted REML run.json. The handoff checks the labelled covariances and, where applicable, the serial shape or factor-analytic parameters.
Packed covariance estimation
EM-REML remains the default. Conditional genetic coordinates have independent prior blocks with row precisions Qnn, the genomic residual precision and marker identity, all sharing the genetic covariance K. Each update uses posterior second moments of those coordinates, including coefficient covariance from the fixed-effect equations. Dividing their contracted moments by the total number of genetic and marker levels gives the genetic EM update. Residual updates use posterior residual moments, with missing components integrated conditionally. Fixed covariance blocks retain their supplied natural values exactly.
The exact pedigree factor, ancestral reduction and packed genotype provider are reused across covariance states. The current implementation copies the sparse topology/maps when making a new numeric state; it does not refactor the pedigree. Record precisions, right-hand sides and the PCG preconditioner are refreshed. Qnn reuse avoids another pedigree factor for each new preconditioner; the shifted-pedigree option does build its covariance-dependent preconditioner factor. The existing final prediction solve independently checks the fitted model.
The fit does not assemble a global equation matrix, full inverse, dense genomic relationship or marker cross-product matrix. The optional exact likelihood reference materializes bounded small coefficient matrices. Source records and trait-pattern metadata, sparse maps and factors, coefficient vectors and the selected record cache still consume memory. Old/new numeric states can coexist during refresh; this is not a bound on process RSS.
YAML controls
Use the complete packed REML example (models/multitrait-packed-reml.yml). The main estimation controls are:
analysis:
task: reml
estimate: [genetic, residual]
optimizer:
maximum_iterations: 200
score_tolerance: 1.0e-6
step_fraction: 1.0
traces:
method: exact
maximum_solves: 10000estimate selects whole covariance blocks; omit a block to fix it. Packed EM does not yet support fixing individual Cholesky coordinates. step_fraction is the EM update fraction in (0,1], not a likelihood line-search control.
Exact traces solve every conditional coefficient unit column at each covariance state. They are intended for small reference problems, not industrial data. For a bounded stochastic calculation, replace the trace controls explicitly:
traces:
method: stochastic
probes: 64
seed: 4401
maximum_solves: 10000
maximum_score_mcse: 0.001The stochastic option uses a common deterministic Rademacher probe bank across covariance states. analysis.traces.block_width selects one (default) or four columns per exclusive packed operator solve. Width four uses the existing multiple-RHS block-PCG solver; it does not launch concurrent scalar operators. The example numbers above are syntax examples, not a calibrated industrial recommendation. Score error is in natural variance/covariance coordinates and depends on data and scaling; the probe count alone does not establish adequate precision.
Each state uses one response solve plus probes stochastic solves, or one plus the conditional coefficient dimension for exact traces. maximum_solves caps their total across all states. It excludes the initial setup and subsequent independent final prediction solve, which have separate timing/iteration metrics. Every REML solve must pass both transformed and original augmented equation residual checks. The internal solve uses a numerical margin; the requested acceptance tolerances are unchanged.
RHE initialization and average information
An explicit analysis.optimizer.method: ai selects the development packed average-information route for one genetic effect, one unstructured residual block and eligible independent identity effects such as permanent environment. em retains the existing optimizer. Both support partially observed traits, repeated occasions and whole-block free/fixed selection. AI with additional effects uses absolute_score precision and exact or unstructured stochastic traces. stochastic_ai precision and structured trait probes require the two-block genetic and residual model.
Run ordinary record RHE separately, then use covariances: {from_fit: results/vc/run.json} in the REML recipe. The reader checks acceptance, the covariance CSV hash, trait order, labelled coordinates, model structure, genotype identity and refinement input hashes. describe and the fit receipt identify the effective initializer and optimizer. An accepted REML receipt can supply the same labelled handoff to a separate task: solve recipe. Failed refinements cannot supply qualified BLUP covariance values.
AI reuses the response and score state. Genetic and independent-effect derivative records use Z (D K^-1) u with their own covariance blocks. Residual derivatives use the observed trait submatrix at each occasion. Each free covariance coordinate adds a projection solve, including both entries of an off-diagonal derivative. The information is (w_i' R_obs^-1 w_j - b_i' C^-1 b_j)/2. Steps preserve positive-definite covariances and use bounded halving on the information-scaled score merit. This search does not certify likelihood ascent or global optimality.
AI columns and failed block attempts count against maximum_solves. Numerical block breakdown can request explicit scalar recovery at unchanged tolerances; counts, reason and cost are reported. Cancellation and workspace failures do not trigger recovery. Phase timings distinguish response, trace and AI solves from AI derivative preparation. Every returned column retains both equation residual gates and stochastic convergence retains independent final validation.
A small same-model reference with partial traits and repeated animals agrees with an independent dense REML score, direct AI matrix and proposed update at a nonstationary covariance state. This establishes bounded numerical agreement; it does not establish accepted five-trait catalogue fits or industrial precision.
Convergence requires the maximum absolute free score plus twice the maximum free-score Monte Carlo standard error to be no larger than score_tolerance. The MCSE must also meet maximum_score_mcse. Exact traces have zero sampling MCSE, subject to PCG numerical error. A stochastic moment matrix that is not SPD is rejected without clipping, jitter, silent probe increases or an exact fallback.
A stochastic candidate must pass one final score/precision check using an independent probe bank. Its additional response and probe solves count against the same total cap, and history marks the validation state. Failed independent validation rejects the fit; its probes never guide another update or select another validation bank. This check can add a qualification state after the last permitted covariance-update state. Score convergence does not establish uniqueness or statistical identifiability of an arbitrary covariance model.
Results and qualification
Results include variance_components.csv, parameters.csv, reml_history.csv, likelihood.json and convergence.json, plus native natural-score and score-MCSE vectors. History records scores, MCSE and cumulative solve counts. Converged fits then produce the ordinary prediction tables. Failed fits retain diagnostic parameter states and history but publish no qualified prediction tables.
Likelihood reporting is optional, as described below. It does not control EM updates or replace score convergence. Exact EM has its usual likelihood monotonicity, but stochastic moment updates carry no likelihood-ascent certificate. Reported score MCSE describes trace estimation at the evaluated parameter state; it does not include variance-component estimation uncertainty or provide confidence intervals for the fitted parameters.
Focused tests compare natural scores with an independent dense restricted likelihood and finite differences, verify a joint analytic covariance optimum, check missing-trait EM updates and fitted predictions, and exercise stochastic work/precision rejection. This is not a 50K or industrial runtime qualification. EM can require many covariance updates, each with many PCG solves; prediction timings cannot be reused as REML runtime estimates. The native reml stage covers every covariance evaluation, final stochastic check and optional likelihood diagnostic. reml_likelihood reports the determinant diagnostic separately. Existing fine-grained data/operator profile counters are not an aggregate REML profile; use that stage and the explicit solve totals when assessing cost.
FA, serial/grouped residuals, random genetic groups, fitted Γ, coordinate constraints and joint PEV output are outside the current packed REML interface. The existing compiled sparse-direct REML implementation retains its broader covariance/constraint support and likelihood reporting.
Explicit stochastic AI precision
The development analysis.precision.method: stochastic_ai route reuses the native multi-trait pedigree stationarity contract. It requires one genetic effect, matching genetic/residual trait order and both covariance blocks free. For example, replace the absolute score and MCSE controls with:
optimizer:
method: ai
maximum_iterations: 150
step_fraction: 1.0
traces:
method: stochastic
probes: 16
maximum_probes: 64
certification_probes: 128
seed: 42
maximum_solves: 20000
block_width: 4
precision:
method: stochastic_aiThese probe counts illustrate syntax; they do not establish sufficient precision for the catalogue case. Omit optimizer.score_tolerance and traces.maximum_score_mcse for this choice. The existing absolute_score contract remains the default and retains those controls.
The new route accumulates the full joint Monte Carlo covariance of the score, then transforms score, AI and uncertainty to log-Cholesky coordinates. The existing native contract checks curvature and Newton scales, compatibility with a zero score, stochastic precision and covariance identifiability separately. A small noisy score alone cannot qualify convergence. Defaults are raw score tolerance 1e-6, curvature and Newton tolerances 1e-4, maximum convergence uncertainty ratio 0.1, maximum step uncertainty ratio 1, full-step uncertainty ratio 0.1 and stationarity multiplier 2. These are existing native defaults, not a new calibration for large packed models.
When precision is insufficient, the trace bank doubles up to maximum_probes while retaining its deterministic prefix. The response, numeric model, preconditioner and AI projection solves are reused at that covariance state. All trace columns consume maximum_solves. Set certification_probes to choose the independent final bank size for packed stochastic REML. Omit it to use the last optimization prefix. Certification uses a separate seed and reports its requested and completed counts separately. A stop before the bank can be funded is distinguishable from a completed bank that fails its checks.
The convergence uncertainty ratio uses the log-Cholesky parameter scale. The direction uncertainty ratio uses the proposed Newton step. If fitting stops, the result identifies the last admitted covariance and its matching score. Rejected trials have separate diagnostics. EBV export requires successful certification for stochastic REML.
Small independent dense references cover two and five traits with missing values and repeated records. An analytic fit tests stochastic stationarity and the independent final bank. Industrial precision and accepted-fit timing remain subject to the recorded benchmark results. Monte Carlo Newton methods require an explicit treatment of stopping uncertainty; see Matilainen et al. (2013).
For matching genetic/residual widths and one genetic effect, an explicit analysis.traces.probing: trait_complete partitions conditional coefficients by channel position. A complete group contains one masked Rademacher column for each of the q channels. Summing the group’s outer products has expectation equal to the identity, so the trace remains unbiased; cross-color quadratic terms contribute no sampling noise. This is stochastic probing with a fixed partition, rather than a data-derived graph coloring. General stochastic probing is analyzed by Frommer, Rinelli and Schweitzer.
With this choice, probes and maximum_probes count independent complete groups. Every group costs q right-hand-side columns, all charged to maximum_solves. MCSE and joint score covariance use the summed group contributions as the independent samples; the q columns are never treated as independent replicates. Block width controls how these columns are solved and does not change the random groups. The default unstructured probing retains one column per independent probe. Dense references verify the grouped score and its two-pass Monte Carlo covariance for two and five traits at both block widths. Large-model precision gains must be measured separately.
Optional restricted-likelihood change
Omit analysis.likelihood for zero global determinant/operator-product work. To report the restricted-likelihood change from the supplied starting covariances to the final fitted covariances, add one block under analysis:
likelihood:
method: slq
maximum_operator_products: 6144Defaults are probes: 32, seed: 4402, lanczos_steps: 32, check_steps: 64, maximum_mcse: 1.0 and maximum_depth_change: 0.5. All can be set explicitly. These illustrate controls, not calibrated production precision. The work cap must cover 2 * probes * (lanczos_steps + check_steps) equivalent vector products: both start/final states at both depths. It is independent of the REML trace-solve cap. Earlier Lanczos breakdown can reduce actual products.
The matrix-free stochastic Lanczos quadrature (SLQ) diagnostic uses common Rademacher probes at the two covariance states and both depths, with a seed stream separate from the score traces. Paired differences give an MCSE for the likelihood change. depth_change is the absolute change in the estimate when increasing Lanczos depth; it is a sensitivity check, not a truncation error bound. A small sampling MCSE alone cannot qualify Lanczos accuracy.
For a small exact reference, use:
likelihood:
method: exact
maximum_dimension: 256This materializes and factors the start/final conditional coefficient matrices, using 2 * coefficient_dimension products. The explicit dimension cap protects against accidentally selecting a dense reference on a large model. It is a caller-selected work/shape limit, not an application RAM ceiling.
Both methods evaluate -0.5 times the change in log|R_observed| + (n + marker_columns) log|K| + log|C| + y'Py. C is the full conditional coefficient matrix, including fixed and nuisance effects. Observed residual submatrices retain missing-trait covariance. The genetic normalization includes latent marker levels. Other prior and coordinate constants cancel because data, design, genomic construction and fixed additional covariances are unchanged. A stable residual-plus-prior quadratic evaluates y'Py. The initial numeric model is retained for this comparison, so requesting likelihood can increase memory.
likelihood.json and run.json.estimation.likelihood report scale: relative_to_start, value, mcse, depth_change, operator products, seconds, message and a status:
not_requested: no diagnostic requested.not_attempted: covariance fitting did not reach convergence.qualified: the diagnostic completed and, for SLQ, met the requested targets.unqualified: a finite SLQ estimate missed one or both precision targets.failed: a numerical/resource diagnostic failed; no value is published.
Unqualified/failed optional likelihood leaves a separately qualified covariance fit and predictions accepted. No probe increase or exact fallback occurs. This is a start-to-final diagnostic, not an absolute likelihood, per-iteration ascent certificate, or evidence for a global optimum. Do not compare its raw value across models with different starting covariances, fixed designs, data or genomic construction. The compiled sparse-direct route reports its existing absolute restricted likelihood with scale: absolute in the same output block.
The complete exact example (models/multitrait-packed-reml.yml) and SLQ example (models/multitrait-packed-reml-slq.yml) share inputs. Small tests compare exact changes with an independent marginal likelihood (including nonzero markers and missing traits), and paired SLQ estimates/MCSE with an eigenvalue oracle. No industrial likelihood runtime or precision qualification follows from those checks.
Additional effects and random-regression covariances
Packed REML also estimates unstructured covariance matrices for independent additional-effect levels. It refreshes their small precision templates with each covariance state while preserving level assignments and the pedigree factor. The EM sufficient statistic is the sum of posterior mean outer-products and conditional covariance blocks over those levels. The same exact or stochastic inverse actions supply all covariance-block moments. AI uses the same moments for scores and keeps each free covariance block positive definite during the line search.
Genetic random-regression channels can have a different dimension from the residual trait vector. Covariance matrices retain their declared channel order; residual matrices retain trait order. Whole-block analysis.estimate selection, solve budgets, score/MCSE qualification and optional likelihood controls are unchanged. The likelihood diagnostic includes the determinant changes of every estimated additional-effect prior.
See the complete additional-effect example (models/packed-additional-covariance-reml.yml). Small exact references cover multivariate additional-effect scores, EM updates, the AI matrix and direction, analytic optima, likelihood changes, fixed-block preservation, prediction refits and random-regression channel dimensions. Fit qualification still depends on identifiability and trace precision for the dataset. FA and serial-parameter REML remain on the compiled route.