liveBook · Manning

Hardware acceleration

As explained in Domain-Specific Small Language Models

The use of specialized hardware such as GPUs to speed up computation by offloading work from the CPU.

GPU acceleration can speed up generative Transformer inference, but performance depends on more than raw compute. Assess compute throughput, memory capacity, and memory bandwidth to identify the hardware constraint. section 4.3.1

The ops/byte ratio describes a device’s compute capacity relative to memory bandwidth. Compare a model’s arithmetic intensity—operations per byte accessed—with that ratio: a lower value indicates a memory-bound workload, while a higher value indicates a compute-bound one. section 4.3.1

Assessing a Tesla T4

A T4 provides 65 TFLOPS, 16 GB of memory, and 300 GB/sec of bandwidth, yielding 216.6 ops/byte. GPT-Neo in half precision requires 12.96 GB; an attention calculation gives 30.29 ops/byte. section 4.3.1

total_memory_movement = 71303168
total_compute = 2160066560
arithmetic_intensity = 30.29 ops/byte

See the attention arithmetic-intensity calculation. section 4.3.1

How Domain-Specific Small Language Models covers it

How deep it goes
Calculates device ops/byte and attention arithmetic intensity to distinguish compute-bound from memory-bound workloads.
Examples
Compares Tesla T4 specifications with GPT-Neo memory use and a worked attention calculation.
What you can do after
Evaluate hardware bottlenecks by comparing model arithmetic intensity with a GPU’s ops/byte ratio.
How it connects
Connects GPU inference with Transformer attention, arithmetic intensity, and the key–value cache.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Domain-Specific Small Language Models. The section links point to the parts of the book it draws on.