Bidirectional Checkpoint Conversion for Large Models: Configuration, Validation, and Rollback

    Most checkpoint conversion failures come from two issues: inconsistent sharding rules and silent numerical drift. This guide walks through a practical conversion workflow for large-model checkpoints, covering pre-conversion checks, streaming conversion, validation, parallel strategy constraints, common troubleshooting, and rollback. It includes a Python conversion skeleton, validation criteria, parallel layout considerations, and a pre-deployment checklist, with emphasis on using the same tensor/pipeline parallel configuration during conversion and loading, preserving the source checkpoint, and validating the output before promoting it.

    Checkpoint conversion failures most often come from two sources: inconsistent sharding rules and silent numerical drift. The workflow below follows the order of preparation, conversion, validation, troubleshooting, and rollback.

    Before Conversion

    Record the following in the experiment log before starting:

    1. Source and target formats: which open-source community the source checkpoint comes from, which distributed format the training framework expects, and the versions of both.
    2. Parallel configuration: tensor parallelism (TP), pipeline parallelism (PP), and related parameters. The sharding configuration used during conversion must match the configuration used for final training or deployment. Otherwise loading may fail with shape errors; if the shapes happen to match, silent numerical errors can occur.
    3. Precision: the data type used during training, such as bf16 or fp16.
    4. Disk space: the target checkpoint is usually close in size to the source checkpoint, so reserve at least the same amount of free space.
    5. Backup: keep a read-only copy of the source checkpoint. It is the only basis for rollback.
    6. Environment versions: check the training framework, CUDA, and bridge library versions against the official compatibility matrix. Specific version numbers are not listed here to avoid outdated or inaccurate information.

    Performing the Conversion

    The code below shows the conversion flow. Class names and parameters are based on the bridge library design description. Actual module paths and interfaces depend on the installed version, so replace them with the official documentation for that version.

    1. import os
    2. import sys
    3. from bridge.training.config import ConfigContainer
    4. from bridge.conversion import CheckpointConverter # Use the path from your installed version
    5. src_dir = os.environ["SRC_CKPT_DIR"] # Example: /data/ckpt/source, read-only
    6. dst_dir = os.environ["DST_CKPT_DIR"] # Example: /data/ckpt/target_tmp, must be empty
    7. final_dir = os.environ["FINAL_CKPT_DIR"] # Final directory after validation passes
    8. if not os.path.isdir(src_dir):
    9. sys.exit(f"Source checkpoint directory does not exist: {src_dir}")
    10. if os.path.exists(dst_dir) and os.listdir(dst_dir):
    11. sys.exit(f"Target directory is not empty; choose another path or clean it first: {dst_dir}")
    12. config = ConfigContainer(
    13. model_provider="auto", # Derive Provider from the model config
    14. convert_format="bf16", # Match training precision
    15. parallel_strategy={"tp": 2, "pp": 2}, # Must match loading-time parallelism
    16. )
    17. converter = CheckpointConverter(config)
    18. try:
    19. converter.stream_convert_and_validate(src_dir, dst_dir)
    20. except Exception as exc:
    21. # Assuming validation failure is raised as an exception, the script stops before rename.
    22. sys.exit(f"Conversion or validation failed; aborted: {exc}")
    23. os.rename(dst_dir, final_dir) # Rename on the same filesystem is usually atomic

    Three points are important here. First, the output directory must be empty to avoid mixing old and new files. Second, if validation fails, the script must stop and must not pass an unvalidated checkpoint downstream. Third, streaming conversion reads and writes parameters one by one, so memory peaks are lower but I/O pressure is higher. Run it on local SSD or fast network storage.

    Validation

    After conversion, perform at least three types of checks.

    Check Method Pass Criterion
    Parameter names and shapes Compare source and target parameter manifests; confirm every parameter is mapped and that shapes match. No missing or extra parameters; shapes match.
    Numerical consistency Run the source and target models on the same fixed inputs and compare output logits. Maximum absolute error is below the threshold determined by team baseline experiments.
    Functional usability Load the checkpoint in the target framework and run a short training or generation step; observe loss and output. No errors; no abnormal loss jumps.

    Do not copy a threshold from another team. First measure the error on a known-good conversion result and use that as the baseline.

    Tensor sharding is one of the easiest places for numerical checks to miss a problem. For a linear layer, column-parallel splitting distributes the weight along the output dimension, while row-parallel splitting distributes it along the input dimension. If the conversion uses the wrong sharding dimension, shapes may still match but the computation will be wrong. Therefore, passing a shape check alone is not enough; numerical validation is still required.

    Parallel Strategy Boundaries

    The bridge library supports arbitrary combinations of data parallelism and model parallelism and reuses the training core implementation. When combining dimensions, understand the cost of each one.

    Dimension What Is Split When to Use Considerations
    Tensor parallelism (TP) Individual matrix multiplications Single-layer parameters or activations do not fit in memory. Frequent communication; usually limited to a single node.
    Pipeline parallelism (PP) Different layers of the model Many layers; the whole model cannot fit on one card. Pipeline bubbles exist; micro-batch size needs tuning.
    Virtual pipeline parallelism (VPP) Multiple layer segments inside each pipeline stage To reduce PP bubbles. Scheduling becomes more complex; memory usage may increase.
    Context parallelism (CP) Sequence dimension Training and evaluation with very long sequences. Attention computation requires cross-card communication; longer sequences mean more communication.
    Expert parallelism (EP) Individual experts in a mixture-of-experts (MoE) model MoE models. Watch load balancing across experts.
    Extended tensor parallelism (ETP) Tensors inside an individual expert A single expert is too large. Must satisfy divisibility constraints when combined with TP.

    The product of these dimensions must match the total number of available GPUs, and exact constraints depend on the framework. For TP and PP, the product must divide evenly into the number of available GPUs. For rules involving CP, EP, and other combinations, consult the documentation for the corresponding version.

    Common Failures and Rollback

    • Out of memory (OOM): Check whether the conversion process loads the whole checkpoint at once. If so, switch to streaming. If OOM occurs during training, increase PP, reduce micro-batch size, or check whether activation recomputation is enabled.
    • Precision drift: Check whether unnecessary dtype conversions happened, such as an fp32 parameter being stored as fp16 and then read back. Compare precision-sensitive layers such as LayerNorm.
    • Shape mismatch: Verify that TP and PP parameters are the same during conversion and loading.
    • Validation failure: Locate the first layer where the error exceeds the threshold. In most cases, the problem is in sharding rules or parameter mapping.

    For rollback, write the converted result to a temporary directory first and rename it to the final directory only after validation passes. On failure, manually delete the temporary directory and leave the source checkpoint untouched. In this way, downstream systems see either a complete, validated checkpoint or nothing.

    Feature Evolution Notes

    FP8 and MXFP4 export can reduce storage and memory usage, but they depend on hardware support. FP8 usually requires a newer NVIDIA GPU architecture; confirm support on the deployment platform. After quantization, compare perplexity or task metrics on a fixed test set. If the metric degradation exceeds the acceptable business range, fall back to higher precision.

    Sequence packing reduces padding waste and improves GPU utilization, especially for vision-language model (VLM) data. After packing, verify that attention masks isolate different samples. Otherwise, samples can see each other and training results will be contaminated.

    When evaluation is interleaved with training, fix random seeds and data order so that deterministic recipes produce reproducible results.

    Cloud Deployment and Pre-Launch Checklist

    In multi-node scenarios, you can host checkpoints on object storage or a shared file system and use container orchestration to allocate GPU and memory resources for conversion jobs. Conversion is I/O-intensive, so schedule it separately from training jobs to avoid competing for training node bandwidth. Monitor memory watermark, disk throughput, and GPU utilization to detect problems before they grow.

    Pre-launch checklist:

    1. Source checkpoint is backed up and read-only.
    2. Conversion and loading use the same TP, PP, and precision settings.
    3. Output directory is empty and the result is first written to a temporary path.
    4. Parameter manifest, numerical error, and functional tests all pass.
    5. Rename to the final directory only after validation passes, and record the version and threshold.