Principle:416rehman DeepZero Processor Contract
| Knowledge Sources | |
|---|---|
| Domains | Pipeline_Orchestration, Software_Architecture |
| Last Updated | 2026-10-27 00:00 GMT |
Overview
A typed four-lane processor contract where each pipeline stage declares its relationship to the sample stream (1→N, 1:1, N→ranked, N:1 batch) and its outputs, enabling static validation of pipeline graphs before execution.
Description
A processor contract defines the interface between the pipeline engine and the stages that do the actual work. DeepZero uses four lanes because different analysis steps have fundamentally different relationships to the sample stream:
- Ingest (1→N): discovers samples from a source. One invocation produces N samples. Always the first stage.
- Map (1:1): transforms one sample at a time. The engine fans out across samples in parallel. Thread-safe by contract—no shared mutable state.
- Reduce (N→ranked): sees all active samples at once and decides which survive. A global sync barrier that cannot be auto-chunked because it requires interdependence.
- BulkMap (N:1 batch): processes all samples in one external invocation. More efficient than Map when the external process has high startup cost (e.g., semgrep CLI).
Each processor declares a Config dataclass that names its accepted YAML keys, and a provides tuple listing the data keys and artifact names downstream stages can reference. This enables static validation: deepzero validate checks every Jinja2 prompt against the names its upstream stages produce, catching empty-payload bugs before a run starts.
Usage
Use this contract pattern when:
- Designing a pipeline framework where stages are pluggable
- Static validation of pipeline graphs is needed (catch misconfigured prompts before running)
- Different stages need different parallelism models (per-sample vs. global vs. batch)
- Extensibility by subclassing is preferred over configuration
Theoretical Basis
The four lanes correspond to four dataflow patterns:
# Abstract lane semantics (NOT real implementation)
# Ingest: 1 -> N (source discovery)
samples = ingest.process(target) # one call, many outputs
# Map: 1:1 fan-out (parallel transformation)
results = pool.map(lambda s: stage.process(s), active_samples) # per sample
# Reduce: N -> ranked (global selection)
surviving_ids = reduce.process(all_samples) # sees everything
# BulkMap: N -> 1 batch (single invocation)
results = bulkmap.process(all_samples) # one call, many results
The provides declaration enables a form of type checking for pipeline graphs. A prompt in stage N referencing variable X is only valid if some stage before N declares X in its provides. This is checked statically by parsing the Jinja2 template (without rendering it) and comparing undeclared variables against the union of all upstream provides.
Related Pages
Implemented By
- Implementation:416rehman_DeepZero_Processor_Base_Classes
- Implementation:416rehman_DeepZero_FileDiscovery
- Implementation:416rehman_DeepZero_MetadataFilter
- Implementation:416rehman_DeepZero_TopKSelector
- Implementation:416rehman_DeepZero_PEIngest
- Implementation:416rehman_DeepZero_LoldriversFilter
- Implementation:416rehman_DeepZero_GhidraDecompile
- Implementation:416rehman_DeepZero_SemgrepScanner
- Implementation:416rehman_DeepZero_GenericLLM
- Implementation:416rehman_DeepZero_ProcessorResult
- Implementation:416rehman_DeepZero_ProcessorEntry