Sign inSign up

dachack/ollama-intel-docker

By dachack

Updated about 2 hours ago

Image
0

10K+

dachack/ollama-intel-docker repository overview

Ollama with Intel GPUs

This repository demonstrates running Ollama with ipex-llm as an accelerated backend, compatible with both Intel iGPUs and dedicated GPUs (such as Arc, Flex, and Max). The provided docker-compose.yml file includes a patched version of Ollama for Intel acceleration with the required parameters and settings, along with the Open WebUI interface for convenience.

Benchmark results

Read more about the project and benchmark results in blog post: https://nikolasent.github.io/hardware/deeplearning/2025/02/09/iGPU-Benchmark-VLM.html. The results were obtained with intelanalytics/ipex-llm-inference-cpp-xpu:2.2.0-SNAPSHOT base Docker image running on Debian 12 with Kernel 6.11.5.

Quick Start

Using Intel GPUs requires that you have Intel firmware installed. For example, on Debian-like systems:

sudo apt-get install firmware-misc-nonfree firmware-intel-graphics
sudo update-initramfs -u -k all  # Required after kernel updates as well.

Docker and docker compose are also required.

docker compose build
docker compose up -d

Open http://127.0.0.1:18080 to access Open WebUI with accelerated ollama backend.

Tip: For performance monitoring, including GPU utilization and power usage, intel-gpu-top is a useful tool, which is provided as part of intel-gpu-tools package:

sudo apt install intel-gpu-tools
sudo intel_gpu_top

Alternatively, one may compile btop++ with Intel GPU support.

Parameters

The Docker environment is pre-configured to run on Intel iGPUs. Here are some parameters that may need adjustment:

In the docker-compose.yml file:

  • Configure the volumes of services to set up where data and models will be stored. Prefer using disks with fast I/O.
  • Use memory limit features, such as mem_limit: "32G", to limit RAM used by ipex_ollama service.
  • Configure DEVICE variable if another hardware, such as a dedicated GPU, is used.
  • Customize OLLAMA_NUM_GPU if required to manage GPU offload.
  • Other Ollama variables can be specified in the environment section of the ipex_ollama service. For example, set OLLAMA_NUM_CTX to change the default model context length (it is set to be 8192 by default). Please note that some variable names are different from those used for similar purposes in the original Ollama.

Advice on performance

  1. If using CPU inference, tuning the num_thread model parameter in ollama for specific tasks (given the model and context length) may improve performance.
  2. Use the cpuset option in docker-compose.yml to pin the ipex_ollama service to specific CPU cores. For example, use cpuset: "0-3" to utilize the first four CPU cores (e.g., to use performance cores only). Select the most performant value empirically.
  3. It can be a good idea to use optimised models, for example, the models optimised by Unsloth to achieve better performance (for example, Qwen3:4b with Unsloth optimisations runs 3.8% faster on an iGPU).

Benchmarks

The script scripts/benchmark.py contains a benchmarking tool that evaluates tokens/s generated by any OpenAI-compatible API, including benchmarks for both Language Models (LLMs) and Vision-Language Models (VLMs). The benchmarks are reported on an Intel Ultra 5 125H Meteor Lake SoC with 64GB RAM.

With sufficient RAM, this SoC can handle relatively large models locally, making it a power-efficient solution for low-cost experiments with local models.

Feel free to explore the benchmark code and adjust it as needed for your specific experimentation and setup. The provided code is configured to produce the results below, so ensure that the required models are pulled before running the benchmark script.

The benchmark script is designed to be a standalone script that can be executed from the host machine (not from inside the Docker environment). One can use this benchmark code to test any OpenAI-compatible APIs by adjusting the API_URI and specifying the required model names.

Language models
ModelUltra 5 CPU tokens/sUltra 5 iGPU tokens/sRTX 3090 tokens/s
deepseek-r1:70b1.12 ± 0.071.65 ± 0.08NA
llama3.3:70b1.16 ± 0.011.58 ± 0.00NA
llama3.1:70b1.17 ± 0.001.57 ± 0.00NA
llama3.1:8b9.76 ± 0.1812.69 ± 0.20104.31 ± 2.06
qwen3:32b3.10 ± 0.242.68 ± 0.0932.90 ± 1.03
qwen3:30b-a3b12.83 ± 0.1019.83 ± 0.54121.39 ± 0.73
qwen3:8b11.59 ± 0.0610.67 ± 0.13101.30 ± 0.73
qwen3:4b16.49 ± 0.1518.00 ± 0.39127.23 ± 1.61
qwen2.5:72b1.11 ± 0.011.24 ± 0.00NA
qwen2.5:32b2.46 ± 0.013.44 ± 0.0231.91 ± 0.34
qwen2.5:7b10.26 ± 0.1813.06 ± 0.09101.03 ± 1.01
qwq2.29 ± 0.083.01 ± 0.0430.53 ± 0.75
mistral-small:24b3.37 ± 0.034.87 ± 0.0245.31 ± 0.25
phi4:14b5.27 ± 0.087.11 ± 0.0664.09 ± 0.95
phi3.5:3.8b19.07 ± 0.8619.60 ± 2.42171.51 ± 1.15
llama3.2:3b20.63 ± 0.4423.20 ± 0.26161.96 ± 3.01
smallthinker:3b13.83 ± 0.6314.66 ± 0.42105.53 ± 1.84
smollm2:1.7b27.41 ± 0.6627.84 ± 0.65209.49 ± 1.78
smollm2:360m57.56 ± 2.6335.13 ± 0.32250.60 ± 8.13
starcoder2:3b19.47 ± 1.5122.30 ± 2.38177.34 ± 3.42
qwen2.5-coder:1.5b27.19 ± 0.2636.74 ± 0.23170.02 ± 4.20
opencoder:1.5b32.88 ± 1.6017.67 ± 0.90207.72 ± 3.92
VLMs
ModelUltra 5 iGPU tokens/sRTX 3090 tokens/s
llama3.2-vision:90b0.92 ± 0.01NA
llama3.2-vision:11b5.73 ± 0.0361.90 ± 0.20
minicpm-v:8b14.94 ± 0.4198.69 ± 0.18
llava-phi3:3.8b18.93 ± 0.12154.73 ± 1.62
moondream:1.8b35.53 ± 1.48280.98 ± 45.34
  1. Intel docs on ipex-llm: Run Ollama with IPEX-LLM on Intel GPU.
  2. ipex-llm repo.

Tag summary

Content type

Image

Digest

sha256:b97b4deac

Size

7 GB

Last updated

about 2 hours ago

docker pull dachack/ollama-intel-docker