Skip to main content

Test map

The repository defines the v1 suite plus v2 optimizer, systems, and asynchronous distributed tests. The generated source inventory is authoritative for the current count. The tables below map the v1 and v2 tests to their direct evidence.

Configuration tests​

tests/test_config.py​

TestDirect assertionPrimary source
test_config_yaml_aliases_and_accumulationTop-level run aliases, derived accumulation, compile mappingconfig.py
test_config_round_tripRedacted YAML save/load equalityconfig.py
test_unknown_keys_and_invalid_batchUnknown root and invalid batch divisibility failconfig.py
test_distributed_role_inferenceEnabled repo-bearing role becomes masterconfig.py
test_secret_can_be_redacted_for_serializationExplicit redaction and redacted save()config.py

Not directly tested:

  • rare section value constraints;
  • JSON and inline source loading;
  • hub/diloco aliases;
  • top-level versus nested run precedence;
  • malformed YAML/JSON normalization.

Model tests​

tests/test_model.py​

TestDirect assertionPrimary source
test_reference_transformer_forward_and_lossLogits/loss shapes and backward gradientsmodel.py
test_reference_transformer_weight_tying_and_checkpoint_hookTied storage and block flag propagationmodel.py
test_config_dimensionsGPTConfig.d_ff defaults to 4 * d_modelmodel.py

Not directly tested:

  • RoPE correctness;
  • GQA equivalence/performance;
  • SDPA mask behavior;
  • causality and label alignment;
  • SwiGLU shape;
  • dropout/training mode;
  • untied weights;
  • invalid context lengths.

Precision and data tests​

tests/test_precision_data.py​

TestDirect assertionPrimary source
test_cpu_precision_defaults_to_fp32CPU auto FP32 and no scalerprecision.py
test_cpu_precision_defaults_to_fp32 second assertionExplicit CPU FP16 falls back to FP32precision.py
test_streaming_text_dataset_and_tuple_collateText block shape and tuple stackingdata.py

Not directly tested:

  • CUDA/MPS;
  • CPU BF16;
  • fused AdamW;
  • scaler creation/restoration;
  • DataLoader worker/prefetch/pin behavior;
  • custom tokenizer;
  • serialized datasets;
  • empty streams.

Training tests​

tests/test_training.py​

TestDirect assertionPrimary source
test_trainer_runs_with_accumulation_and_checkpointThree CPU steps, three metrics, checkpoint pointertrainer.py, checkpoint.py
test_accumulation_scales_gradients_and_reports_mean_lossGradient scaling and mean loss valuetrainer.py
test_runtime_builds_reference_modelReference composition and one stepruntime.py, model.py

Not directly tested:

  • checkpoint contents and full resume equivalence;
  • DataLoader position;
  • scheduler trajectory;
  • clipping;
  • compile fallback;
  • every model output form;
  • real CLI train error mapping;
  • real coordinator lifecycle with Hub credentials.

Tensor and outer optimizer tests​

tests/test_distributed.py​

TestDirect assertionPrimary source
test_pseudo_gradient_direction_and_averageBaseline-current direction and equal meandistributed/tensors.py
test_nesterov_outer_optimizerFirst update equals 1.9 × gradient at momentum 0.9distributed/outer.py
test_delta_path_parserValid node delta and rejected global pathdistributed/tensors.py
test_tied_model_state_can_be_safetensors_serializedTied state serializes after clonedistributed/tensors.py

Not directly tested:

  • key/shape mismatch errors;
  • non-floating/complex behavior;
  • delta metadata parsing;
  • outer momentum persistence;
  • large/NaN values.

Hub tests​

tests/test_hub.py​

TestDirect assertionPrimary source
test_hub_transport_round_tripFake global and delta round trip plus write grantdistributed/hub.py
test_master_skips_corrupt_delta_and_persists_processed_setCorrupt delta is skipped and no state file is createddistributed/outer.py

The second test does not actually verify successful processed-set persistence despite its name.

Not directly tested:

  • retry/backoff;
  • cached metadata fallback;
  • real Hugging Face SDK versions;
  • collaborator API compatibility;
  • successful aggregation/publication;
  • duplicate suppression;
  • rollback/recovery;
  • background thread lifecycle.

v2 test modules​

FileCoverage
tests/test_v2_optimizers.pyConfig, Newton–Schulz, Muon+, routing, hybrid/cautious stepping, sparse rejection
tests/test_v2_systems.pyShape profiles, causal alignment, scheduler default, CPU OOO fallback
tests/test_v2_distributed.pyNon-blocking dispatch, async poll, prepared resume, queue skip, synchronous compatibility, failure baseline retention
tests/test_v2_release.pyVersion sync, CLI redaction, v2 config serialization

CUDA-only stream parity and hardware benchmarks are not represented as CPU unit-test evidence.

Module evidence matrix​

ModuleDirect testsEvidence level
config.pytest_config.pyPartial
model.pytest_model.pyPartial
precision.pytest_precision_data.pyCPU partial
data.pytest_precision_data.py, test_training.pyPartial
trainer.pytest_training.pyCPU partial
runtime.pytest_training.pyMinimal
checkpoint.pytest_training.pyBasic file/pointer only
distributed/tensors.pytest_distributed.pyBasic
distributed/outer.pytest_distributed.py, test_hub.py, test_v2_distributed.pyBasic plus lock-scope tests
distributed/hub.pytest_hub.pyFake happy path
distributed/diloco.pytest_v2_distributed.pyAsync dispatch/poll/resume coverage
distributed/__init__.pyIndirect importsNo direct test
cli.pytest_v2_release.pyValidation/redaction coverage
registry.pyNoneNo direct test
profiling.pyNoneNo direct test
hooks.pyNoneNo direct test
integrations.pyNoneNo direct test
module_utils.pyIndirect model hook onlyNo helper test
__init__.pyNoneNo export/lazy-load test
__main__.pyNoneNo module-entry test

Test philosophy​

Tests are intended to be CPU-only and use fake Hub APIs. They make no real network calls and require no credentials. Hardware-specific claims remain implementation-derived unless directly exercised.

The complete source-level inventory also includes every test function generated from the AST. See Generated Source Inventory.

Related: Testing, Source Coverage, and Security and Limitations.