Skip to main content
Sample stage showing random and stratified sampling of results
The Sample stage selects a subset of documents from your results using random or stratified sampling. This is useful for creating representative samples, reducing result sets, or ensuring diversity across categories.
Stage Category: REDUCE (Samples documents)Transformation: N documents → S sampled documents (where S ≤ N)

When to Use

When NOT to Use

Parameters

Sampling Strategies

Configuration Examples

How Sampling Works

Random Sampling

Selects documents with uniform probability:

Stratified Sampling

Ensures representation from each group:

Reservoir Sampling

Memory-efficient uniform sampling for very large or streaming result sets:

Output Schema

Performance

Common Pipeline Patterns

Search + Sample for Testing

Balanced Category Sample

Sample Before LLM Processing

Cluster + Sample Representatives

Multi-Source Balanced Sample

Stratified Sampling Details

Minimum Per Stratum

Each group is guaranteed at least 5 samples (if available), with the remainder allocated proportionally up to count.

Proportional Allocation

Stratified sampling allocates samples proportional to group size by default.

Reproducibility

Use seed for reproducible results:
Same seed + same input = same output.

Error Handling

Sample vs Other Reduction Stages