Local AI Explained: Core Principles Behind Ollama and vLLM

Core principles of running LLMs locally: VRAM math, quantization, and choosing between Ollama and vLLM.
This beginner-friendly guide covers the fundamentals of running large language models on personal hardware. It explains why an 8B model needs 16GB of VRAM, how quantization compresses models from 16-bit to 4-bit precision for consumer GPUs, and the key differences between Ollama (ease of use, great for beginners) and vLLM (high throughput, built for production). Key concepts like KV cache, multi-GPU parallelism, and the GGUF format are also explained, with clear tool recommendations for different user types.
Not long ago, running a large language model required expensive cloud infrastructure — dozens or even hundreds of enterprise-grade GPUs. Today, thanks to advances in model architecture, inference software, quantization techniques, and consumer hardware, many powerful open-source AI models can run efficiently on personal computers, gaming rigs, workstations, and even modern laptops and smartphones.
This article, based on a popular explainer video by the Bilibili creator Dots and Arrows, systematically covers the core principles behind running large language models locally — helping beginners understand a key question: Why does an 8B model need 16GB of VRAM? And how do you choose between Ollama and vLLM?
Local AI vs. Cloud Inference: What's the Fundamental Difference?
Whenever you use a cloud-based AI service like Claude or Gemini, your prompt travels over the internet to a data center, where servers equipped with multiple GPUs perform the computation and return a result. This is called cloud inference.
Local AI takes a fundamentally different approach: the entire AI model lives on your own machine, and every computation needed to generate text is handled by your local CPU, GPU, or both. Once installed, inference requires no internet connection.
This architecture offers several clear advantages:
- Complete privacy: Your prompts and documents never leave your device
- Offline availability: Models work after download, no connection needed
- No subscription costs: No recurring inference fees
- High flexibility: Easy to customize, experiment with, and fine-tune
For developers, researchers, enterprises, and privacy-conscious users, local AI has become an increasingly practical alternative to cloud-hosted services.
Parameters, Precision, and VRAM: Why Does an 8B Model Need 16GB?
At the core of every model are parameters — commonly called weights — numerical values learned during training that determine how the model predicts the next token in a sequence.

For example, a 3B model contains roughly 3 billion learned values; a 7B model contains roughly 7 billion. State-of-the-art frontier models may contain hundreds of billions of parameters, and Mixture-of-Experts (MoE) architectures can have total parameter counts in the trillions. Generally speaking, larger models offer stronger reasoning, broader world knowledge, and better language understanding — but they also demand significantly more compute and memory.
So how do you calculate VRAM requirements? The key is numerical precision. Take a model with 8 billion parameters stored in 16-bit floating point:
8 billion × 2 bytes = 16 GB
That's the origin of the rule of thumb: "an 8B model needs 16GB of VRAM." But keep in mind, this estimate only covers the model weights themselves. Running inference also requires additional memory for activations, temporary tensors, the tokenizer, the operating system, and the KV cache — so real-world memory usage is typically several GB higher than the raw model size.
Training vs. Inference: What's the Difference?
Many beginners confuse these two concepts. Training is a compute-intensive process where the model adjusts billions of parameters by learning from massive datasets — potentially running across thousands of GPUs for weeks or months. Inference is using the trained model to generate outputs; the parameters stay fixed, and the model simply predicts one token at a time based on its input. Running AI locally refers specifically to local inference, not local training.
Why Are GPUs Better Than CPUs for AI Inference?
While CPUs can perform AI inference, GPUs are clearly better suited for this workload.

Modern language models rely heavily on large-scale matrix multiplication. GPUs contain thousands of processing cores capable of executing these operations simultaneously, whereas CPUs typically have only a few dozen high-performance cores optimized for sequential tasks. This massive parallelism is what gives GPUs a much higher throughput advantage for AI inference.
VRAM is the dedicated memory located on the graphics card. Ideally, model weights should be fully loaded into VRAM during inference, since the GPU can access it directly. Once a model's size exceeds available VRAM, inference slows down dramatically — parts of the model must be transferred between GPU VRAM and system RAM over the PCIe bus, introducing significant latency. For local AI, VRAM capacity often matters more than raw GPU compute power.
Quantization: Fitting Large Models onto Consumer Hardware
One of the most important innovations enabling local AI is quantization. It reduces the numerical precision used to store model weights, dramatically cutting memory usage while preserving as much model quality as possible.
Rather than representing each parameter in 16-bit or 32-bit format, a quantized model might use 8-bit, 6-bit, 5-bit, 4-bit, 3-bit, or even 2-bit representations. Here's the trade-off at each level:
- 8-bit quantization: Cuts memory usage by nearly half with minimal quality loss; strong instruction-following ability; suitable for professional workloads, though still requires relatively large VRAM
- 4-bit quantization: The industry's preferred sweet spot — roughly one-quarter the size of a full-precision model with performance very close to the original. Most community models are released in 4-bit variants
- 2-bit quantization: Pushes compression to the extreme, enabling larger models to run on ordinary hardware, but aggressive precision reduction introduces greater error — accuracy may suffer for complex reasoning, coding, and math

