GPU speeds up the tasks in machine learning, yet its efficient hardware does not ensure a rapid data training process. In different PyTorch works, GPU often waits for the next processing of incoming data batches rather than its work of calculations.
This may lead to an extended data training period, rising costs of infrastructure, and low usage of GPUs. More frequently the issue lies in the data pipeline, not probably the model itself. Slow storage reads, uneven data distribution, Python worker overhead, and inefficient preprocessing may hinder GPUs from receiving the data speed they require. Databricks UCDataset overcomes this challenge by streaming supported Unity Catalog Delta tables to PyTorch training processes. It spreads data automatically across GPUs and DataLoader workers and eases data access, lowering the requirement for custom data-loading infrastructure.
This blog explores why GPU idle PyTorch training phase even when powerful computing resources are available. It assesses the general PyTorch Dataloader bottlenecks. It brings out the reason why the conventional method of optimization turns not sufficient as workload scales. It also explores the Databricks UCDataset, briefing how it links the Unity Catalog Delta Tables straight to PyTorch training workflows and other concepts underlying this. Let’s dive into the section.
What a Data-Starved GPU Looks Like
Your GPU might be perfectly set up, powerfully configured, and expensive, yet a large part of a PyTorch training run is spent waiting for data. In numerous enterprise machine learning tasks, the primary bottleneck is not the model or the graphics processing unit; it is the connection linking Unity Catalog data to the training process.
This gap is filled by Databricks UCDataset through streaming Delta tables to PyTorch training on the Runtime of AI. UCDataset is a PyTorch IterableDataset that streams data from Unity Catalog tables into a training loop on AI Runtime. This prevents the requirement for data export towards parquet or it keeps up the individual serving pipeline.
A robust execution on training sustains the GPU busy with the tasks, including forward passes, updates on the optimizer, backward passes, and kernel execution. When the GPU waits for the preceding data batch endlessly, it turns the accelerator to idle mode and causes improper step times.
This problem happens repeatedly when team transforms to a production-scale date from a small proof of concept. The approach successfully trains, but every epoch also seems much longer beyond expectation since there is a starving of GPU, not an encircled compute bound.
Why the nvidia-smi utilization number mislead you?
The nvidia-smi tool is beneficial for a rapid health check, though its utilization level percentage does not signify “The GPU is fully productive.”
It can signify high usage wherein the GPU may run operations synchronization, data batch processing, or inefficient smaller kernels at the long loading time gaps.
Likewise, the GPU also indicates clock time idle, intermittent behaviour when waiting for preprocessing, host-to-device transformation, and Python execution to get completed.
What the PyTorch Profiler shows when the GPU is waiting on data
The PyTorch Profiler lets you separate GPU tasks from time spent waiting. It tracks PyTorch operation time and memory usage, revealing if the GPU is engaged in calculations or paused between steps.
In a data-bound run, you will often observe:
- Significant gaps between training iterations or CUDA kernels
- It is high time to address delays from the DataLoader, dataset iteration, python conversion processes, or collation, decoding.
- The GPU kernels that kick off late and complete quickly are followed by another process of long wait.
- A training phase whose running duration gets dominated by the raw input preparation instead of the execution of the model.
Where the Training Loop Actually Stalls
Low GPU utilization is usually due to multiple factors. In a cloud-native ML setup or Databricks, this issue often arises from many small delays stacking up along the data path.
Slow reads from object storage
Cloud object storage offers durability and scalability, yet it lacks automatic GPU feed optimization. Opening items, data transformation, permission handling, and file processing might be prone to delay before the arrival of tensor at GPU.
This turns visible while the phase of training reads from the exported copy of data. The data may present, but the reading process, export, and the layout of storage are not designed to manage multi-GPU training demands and data speed.
Python worker overhead and the per-row conversion cost
Even though workers of PyTorch Dataloader could not resolve the logic of inefficient data conversion, they allow concurrent loading.
Conversion of rows to tensor or custom feature structure, NumPy arrays, and dictionaries utilizes more CPU time, specifically when the data transfer process runs for each row rather than for every batch.
While in Python object transformation, bringing more personnel may result in high GPU usage without improving the utilization of GPU.
Too many small files
Small files generate metadata and I/O overhead. Training may generate numerous open, read operations and close operations in place of handling fewer, larger, structured files.
This problem happens repeatedly when there is data export for the training process without noticing the compression, reduction in columns, size of files, and splitting. A loader comprehending to orchestrating requirement, assigns more coordination process time instead of giving efficient tensors to GPU.
Uneven data sharding across GPUs in distributed jobs
In distributed training, each GPU gets a balanced, separate portion of the dataset. If there is an improper sharding, some ranks may lead to repeated rows, nil tasks and excess data.
A few sharding flaws may make some GPUs to completing sooner, whereas others get tasks.
In distributed training that is synchronous, the faster ranks pause at a synchronization barrier, which minimizes how well the whole cluster works. Therefore, proper sharding is more than a performance issue; it is a correctness issue.
Host-to-device copy gaps
Loading data efficiently still leaves tensor transfers from CPU to GPU as a potential bottleneck. As per the analysis by Run:ai in 2025, nearly 40% of the enterprises’ GPU idle time towards input wait/output wait implies that GPU sitting idle time, whilst the next data batch for the delivery seems to sit under struggles, unable to move on during training.
This stands as the major PyTorch Dataloading bottleneck concern prior to the training phase. Improper batch sizes, more CPU transformation, synchronous copies, and non-pinned memory may create gaps between GPU execution and data readiness.
The purpose not only speeds up loading of data, but the goal also stands to prevent training process delays by providing a sustaining supply of ready tensors for GPU.
Why the Usual Fixes Stop Working at Scale
When starting out, teams frequently address common issues by maximizing num_workers, utilizing prefetching, enabling pin_memory, caching a local copy or conversion of data to Parquet format. However, it does not provide a solution for fundamental architectural issues, but those options would assist.
| Common Fix | What it does benefit | At Scale, where it falls short |
| Parquet exports | Generates a file format that is training-friendly. | Amends a second data copy, governance gaps, staleness risk and sync burden. |
| More DataLoader workers | Parallelizes the preprocessing and loading process | Can view CPU resource contention and could not resolve inefficient storage access |
| Custom DistributedSampler | Manages rank-level sharding | For maintenance, add code and could give duplicated or skipped data to the database as a whole. |
| Pinned memory | Fastens host-to-device transformation | Does not fix poor sharding or poor reads |
| Local Data catching | Minimizes continuous remote reads | Needs capacity planning in the system that later turned stale. |
When this Unity Catalog table gets exported before the stage of execution to Parquet, it creates a repeated copy that needs synchronization with original data, security updates, and storage.
Databricks warns that the duplicate snapshots issue is becoming outdated since fresh data flows in and thus outstand the Unity Catalog lineage.
Moving the entire table to pandas through toPandas() may work for a few datasets, but it may fail for scaling in cases of large tables or in distributed GPU workloads. In that scenario, the flow of data could turn into a bottleneck when many GPUs read the data in the warehouse at the same time. This
What Databricks UCDataset Is
UCDataset comes under PyTorch IterableDataset, under Beta on Databricks AI Runtime. It directs rows data from Unity Catalog tables feeding directly into the training loop, reading matching rows from underlying data files of tables stored in the cloud. Hence streaming Delta tables to PyTorch is accomplished. Streaming of data can handle the needs of latency rather than batch processing, from hours’ timeline to milliseconds, and it is also rapidly processed.
The approach takes away the requirement for data exporting, and before the GPU is trained, it copies governed Lakshouse data. Describe the data you require, its table structure, filters, and columns, and UCDataset will generate training loop batches.
A PyTorch IterableDataset that streams data straight from Unity Catalog tables
The UCDataset tool accesses Delta Lake tables registered within Unity Catalog PyTorch. The system employs filters and deletion vectors when it reads the data, preventing filtered-out rows.
This is because it reads directly from the data files of the table; SQL warehouse or Spark session is not required. This eradicates standard link connecting the GPU to the lakehouse.
Choosing data like a DataFrame: pick the table, the columns, and the filters.
The API was built to mimic the DataFrame structure. Opt Unity Catalog tables, choose columns, and then set out the filters having column expressions.
For instance, a refined team may create a click-through-rate design may select only the needed features and label column, rather than to materialize the entire table. The volume of data reduces since files are processed using the filters before they reach GPU and Python environment.
Plugging it into the DataLoader: it returns batches already, so set batch_size=None
Each batch from UCDataset contains a dictionary. Boolean columns and numeric columns turn into tensors, whereas other column types transform into Python lists.
Additionally, since batching happens in the UCDataset, the standard PyTorch DataLoader requires a batch_size parameter set to None. You can retain control over parallelism by setting the num_workers parameter.
from databricks.uc_dataset.beta import UCDataset
from torch.utils.data import DataLoaderdf = (
table(“main.ml.clicks”)
.select(“features”, “label”)
.filter(col(“label”).isNotNull() & col(“features”).isNotNull())
)dataset = UCDataset(df=df, batch_size=256)loader = DataLoader(dataset, batch_size=None, num_workers=4)for batch in loader:
features = torch.as_tensor(batch[“features”], dtype=torch.float32)
label = batch[“label”]
train_step(features, label)
Sharding across ranks with torchrun
In multi-GPU training, UCDataset distributes matching rows among ranks and DataLoader workers.
Databricks by default implies that the sizes of shards may differ by not more than a single row and then this distributed sampler is not required.
In order to leverage multiple lined GPUs, first we have to initiate the script of the training process through torchrun that assigns WORLD_SIZE and RANK to every process. In such a Databrick AI
Runtime notebook, such that neither of the variables prevails; this UCDataset sees the table as one shard. But also, to set up one will trigger the error.
Jobs kick with Databricks Air run in the case of a multi-node scenario. Databrick starts the training script with torchrun even though it is one GPU, because the runtime states WORLD_SIZE but excludes RANK
UCDataset vs UCVolumeDataset: tables vs files
UCVolumeDatase and UCDataset fix related yet distinct problems.
| Demand | Best-fit component | What functionality it handles |
| File-based training and Mixed tabular data | Both together | For instance, labels through UCDataset from tables and through UCVoumeDataset match the images from volume. |
| Label rows and structured feature | UCDataset | Delta tables sourced in Unity Catalog, filter, tensor-ready job batches and column selection. |
| Audio, documents, images or other files | UCVolumeDataset | Files sourced in Catalog volumes on first access are duplicated to the fast local cache and fetches local file paths |
UCVolumeDataset segregates files across DataLoader workers and ranks when initializing torch.distributed; hence, every pair (rank, worker) yields a non-overlap slice.
The Governance Side CTOs Care About
For enterprise ML platforms, performance is just part of the narrative. Data access ought to be consistent, auditable, and maintained with the security model of the organization.
The identity executing the workload is used for reading data by UCDataset, and table permissions are governed by Unity Catalog PyTorch.
The jobs, which are all in the training phase, share the controlled privilege taken by different Unity Catalog users, without the approach of unmaintained exported data copy. This method provides many realistic benefits.
- Eliminating the demand for monitoring, unique Parquet export refresh, and security.
- No frozen training state unless the team explicitly fixes one using version_as_of.
- Permission enforcement stays with Unity Catalog.
- During the read process, filters and deletion vectors are implemented.
There must be a better understanding of governance boundaries. Tables with row filters or column masks are unreadable by the UCDataset in the Beta environment, as Unity Catalog does not provide storage credentials for these.
From a Delta Table to a Multi-Node Training Job
Usually, a production-ready setup involves storing the curated training features and labels inside a Unity Catalog Delta table.
- Retain only the model’s required columns
- Utilize filters to sort the results by entity types, data quality constraints, time spans and labels.
- Configure UCDataset (dataset object) through the batch size appropriate to your needs.
- Place it inside a DataLoader configured with batch_size=None.
- Before the dataset creation, begin the distributed training phase.
- Start the job using torchrun on the needed GPUs and nodes.
- Examine the worker count, batch size, and transformations for the run and tune profile.
For two nodes, in the category of 16-GPU configuration , the code for training stays unique in comparison to the single-node version. The workload configuration and torch execution maintain the distribution phase.
How to Prove It Fixed Your Bottleneck
Do not judge the improvement by GPU utilization alone. Evaluate the entire training process both before and after implementing the change.
Here are the key metrics.
- Steps per second: The most direct measure of end-to-end throughput.
- Epoch time evidences valuables in comparison to the entire training execution.
- Check the busy time of the GPU through traces of the profiler to segregate compute operations from the wait.
- Time of data loading is measured in data transforms, host-to-device copies, collation, and iteration
- Determine whether workers are fully utilized or not maximally used.
- Verify that every GPU gets an equal amount of work.
- Expense per model training session or per training cycle: Correlate performance improvements with cloud usage.
Limits and When Not to Use It
UCDataset offers robust capabilities, yet it cannot serve as a complete substitute for all data-loading methods.
Existing constraints are:
- Delta Lake tables registered in Unity Catalog are the only supported reading target; views, materialized views, and streaming tables are excluded.
- Tables with row filters or column masks are not supported in the Beta.
- As the files stay connected to the source, it is not possible to read the shallow clones.
- Tables containing a VARIANT column are unreadable even if that column is omitted.
- Filters specifically permit constrained expressions and exclude CONTAINS, BETWEEN, IN, UDFs, column-to-column comparisons, LIKE and casts
- Python lists deliver array columns, which have slower performance than numeric columns.
- UCDataset does not have checkpointing for the read position, so a restarted job will resume from the beginning.
Naveera Perspective: UCDataset Fits in ML Platform of Enterprise
UCDataset holds the most value for Databricks enterprises when training data already resides in governed Unity Catalog tables, and teams aim to lessen the operational gap between data engineering and model training.
It suits an architecture featuring curated and versioned
- Feature tables in Unity Catalog.
- Delta Lake serves as the system of record for training data.
- Restricted feature access and reliable access are required by data scientists.
- ML platforms need to expand support for multi-GPU and multi-node training workloads.
- The Teams targets to eliminate the pipelines of custom sharding code and parquet export
The effective implementation integrates UCDataset having strong data engineering techniques such as restricted column choices, version control to reproduce data profiling after each update in the pipeline, and stable data agreements.
UCVolumeDataset and UCDataset seem compatible for workloads of document, image or audio having structured labels, identity, and metadata obtained from raw media files and tables residing in Unity Catalog volumes.
Revamp your GPU setup into a high-efficiency AI
To achieve a top-tier AI pipeline, it needs more than that of robust GPU hardware. If there is no properly optimized data pipeline, an enterprise having high-performing infrastructure may get their computing time wasted, waiting for raw data for its next training process.
Naveera aids businesses in producing and refining AI and data engineering effective solutions, enabling scalable and proficient machine learning workflows. Our Naveera team determines the data loading bottlenecks, thus modernizing data pipelines and implementing Databricks-based architectures to help organizations optimize their data and computing resources.
If you encounter constraints with large-scale data preparation and handling low GPU utilization, or looking around to extend your PyTorch training workloads, Naveera can assist you in finding out the appropriate strategy for your infrastructure.
The bottlenecks in the data shouldn’t impede the performance of AI.
Get in touch with the Naveera Data Engineering and AI Services team for a GPU pipeline audit. Analyze the present setup of your current Databricks to identify issues in performance and bring out the ways to streamline your machine learning processes.
FAQ
Why is my GPU utilization low during PyTorch training?
Low GPU utilization refers to the fact that the GPU does wait for input data instead of performing computation. The general reasons behind this are inefficient Python, poor shading, host-to-device copy gaps, small files, preprocessing, and slow storage reads.
How do I know if my DataLoader is the bottleneck?
Utilize PyTorch Profiles and perform a comparison of GPU kernel tasks with the time it consumed in preprocessing DataLoader operations. The long gaps between delayed availability of batch, GPU kernels, and CPU conversion time are the robust indicator that a bottleneck in Dataloader
Can UCDataset read from Delta Lake tables directly?
Yes, this UCDataset reads the Delta tables, which are all registered in Unity Catalog that come directly from cloud-storage data files without needing an SQL warehouse or Spark session.
Does UCDataset work with distributed training?
Yes, it splits the matching rows with Dataloader workers and ranks; therefore, the team does not require a custom distributed sampler. Multi-GPU jobs demand a launcher with an inclusive torchrun setting of WORLD_SIZE and RANK.
Is UCDataset production-ready?
It is present in Beta. it is crafted for production-style Databricks AI Runtime workloads; however, the teams must do validation against the governance demands, performance targets, data types, and failure recovery demands before it adopts it.
UCDataset vs Petastorm: what’s the difference?
Petastorm is defined as the parquet-oriented data loading library generally for reading large datasets to TensorFlow and PyTorch.
UCDatabricks refers to Databricks-native and those reads governed Unity Catalog Delta tables directly, employing deletion vectors and filters during the read phase while tackling worker sharding and handling rank automatically.