Version: 1.5.0
Stand: 6. April 2026
📘 Vollständige Dokumentation: ThemisDB mit llama.cpp auf SoC-Geräten
# config/config-rpi5-llm.yaml
llm:
enabled: true
model_path: "/data/models/phi-3-mini-4k-instruct.Q4_K_M.gguf"
context_size: 4096
threads: 4
enable_caching: trueEmpfohlene Modelle: Phi-3-Mini (3.8B), Qwen-2.5 (3B)
Performance: ~2-3 Tokens/Sekunde
# config/config-rpi4-llm.yaml
llm:
enabled: true
model_path: "/data/models/tinyllama-1.1b.Q4_K_M.gguf"
context_size: 2048
threads: 4
enable_caching: trueEmpfohlene Modelle: TinyLlama (1.1B), Phi-3-Mini (3.8B)
Performance: ~1-2 Tokens/Sekunde
# config/config-opi5-llm.yaml
llm:
enabled: true
model_path: "/data/models/mistral-7b-instruct.Q4_K_M.gguf"
context_size: 8192
threads: 8
gpu_layers: 25 # Mali GPU Offloading
enable_caching: trueEmpfohlene Modelle: Mistral-7B, Llama-3.1 (8B)
Performance: ~3-5 Tokens/Sekunde
# config/config-jetson-llm.yaml
llm:
enabled: true
model_path: "/data/models/phi-3-mini-4k-instruct.Q4_K_M.gguf"
context_size: 4096
threads: 4
gpu_layers: 32 # CUDA Offloading
enable_caching: trueEmpfohlene Modelle: Phi-3-Mini (3.8B), Mistral-7B
Performance: ~5-10 Tokens/Sekunde (mit GPU)
# Phi-3-Mini (3.8B) - Beste Balance
wget https://huggingface.co/microsoft/Phi-3-mini-4k-instruct-gguf/resolve/main/Phi-3-mini-4k-instruct-q4.gguf \
-O /data/models/phi-3-mini-4k-instruct.Q4_K_M.gguf
# TinyLlama (1.1B) - Für RPi 4
wget https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf \
-O /data/models/tinyllama-1.1b.Q4_K_M.gguf
# Mistral-7B - Für OrangePi 5 / Jetson
wget https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/resolve/main/mistral-7b-instruct-v0.2.Q4_K_M.gguf \
-O /data/models/mistral-7b-instruct.Q4_K_M.gguf
# Qwen-2.5 (3B) - Multilingual
wget https://huggingface.co/Qwen/Qwen2.5-3B-Instruct-GGUF/resolve/main/qwen2.5-3b-instruct-q4_k_m.gguf \
-O /data/models/qwen-2.5-3b.Q4_K_M.gguf# Performance-Mode
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Transparent Huge Pages deaktivieren
echo never | sudo tee /sys/kernel/mm/transparent_hugepage/enabled
# Swap konfigurieren (für 4-8GB RAM)
sudo dphys-swapfile swapoff
sudo nano /etc/dphys-swapfile
# CONF_SWAPSIZE=4096
sudo dphys-swapfile setup && sudo dphys-swapfile swapon
# SSD statt SD-Karte nutzen
# -> 5-10x schneller!# Repository klonen
git clone https://github.com/makr-code/ThemisDB.git
cd ThemisDB
# COMMUNITY Edition mit LLM
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release \
-DTHEMIS_EDITION=COMMUNITY \
-DTHEMIS_ENABLE_LLM=ON \
-DTHEMIS_ENABLE_FLASH_ATTENTION=ON \
-DTHEMIS_ENABLE_ARM_NEON=ON \
..
# Kompilieren (20-60 Minuten je nach Hardware)
make -j$(nproc)
# Installieren
sudo make install# ThemisDB Server
./themis_server --config config/config.yaml
# Im Hintergrund (mit systemd)
sudo systemctl start themisdb# Health Check
curl http://localhost:8080/health
# LLM-Anfrage (mit Bearer Token)
# Hinweis: Ersetzen Sie YOUR_JWT_TOKEN mit einem gültigen Token
curl -X POST http://localhost:8080/api/v1/llm/inference \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{
"prompt": "Write a hello world program in Python",
"max_tokens": 100,
"temperature": 0.7
}'
# Chat (mit Bearer Token)
curl -X POST http://localhost:8080/api/v1/llm/inference \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{
"prompt": "Du bist ein hilfreicher Assistent. Was ist ThemisDB?",
"max_tokens": 150
}'| Hardware | RAM | Modell | Tokens/Sek | Stromverbrauch |
|---|---|---|---|---|
| RPi 4 | 4GB | TinyLlama 1.1B | 3-5 | 5-7W |
| RPi 5 | 8GB | Phi-3-Mini 3.8B | 2-3 | 8-12W |
| OPi 5 | 16GB | Mistral-7B | 3-5 | 10-15W |
| Jetson Nano | 4GB | Phi-3 (GPU) | 5-10 | 10-15W |
| Rock 5B | 16GB | Mistral-7B | 4-6 | 12-18W |
# Lösung 1: Kleinere Kontextgröße
llm:
context_size: 1024 # statt 2048
model_path: "/data/models/tinyllama-1.1b.Q4_K_M.gguf"
# Lösung 2: Swap aktivieren
# Siehe System-Optimierung oben# CPU-Governor prüfen
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# -> sollte "performance" sein
# Temperatur prüfen (Throttling?)
vcgencmd measure_temp
# -> < 80°C
# Lüfter installieren!# Pfad prüfen
stat /data/models/phi-3-mini-4k-instruct.Q4_K_M.gguf
# Berechtigungen prüfen
ls -lh /data/models/
# Neu herunterladen
cd /data/models
wget <model-url># Installation (mit modernem Keyring)
sudo mkdir -p /usr/share/keyrings
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
sudo gpg --dearmor -o /usr/share/keyrings/coral-edgetpu-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/coral-edgetpu-archive-keyring.gpg] https://packages.cloud.google.com/apt coral-edgetpu-stable main" | \
sudo tee /etc/apt/sources.list.d/coral-edgetpu.list
sudo apt update && sudo apt install -y libedgetpu1-std
# ThemisDB Config
llm:
embeddings:
backend: "coral_tpu"Performance: ~100-200 Embeddings/Sekunde
# SDK installieren
wget https://hailo.ai/downloads/hailo-sdk/hailo-sdk-latest-arm64.deb
sudo dpkg -i hailo-sdk-latest-arm64.deb
# ThemisDB Config
llm:
embeddings:
backend: "hailo"Performance: ~300-500 Embeddings/Sekunde
# RKNN Runtime
git clone https://github.com/rockchip-linux/rknn-toolkit2.git
cd rknn-toolkit2/rknpu2
sudo cp runtime/RK3588/Linux/librknn_api/aarch64/librknnrt.so /usr/lib/
sudo ldconfig
# ThemisDB Config
llm:
embeddings:
backend: "rknn"Performance: ~200-400 Embeddings/Sekunde
- ✅ SSD statt SD-Karte - 5-10x schneller
- ✅ Aktive Kühlung - Verhindert Throttling
- ✅ Performance CPU-Governor - Maximale Leistung
- ✅ Prompt-Caching aktivieren - 30-50% schneller
- ✅ Q4_K_M Quantisierung - Beste Balance
- ✅ Flash Attention - NEON-optimiert für ARM
- ✅ Swap konfigurieren - Für 4-8GB RAM
Autor: ThemisDB Team
Lizenz: MIT
Support: GitHub Issues