liveBook · Manning

Memory-to-data ratio

As explained in Graph Neural Networks in Action

The memory-to-data ratio is the quotient of available memory capacity divided by the size of the dataset being processed.

The memory-to-data ratio divides available memory capacity by the dataset size. It is a practical planning metric for checking whether hardware can hold and process a workload comfortably. section 7.3.2

Use the ratio during scale planning and evaluation:

  • Estimate the dataset size for each phase of the machine-learning lifecycle. section 7.3.2
  • Reserve roughly four to ten times the dataset size in memory as a rule of thumb. section 7.3.2
  • Benchmark representative preprocessing and training workloads, then investigate memory errors or crashes when capacity is insufficient. section 7.3.2
  • Use techniques such as subgraph sampling when larger graphs exceed available device memory and an upgrade is impractical. section 7.4.2

Sizing memory for a graph workload

A sparse graph dataset containing 10 GB of data suggests reserving approximately 40 GB to 100 GB of memory. If the available GPU cannot handle larger graphs, subgraph sampling can make the workload manageable without immediately obtaining a larger-memory device. section 7.4.2

Table 7.2 Pros and cons of processor choice
Hardware
Recommended Workload
Pros
Cons
CPU
Preprocessing
Suitable for data collection and preprocessing
More affordable than GPUs and TPUs
Slower for training due to lack of accelerated parallel processing
GPU
Training
Excellent for training due to parallel processing
More expensive than CPUs
Surpassed by TPUs for deep learning tasks
TPU
Preprocessing and training
Faster computation time and cost-effectiveness for deep learning tasks
Requires specific software
infrastructure
Limited to Google platforms
NPU
Training
Optimized for deep learning and especially good for on-device AI applications, reducing reliance on cloud services
Limited to specific AI workloads, primarily neural network-based tasks
IPU
Training
Especially good for graph-based tasks such as GNNs
Can be more complex to program and optimize compared to NPUs

Compare processor choices alongside memory planning: CPUs suit preprocessing, GPUs suit training, and graph workloads may benefit from specialized processors with different programming and infrastructure trade-offs. section 7.4.2

How Graph Neural Networks in Action covers it

How deep it goes
Defines the ratio, gives a four-to-ten-times guideline, and applies it to a concrete graph dataset and hardware decision.
Examples
Uses a 10 GB sparse graph dataset to derive a 40–100 GB memory target and motivate subgraph sampling.
What it assumes
Assumes the ability to estimate dataset size and identify available CPUs, GPUs, or other processing resources.
What you can do after
Operate/configure hardware capacity, benchmark workloads, and apply subgraph sampling when memory constraints cause failures.
How it connects
Connects dataset sizing with hardware planning, benchmarking, preprocessing, model training, and subgraph sampling.

Also explained in

Compare how 2 books explain memory-to-data ratio →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Neural Networks in Action. The section links point to the parts of the book it draws on.