# Local Model

> The Local Model is an AI model that runs on the user's own device or servers instead of a cloud API.

## How do I run an AI model locally?

The model that runs on your own hardware, usually an open-weight model in a quantized form. Data does not leave the device and there is no cost per token, but quality and speed depend on the available memory and GPU.

- Topic: Language Models
- Type: concept

## Example

Wrong:

```bash
# Laptop with 16 GB of RAM
ollama run llama3.1:70b
```

Right:

```bash
# Laptop with 16 GB of RAM
ollama run llama3.1:8b
```

A 4-bit '70b' model needs about 40 GB of memory, so a 16 GB laptop should run a smaller quantized model like '8b' that fits in RAM or VRAM.

## Common mistakes

- Picking a model too large for the available memory, so it runs very slowly or not at all.

## Key points

- The model endpoint and model name come from config, not hardcoded in the code.
- Requests to the local model have a timeout, since slow hardware can stall a response.
- The local server listens only on localhost unless remote access is intended and protected.

## Interview questions

### How much RAM do I need to run a model locally?

Roughly the model file size plus extra room for the context. A small quantized model can run in a few gigabytes; large models need far more.

### Is a local model private?

The prompts stay on your machine if the runtime does not send data out, which makes local models a good fit for sensitive data.

### Can I call a local model like a cloud API?

Yes. Many local runtimes expose an HTTP API on localhost, so the same fetch-based client code works with a changed URL and model name.

## Related cards

- [Open-Weight Model](https://wonderium.dev/ai/open-weight-model.md)
- [Quantization](https://wonderium.dev/ai/quantization.md)
- [Small Language Model](https://wonderium.dev/ai/small-language-model.md)
- [Sensitive Data Leakage](https://wonderium.dev/ai/sensitive-data-leakage.md)

---

- Level: [Artificial Intelligence](https://wonderium.dev/ai.md)
- HTML version: https://wonderium.dev/ai/local-model
- Last updated: 2026-11-25
