# GPU and Hardware Basics for AI Engineers

> Enough about GPUs, VRAM, precision and cloud options to estimate what hardware a model needs and what it will cost. Free notes, key concepts, resources and a...

Canonical: https://www.internhack.in/roadmaps/tracks/ai-engineer/gpu-basics
Last updated: 2026-11-28

Enough about GPUs, VRAM, precision and cloud options to estimate what hardware a model needs and what it will cost.

Intermediate · about 3 hours · difficulty 3/5

Learn first: [Running Open-Weight Models Locally](https://www.internhack.in/roadmaps/tracks/ai-engineer/open-weight-models)

You do not need to write CUDA kernels, but you should be able to answer "can we run this model, on what, and for how much?".

### Why GPUs

Model inference is dominated by large matrix multiplications and, for generation, by **memory bandwidth**: every generated token reads the model's weights from memory. GPUs have thousands of cores and very fast memory, which is why they dominate.

### Estimating memory

- **Weights**: parameters times bytes per parameter. A 7 billion parameter model needs about 14 GB in 16-bit precision, about 7 GB in 8-bit and about 4 GB in 4-bit.
- **KV cache**: grows with context length and number of concurrent sequences; long contexts can need as much memory as the weights.
- **Overhead**: activations and framework buffers, so leave headroom.
- Training and fine-tuning need far more memory than inference because of gradients and optimizer state, which is why LoRA and QLoRA matter.

### Hardware landscape

- NVIDIA data centre GPUs dominate cloud inference and training; consumer GPUs are fine for learning and small models.
- Apple Silicon's unified memory runs surprisingly large quantized models locally.
- Alternatives include AMD GPUs, Google TPUs and custom inference chips offered through cloud APIs.

### Cloud options

Hyperscalers, specialist GPU clouds and serverless GPU platforms rent by the hour or second. Compare price per hour, availability, and whether you pay for idle time.

### Good enough to move on

Given a model size, precision and context length, you can estimate the VRAM needed, pick a suitable GPU, and compare the monthly cost to a hosted API for a given traffic level.

## Key concepts

- **Why inference is memory bound**
- **Estimating VRAM for weights**
- **KV cache memory**
- **Precision: FP16, INT8, 4-bit**
- **Training vs inference memory**
- **Cloud and serverless GPUs**
- **Apple Silicon and local hardware**

## Mini project

Write a small calculator script that estimates VRAM for a model given parameters, precision, context length and concurrency, then check its predictions against real memory usage in Ollama or vLLM.

## Check yourself

Roughly how much memory does a 13 billion parameter model need in 4-bit precision, before KV cache?

## Free resources

- [Hugging Face: GPU inference](https://huggingface.co/docs/transformers/perf_infer_gpu_one) (Hugging Face)
- [Hugging Face: quantization overview](https://huggingface.co/docs/transformers/quantization/overview) (Hugging Face)
- [NVIDIA CUDA documentation](https://docs.nvidia.com/cuda/) (NVIDIA)

Previous: [Serving Open-Weight Models at Scale](https://www.internhack.in/roadmaps/tracks/ai-engineer/serving-open-models) · Next: [Chat and Streaming Interfaces](https://www.internhack.in/roadmaps/tracks/ai-engineer/chat-ui-streaming)

## More in LLMOps and Production Engineering

- [Deploying LLM-Powered Services](https://www.internhack.in/roadmaps/tracks/ai-engineer/deploying-ai-services)
- [Latency Optimization](https://www.internhack.in/roadmaps/tracks/ai-engineer/latency-optimization)
- [Response Caching and Semantic Caching](https://www.internhack.in/roadmaps/tracks/ai-engineer/llm-caching)
- [Model Routing, Gateways and Fallbacks](https://www.internhack.in/roadmaps/tracks/ai-engineer/model-routing-fallbacks)
- [Serving Open-Weight Models at Scale](https://www.internhack.in/roadmaps/tracks/ai-engineer/serving-open-models)
- [GPU and Hardware Basics for AI Engineers](https://www.internhack.in/roadmaps/tracks/ai-engineer/gpu-basics)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [AI Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/ai-engineer)