Why doesn't reducing precision hurt performance more? Because neural networks contain a lot of redundancy — many parameters contribute very little to the final prediction and can tolerate small approximation errors. Modern quantization algorithms analyze weight distributions to preserve critical information while compressing insensitive values, achieving dramatic size reduction with only modest quality loss.
GGUF: The Universal Model Distribution Format
GGUF is a widely adopted file format for distributing quantized language models. Rather than storing raw weights alone, it bundles model weights, network architecture, metadata, tokenizer information, vocabulary, quantization details, and configuration parameters into a single file. This makes GGUF models easy to share, load, and deploy across multiple inference engines.
Ollama vs. vLLM: How to Choose the Right Inference Engine?
This is the central tool-selection question in local AI, and the two options serve very different purposes.
Ollama: The Beginner-Friendly Choice
Ollama is one of the most user-friendly tools for running AI models locally. It abstracts away the complexity involved in downloading models, configuring inference engines, and exposing APIs. The typical workflow takes just four steps: install Ollama → download a supported model → launch it with a single command → interact via the terminal or API. Behind the scenes, Ollama automatically handles model storage, memory allocation, and request processing — making it accessible even for complete beginners.
vLLM: The High-Throughput Engine for Production
Unlike Ollama, which prioritizes ease of use, vLLM is designed to maximize inference throughput and is widely used in production environments where many users access large models simultaneously. Its key innovation is PagedAttention — an efficient memory management technique inspired by operating system virtual memory — which dramatically improves KV cache utilization, enabling higher throughput and better GPU memory efficiency. vLLM also performs intelligent request batching, allowing multiple users to effectively share GPU resources without significantly impacting latency.

Advanced Topics: Multi-GPU Inference, KV Cache, and Context Windows
When a large model exceeds the VRAM of a single GPU, multi-GPU inference distributes the computation across multiple cards. Common parallelization strategies include:
- Tensor parallelism: Splits individual mathematical operations across multiple GPUs
- Pipeline parallelism: Assigns different neural network layers to different GPUs
- Data parallelism: Replicates the entire model to process multiple data batches simultaneously (more common in training)
Modern inference engines also employ a range of memory optimization techniques — weight quantization, efficient attention mechanisms, KV cache compression, memory paging, CPU offloading, Flash Attention, and continuous batching — enabling models that once required enterprise-grade hardware to run efficiently on consumer GPUs.
The KV cache is worth highlighting: inference engines store intermediate computation results to avoid redundant recalculation for each new token, significantly accelerating text generation. However, as conversations grow longer, the KV cache consumes increasingly more memory. This explains why larger context windows (the amount of information the model can consider at once) bring higher computational complexity and memory demands.
Key Performance Metrics
These metrics are commonly used to evaluate local AI performance: tokens per second (generation speed), time to first token (responsiveness), latency, throughput, VRAM usage, RAM usage, and GPU utilization. Together, they paint a complete picture of inference performance.
Conclusion: The Era of Local AI Is Here
Here's a clear tool recommendation for different audiences: beginners should choose Ollama — the easiest entry point; production developers should choose vLLM for exceptional throughput; users who want to share models with the community should embrace the GGUF ecosystem; and hardware enthusiasts can benefit from combining quantization, memory optimization, and multi-GPU inference.
The pace of local AI innovation continues to accelerate — models grow more capable every year while requiring fewer resources. Advances in quantization, attention mechanisms, inference engines, and GPU architecture are steadily closing the gap between local and cloud models. Tasks that once required a full rack of enterprise hardware can now be accomplished on a well-configured desktop workstation. Running powerful AI locally is no longer a niche experiment — it represents one of the most exciting frontiers in modern computing: giving individuals access to cutting-edge intelligence while maintaining full privacy, ownership, and control over their data.
Related articles

Vercel AI SDK Releases Vue 3.0.282 Patch Update
Vercel AI SDK releases @ai-sdk/vue@3.0.282 patch update, syncing with core package ai@6.0.282. Learn about the changes, release cadence, and upgrade recommendations.

Vercel AI SDK Sandbox Component Receives Patch Update
Vercel AI SDK releases sandbox-vercel@1.0.109 patch update, syncing the harness dependency to the same version. A look at this maintenance release and what it means for AI app developers.

Vercel AI SDK Vue 4.0.99 Released: Dependency Update Overview
The @ai-sdk/vue 4.0.99 patch release syncs the underlying ai@7.0.99 dependency. Learn what this means for Vue developers building AI apps with Vercel AI SDK.