Q-TensorFormer / reports /CHECKPOINT_INTEGRITY.md
Premchandyadav369
Complete 16-phase scientific hardening, strict checkpoint audit, empirical benchmarks, and documentation
7aefd9e
|
Raw History Blame Contribute Delete
3.54 kB

Phase Two — Checkpoint Integrity & Strict-Load Audit Report

1. Forensic Inspection of qtensorformer_small.pt

Data source: results/raw/checkpoint_integrity.json (MEASURED).

  • File Path: qtensorformer_small.pt
  • File Size: 5,432,305 bytes (5.18 MB)
  • SHA-256 Digest: 9a4e61f70ba084e6c4e38b3e7cc8479d1f2ff43c51fff7bcf2ee07191dc3b0db
  • Git Provenance: Committed in 82fd973c (May 6, 2026) from an external container (/app/qtensorformer).
  • Top-Level Dictionary Keys: ['model_state_dict', 'config', 'params', 'baseline_params', 'compression_ratio', 'version']
  • Recorded Metadata:
    • version: "1.0.0"
    • params: 1,347,747
    • baseline_params: 16,146,432
    • compression_ratio: 11.9803
  • Actual State-Dict Structure:
    • Contains 113 tensors summing to exactly 1,347,747 elements.
    • Sample keys:
      • embeddings.token_embedding.weight ([10000, 128])
      • embeddings.position_embedding.weight ([64, 128])
      • embeddings.quantum_enhancer.qlayer.weights ([2, 4])
      • blocks.0.attention.q_proj.weight ([128, 128])
      • blocks.0.ffn.layer.weight.factors.factor_0 .. factor_5 (TensorLy FactorizedTensor format)
      • blocks.0.ffn.rank_scheduler.net.0.weight

2. Canonical strict=True Loading Test Results

Per Phase Two rules, model.load_state_dict(sd, strict=True) was executed against the repository's canonical implementations without altering checkpoint tensors or model dimensions:

Target Model Class Config Class Model Params Model Keys Checkpoint Keys Exact Key Overlap Missing Keys Unexpected Keys strict=True Result
src.models.QTensorFormer src.config.ModelConfig 1,524,186 185 113 0 (0.0%) 185 113 FAIL (RuntimeError)
modeling_qtensorformer.QTensorFormerForCausalLM QTensorFormerConfig 2,767,296 52 113 0 (0.0%) 52 113 FAIL (RuntimeError)

Why qtensorformer_small.pt Cannot Load Under strict=True

  1. Incompatible Tensor Factorization Library: qtensorformer_small.pt stores FFN weights using tensorly / tltorch 6-core factors.factor_0..5 naming on a single fused FFN layer (blocks.i.ffn.layer), whereas src.tensor_layers.TTFeedForward uses two 4-core pure-PyTorch TTLinear projections (blocks.i.tt_ffn.up_proj.cores.0..3 and blocks.i.tt_ffn.down_proj.cores.0..3).
  2. Different Module Hierarchy: qtensorformer_small.pt uses embeddings.token_embedding and blocks.i.ffn.rank_scheduler.net, whereas src.models.QTensorFormer uses embedding.weight, blocks.i.info_engine, and blocks.i.allocator.

3. Canonical Round-Trip strict=True Verification

While the legacy external file qtensorformer_small.pt is incompatible, both canonical repository architectures pass strict=True save/load round-trip verification (results/raw/checkpoint_integrity.json and scripts/smoke_test.py):

Canonical Implementation Serialization Method Reload Method strict=True Result Output Numerical Match
src.models.QTensorFormer torch.save(model.state_dict(), path) model.load_state_dict(sd, strict=True) PASS (185/185 keys) Max diff 0.0
modeling_qtensorformer.QTensorFormerForCausalLM model.save_pretrained(dir) QTensorFormerForCausalLM.from_pretrained(dir) PASS (52/52 keys) Max diff < 1e-6