Test Structure
For each strategy, the test suite:- Loads a fixed pair of small reference models.
- Executes the merge with fixed random seeds and fixed parameters.
- Compares output tensors against a precomputed golden reference.
- Reports PASS if all tensors are within tolerance, FAIL otherwise.
Strategies and Tolerances
Tolerance Policy
Tolerance is relative to the maximum absolute value of the reference tensor:Golden Output Generation
Golden references are generated once using fp32 arithmetic on a fixed CPU backend. The generation script is versioned in ArtifactStore. Regeneration requires a manual trigger and a code review. Golden references are stored as safetensors files with SHA-256 checksums.Edge Cases
The test suite covers these edge cases for every strategy:- Merging identical models (output must equal input).
- Merging models with zero delta (output must equal input).
- Single-layer models.
- Models with tied embeddings.
- Models with different vocabularies (must fail compatibility before merge).
- Empty parameter sets (must error gracefully).
Regression Detection
Any change to TensorEngine, MergeEngine, or a MergeStrategy implementation must pass the full merge test suite. A failure blocks the merge request. The CI job uploads diff tensors to ArtifactStore for inspection.Integration Points
- TensorEngine: merge tests exercise the full tensor operation stack.
- Numerical Testing: tolerance thresholds are shared with the numerical test suite.
- CI: merge tests run on every commit and nightly.
- ArtifactStore: stores golden references, test outputs, and diff artifacts.