> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lancedb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Training Cache

> Connect the PyTorch data loader to LanceDB Enterprise and training reads automatically benefit from the plan executor's data page cache.

**Applies to:** Embedded ❌, Enterprise ✅

The [PyTorch data loader](https://docs.lancedb.com/training/data-loading.md) reads training data the
same way any other query does -- there is no training-specific read path.
Point `StreamingDataset` or a `DataLoader` at a table opened through an
Enterprise connection instead of a local one, and every read it makes
flows through the same [plan executors](https://docs.lancedb.com/enterprise/data-page-cache.md) that
serve every other query, with the same data page cache in front of object
storage. No training-specific configuration turns this on; it's a
consequence of connecting to Enterprise at all.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"catppuccin-mocha"}}
%%{init: {"theme": "base", "themeVariables": {
  "background": "#ffffff", "primaryColor": "#ffffff", "primaryTextColor": "#221d19",
  "primaryBorderColor": "#ad9e95", "lineColor": "#6b625c", "textColor": "#221d19",
  "edgeLabelBackground": "#ffffff", "fontFamily": "Inter, sans-serif", "fontSize": "18px"
}}}%%
flowchart LR
    DL["PyTorch DataLoader<br/>/ StreamingDataset"] --> T["Enterprise-connected table"]
    T --> PE["Plan executor"]
    PE --> C{"In data page cache?"}
    C -->|hit| Fast["Served from memory<br/>or local disk"]
    C -->|miss| O[("Object storage")]
    O --> Fill["Fills the cache,<br/>served"]
    classDef default fill:#ffffff,stroke:#ad9e95,stroke-width:1px,color:#221d19
    classDef accent fill:#fff1ec,stroke:#e8582d,stroke-width:1.5px,color:#221d19
    class Fast accent
```

This covers the ordinary tabular columns a query reads -- the data page
cache's unit is a fixed-size page of table data. A [Blob v2](https://docs.lancedb.com/management/table.md#managed-blobs)
column's payload is fetched through a separate range-request path keyed
to its own descriptor, not through this cache, so a training table mixing
plain feature columns with Blob v2 images or video gets this benefit only
for the former. A custom collate function or transform that does its own
file or network I/O -- decoding an image, say -- is also outside this
cache; only reads that go through the table query path benefit.

## Why this matters for training specifically

Training reads the same rows repeatedly: once per epoch, often for many
epochs. The first epoch's reads behave like any cold cache -- a miss per
page, each one filling the cache on the way. Every epoch after that reads
the same pages again, so a dataset that fits the cache's budget serves
almost entirely from memory or local disk after the first pass, instead of
re-reading object storage every epoch. A local-file or Embedded
connection has no equivalent remote cache to warm this way -- its
locality comes from whatever the local filesystem or OS page cache
already does.

[Cache Prewarm](https://docs.lancedb.com/enterprise/cache-prewarm.md) extends this further: a plan
executor can warm its cache at startup, before training even begins,
instead of paying the first-epoch cold-cache cost during the run itself.

## What to read next

> [card] [PyTorch Data Loader](https://docs.lancedb.com/training/data-loading.md)
>
> Connecting a DataLoader to an Enterprise table.

> [card] [Data Page Cache](https://docs.lancedb.com/enterprise/data-page-cache.md)
>
> How the cache a training read benefits from actually works.

> [card] [Cache Prewarm](https://docs.lancedb.com/enterprise/cache-prewarm.md)
>
> Warming the cache before the first epoch instead of during it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.