Home Knowledge Base ML Data Pipeline

ML Data Pipeline is the system that efficiently loads, preprocesses, and batches training data — a bottleneck that can reduce GPU utilization from 100% to < 30% if poorly implemented, making data loading optimization as important as model architecture.

The I/O Bottleneck Problem

PyTorch DataLoader

dataloader = DataLoader(
    dataset,
    batch_size=256,
    num_workers=8,          # Parallel CPU workers
    prefetch_factor=2,      # Batches to prefetch per worker
    pin_memory=True,        # Pinned memory for fast GPU transfer
    persistent_workers=True # Avoid worker restart overhead
)

TensorFlow tf.data Pipeline

dataset = tf.data.Dataset.from_tensor_slices(filenames)
dataset = dataset.interleave(tf.data.TFRecordDataset, num_parallel_calls=8)
dataset = dataset.map(preprocess, num_parallel_calls=tf.data.AUTOTUNE)
dataset = dataset.batch(256)
dataset = dataset.prefetch(tf.data.AUTOTUNE)  # Overlap GPU compute with CPU prep

Storage Optimization

Online Augmentation

Efficient data pipeline design is a critical ML engineering skill — well-tuned data loading routinely improves training throughput 2-5x with no changes to model architecture, directly reducing the cost and time of every training run.

data pipeline mlinput pipelineprefetching datadata loaderio bound training

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.