---
title: 'LLM on the laptop'
url: 'https://niklas-stephan.de/en/wiki/guides/llm-auf-dem-laptop'
markdown: 'https://niklas-stephan.de/en/wiki/guides/llm-auf-dem-laptop.md'
lang: en
date: '2026-07-15'
description: 'LLM on the laptop Variant 1 – direct installation of Ollama Install Ollama: curl -fsSL https://ollama.com/install.sh | sh Install the language model: ollama pull gemma4:12b Optimization for the LLM in the file /etc/systemd/system/ollama.service: Add to the content: [Service] Environment="OLLAMA_NUM…'
---

#  LLM on the laptop 

## Variant 1 – direct installation of Ollama

Install Ollama:

```bash
curl -fsSL https://ollama.com/install.sh | sh
```

Install the language model:

```bash
ollama pull gemma4:12b
```

Optimization for the LLM in the file `/etc/systemd/system/ollama.service`:

Add to the content:

```ini
<span class="hljs-section">[Service]</span>
<span class="hljs-attr">Environment</span>=<span class="hljs-string">"OLLAMA_NUM_THREADS=6"</span>
<span class="hljs-attr">Environment</span>=<span class="hljs-string">"OLLAMA_FLASH_ATTENTION=1"</span>
<span class="hljs-attr">Environment</span>=<span class="hljs-string">"OLLAMA_KV_CACHE_TYPE=q8_0"</span>
<span class="hljs-attr">Environment</span>=<span class="hljs-string">"OLLAMA_KEEP_ALIVE=-1"</span>
<span class="hljs-attr">LimitMEMLOCK</span>=infinity
```

Restart the Ollama service:

```bash
sudo systemctl daemon-reload
sudo systemctl restart ollama
```

Result: slow

## Variant 2: LM Studio

Result: slow

## Variant 3: Ollama in Docker

 guideaillmlaptop

---

## Navigation

- Parent: [Guides](https://niklas-stephan.de/en/wiki/guides.md)
- Previous: [LibreEcho: flashing a used Amazon Echo](https://niklas-stephan.de/en/wiki/guides/libreecho.md)
- Next: [No-Google Phone](https://niklas-stephan.de/en/wiki/guides/no-google-handy.md)
