﻿# Prefect map pairs iterable inputs and broadcasts unmapped data

Prefect map pairs equal-length iterable arguments by position; shared iterable configuration needs unmapped, while a Cartesian product must be prepared explicitly.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/guide-prefect-map-unmapped-paired-inputs/
Language: en

## Describe the rows before submitting work

A classification task receives document text, its language and a shared list of allowed labels. The intended unit of work is a document with its own language and the complete label set. Prefect's [task mapping reference](https://reference.prefect.io/prefect/tasks/) requires mapped iterables to have equal lengths. Mapping follows their corresponding positions; it does not automatically generate every combination of all supplied lists.

## Pair related fields deliberately

The [task runner implementation](https://raw.githubusercontent.com/PrefectHQ/prefect/main/src/prefect/task_runners.py) collects iterable parameters, checks their lengths and constructs each call from values at the same position. A mismatch raises an error rather than silently dropping a tail. Equal lengths still do not prove correct relationships: documents and languages sorted independently can have matching sizes but incorrect pairs. Build related fields from the same source records or retain an explicit document identifier for validation.

## Keep a shared list whole

The [annotation reference](https://reference.prefect.io/prefect/utilities/annotations/) defines `unmapped` for passing an iterable unchanged to all generated runs. Wrap the shared label list when each document needs that entire configuration. Without this distinction, an iterable configuration can be treated as another mapped input, producing length errors or unintended element-wise values. Ordinary non-iterable constants are treated as static, but a list's meaning should not depend on a reader guessing that it is configuration.

## Prepare combinations when that is the actual experiment

If the task should evaluate every document under every prompt variant, construct the intended combination records explicitly before submission. This is a different workload from positional pairing. Preserve document and variant identifiers in each result so later aggregation can distinguish missing evaluations and failed evaluations. [Task budgets](/journal/learn-codex-task-budgets/) should reflect the generated workload rather than the length of just one original input list.

## Review shape before interpreting quality

Inspect a representative generated call to confirm that it receives the correct document, matching language and full label set. Then retrieve and interpret execution results separately from submission. [Tool observations](/journal/learn-codex-tool-observation/) help retain those concrete inputs. A poor classification caused by a split configuration or mismatched language is an input-construction defect; changing the model cannot establish that the intended mapping experiment was ever run.
