Repository navigation
Description
Motivation
Feast provides feature definitions, point-in-time historical retrieval, and multiple offline execution backends, but consuming large historical feature datasets directly in PyTorch training pipelines can require materializing intermediate datasets or implementing backend-specific adapters.
LinkedIn's Composable Torch DataLoader illustrates the value of modular, streaming feature ingestion, Arrow-based batches, and decoupled execution from training consumption.
This issue proposes exploring an optional Feast → TorchData/PyTorch integration, building on Feast's existing RetrievalJob and Arrow interfaces rather than implementing another distributed data engine.
Proposal
- Audit existing streaming interfaces across offline stores and ComputeEngine implementations. Identify which
RetrievalJobbackends can return batches without materializing a complete Arrow Table/DataFrame. - Standardize bounded Arrow batch iteration (reusing existing APIs where possible), with explicit batch sizing, cleanup, error propagation, and backpressure semantics.
- Build an optional PyTorch adapter using
torch.utils.data.IterableDatasetand/or TorchData nodes, converting Arrow batches into tensors. Keep PyTorch dependencies out of Feast core. - Define distributed semantics for rank/worker-aware sharding, deterministic iteration, checkpoint/resume, and consistency with point-in-time joins.
- Benchmark end-to-end training throughput, peak memory, first-batch latency, and CPU/I/O utilization against materialized DataFrame/Parquet workflows.
Example API (illustrative only)
job = store.get_historical_features(
entity_df=entity_df,
features=["user_stats:click_count"],
)
# Proposed streaming interface; name/signature subject to design review.
for batch in job.to_arrow_batches(batch_size=8192):
train_step(batch)An optional adapter could expose a PyTorch IterableDataset backed by this stream.
Design considerations
- Do not simulate streaming by calling
to_arrow()on the full result and slicing afterward. - Preserve PIT correctness, ordering guarantees, and feature schema/type fidelity.
- Avoid duplicate samples across DataLoader workers and distributed training ranks.
- Specify what checkpoint/resume guarantees are feasible for each backend.
- Avoid overlapping with Ray Data, TorchData, or Spark execution responsibilities.
- Reuse existing
to_arrow_batchessupport and ComputeEngine abstractions wherever available.
Suggested incremental scope
- Inventory current Arrow batch support and document backend limitations.
- Implement or harden true streaming for one local and one distributed backend.
- Add correctness, bounded-memory, cancellation, and resource-cleanup tests.
- Prototype an optional PyTorch adapter with sharding tests.
- Publish reproducible performance benchmarks.
References
This is a proposal for discussion, not a claim that these capabilities are entirely absent today.
Activity