﻿# Snakemake checkpoints: discovering downstream jobs is different from resuming model training

Use Snakemake checkpoints for data-dependent workflow expansion, such as dynamically discovered dataset shards, without confusing DAG reevaluation with optimizer-state recovery.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-snakemake-checkpoint-dynamic-dag-not-training-state/
Language: en

## The number of dataset shards is unknown

A preprocessing operation partitions a corpus according to discovered language groups. The downstream embedding jobs cannot be enumerated correctly before that operation produces its actual output set. This is a workflow-graph discovery problem, even though the word checkpoint may sound like saving a neural network during training.

State what must become known: output shard identities and the downstream jobs that consume them. That is different from optimizer parameters, random generators or progress inside a model's training loop.

## Checkpoints trigger dependency reevaluation

The [Snakemake rule reference](https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html) describes checkpoints and reevaluation of input functions after checkpoint completion. Accessing checkpoint output through the documented mechanism establishes the relationship needed to discover downstream inputs once the producer finishes.

Do not replace that relationship with an eager filesystem scan during initial workflow construction. An early scan can observe an empty or stale directory and describe the wrong job set. The timing of discovery is part of the dependency contract.

## The graph still needs explicit file relationships

The [basic workflow tutorial](https://snakemake.readthedocs.io/en/stable/tutorial/basics.html) explains how file names connect producers and consumers. After dynamic discovery, the resulting paths should still identify the intended shard inputs and downstream targets unambiguously.

[Distributed shard overlap](/journal/data-guide-distributed-shard-worker-overlap/) remains relevant. Discovering a set of filenames does not prove that their contents are disjoint or cover the intended corpus. Preserve shard identity and membership evidence independently of successful graph expansion.

## Training-state recovery is an application concern

A model training process can write its own checkpoint artifact, but that format and restore behavior belong to the training framework and application. [Random-state replay](/journal/data-guide-data-rng-state-replay/) shows why model weights alone are not the complete state required for some reproducible continuations.

Keep the terms qualified in operational notes: a Snakemake checkpoint controls data-dependent graph reevaluation, while a training checkpoint records application state. A workflow can contain both without either mechanism automatically implementing the other.

## Validate discovery after the producing operation

Use a small producer that creates a deliberately variable shard set, then inspect the downstream jobs after it finishes. The [command-line guide](https://snakemake.readthedocs.io/en/stable/executing/cli.html) documents planning and execution inspection tools; interpret an initial view with the knowledge that checkpoint-dependent inputs are not all resolved yet.

Confirm the final job set and resulting artifact membership against the intended corpus. The useful success criterion is accurate discovery and dependency execution, not a claim that interrupted neural-network training can resume without a separately designed state artifact.
