Skip to content

Proposal: Streaming feature retrieval and optional PyTorch/TorchData integration #7196

Open

Description

@haoxu0

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

  1. Audit existing streaming interfaces across offline stores and ComputeEngine implementations. Identify which RetrievalJob backends can return batches without materializing a complete Arrow Table/DataFrame.
  2. Standardize bounded Arrow batch iteration (reusing existing APIs where possible), with explicit batch sizing, cleanup, error propagation, and backpressure semantics.
  3. Build an optional PyTorch adapter using torch.utils.data.IterableDataset and/or TorchData nodes, converting Arrow batches into tensors. Keep PyTorch dependencies out of Feast core.
  4. Define distributed semantics for rank/worker-aware sharding, deterministic iteration, checkpoint/resume, and consistency with point-in-time joins.
  5. 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_batches support 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions