﻿# Snakemake model dependencies: a filename in params is not a declared input file edge

Declare model and tokenizer files as Snakemake inputs when rules consume their contents, distinguishing file dependencies from non-file parameters and wildcard naming.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-snakemake-model-file-input-versus-params/
Language: en

## The producer is absent from the planned graph

An inference rule reads a model file whose path appears only in params. A separate rule could generate that model, but Snakemake cannot infer the intended file dependency merely because the shell command later uses a path-shaped parameter. The command's configuration and the workflow's input edges are different descriptions.

List every file whose contents the inference actually consumes. Weights, tokenizer assets and a preprocessing vocabulary can each need explicit input relationships. A convenient path string should not hide a dependency required to explain how the result was produced.

## File matching builds the graph

The [basic workflow tutorial](https://snakemake.readthedocs.io/en/stable/tutorial/basics.html) explains dependency determination by matching rule input and output filenames. The [rule reference](https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html) distinguishes file inputs from non-file parameters and describes wildcard expansion.

Use input declarations for consumed files and params for values that configure the operation. This does not mean parameter changes are never tracked; it means a parameter is not interchangeable with a file edge for finding producers and representing file dependencies.

## Wildcards name jobs rather than prove content identity

A model wildcard in an output path can distinguish job names without proving that each job reads a different model artifact. Inspect the expanded input mapping for the requested target. The displayed candidate name and the resolved file identity should agree intentionally.

Connect model-side files through an [artifact manifest](/journal/tokenizer-artifact-release-manifest/). A wildcard called candidate does not establish that weights and tokenizer belong to the same release, nor that a mutable file behind that name stayed unchanged.

## Configuration should support the dependency contract

The [configuration guide](https://snakemake.readthedocs.io/en/stable/snakefiles/configuration.html) describes external configuration and validation. Resolve configuration values into deliberate rule inputs where they name consumed data. Validate the mapping instead of leaving the shell command to discover an unavailable model only at execution time.

For dataset tables, apply [explicit schema contracts](/journal/data-guide-frictionless-table-schema/) separately. A correctly declared input edge establishes graph structure, while schema and semantic evidence establish whether the file is appropriate for the model's actual input interpretation.

## Inspect an intentionally missing model

Request a small inference target with the model file absent but its producer available. Review whether the planned graph includes that producer through the declared input. This exposes hidden path parameters without requiring a full expensive model run.

Then verify the actual resolved artifact used by inference. The resulting explanation should connect requested target, expanded job and consumed model files rather than relying on the apparent meaning of a parameter's name.
