DGX SparkNVIDIA DGX Spark

How to Run DeepSeek R1 on a DGX Spark with Ollama

Run DeepSeek as a local LLM on one 128 GB DGX Spark with Ollama: which model fits, the exact commands for your team and code, and a test that no prompt leaves.

11 min readFedir Plotnikov
How to Run DeepSeek R1 on a DGX Spark with Ollama

You have root SSH on one DGX Spark, and your team needs a DeepSeek chat window and API, with nothing sent to DeepSeek's servers. The open weights make that possible, but on one unit "DeepSeek" means a model from January 2025, and it answers slowly.

A partner in Italy asked us specifically about DeepSeek.

Three things are called DeepSeek

The app and the API. DeepSeek's privacy policy, updated 10 February 2026, says: "we directly collect, process and store your Personal Data in People's Republic of China". In January 2025 Italy's data protection authority ordered a limitation on processing Italian users' data. That June, Berlin's commissioner reported the app to Apple and Google as illegal content. By its June 2026 report both had declined to block it. None of this concerns weights you run yourself.

The current open weights, DeepSeek V4. As published, they do not fit one unit's 128 GB. V4-Flash has about 160 GB of official weights. Ollama lists V4 only as cloud tags, which run on Ollama's servers. A prompt sent to one leaves your machine.

The R1 distills. These fit. DeepSeek's model card calls them "fine-tuned based on open-source models, using samples generated by DeepSeek-R1". deepseek-r1:32b (20 GB) is Alibaba's Qwen2.5-32B and deepseek-r1:70b (43 GB) is Meta's Llama 3.3 70B, both trained this way and released in January 2025. The 70b also falls under Meta's Llama 3.3 license, though Ollama's tag shows only DeepSeek's MIT text. The full 671B R1 is too large for one unit or two. It takes 404 GB in the same library even at 4-bit quantization (weights stored at reduced precision). This guide uses the 32b. The 70b is about half as fast.

How fast will it be?

We could not find published figures for these two tags on this hardware and have none of our own yet. The nearest come from Ollama's tests of October 2025 (version 0.12.6), in tokens per second at 4-bit (Q4_K_M):

  • Qwen3 32B, a dense stand-in for deepseek-r1:32b: 9.4
  • Llama 3.1 70B, a dense stand-in for deepseek-r1:70b: 4.4
  • deepseek-r1:14b itself: 20

Dense means every weight is read for every token, so memory bandwidth sets the pace. On this machine, dense 70B models decode at single-digit tokens per second.

A reasoning model thinks first, often for hundreds or thousands of tokens. At these speeds, 1,000 tokens of thinking take close to two minutes on the 32B and more than twice that on the 70B.

By default Ollama answers one request at a time here. A colleague who asks meanwhile waits for the whole answer, thinking included. OLLAMA_NUM_PARALLEL raises the limit but costs memory per slot. For many users at once, a batching server such as vLLM fits better.

Eleven steps, each with a check

Versions and expected outputs follow the documentation of 1 December 2026 (Ollama 0.40.19).

Step 1: Check the machine

uname -m
cat /etc/os-release
nvidia-smi
free -h
ollama --version

You should see aarch64, Ubuntu 24.04 and one GPU, NVIDIA GB10, whose memory reads "Not Supported". That is expected on this chip: GPU and CPU share one memory pool, so watch free -h. The last command prints a version or "command not found". NVIDIA does not list Ollama in DGX OS.

Step 2: Install Ollama

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

The same line updates an older install. On this machine the script ends with ">>> NVIDIA GPU installed." and starts the service.

Step 3: Switch off cloud models, set the context

sudo systemctl edit ollama

In the editor:

[Service]
Environment="OLLAMA_NO_CLOUD=1"
Environment="OLLAMA_CONTEXT_LENGTH=32768"
Environment="OLLAMA_KEEP_ALIVE=-1"
sudo systemctl restart ollama
sudo journalctl -u ollama --no-pager -n 100 | grep -i "cloud disabled"
ss -tlnp | grep 11434

Settings belong in this systemd override. A variable exported in your SSH shell never reaches the service. The first line switches cloud models off, and the log must show Ollama cloud disabled: true.

The second sets the context window. Left alone, Ollama picks it by GPU memory: 256k tokens on 128 GB, capped at the model's limit. That reserves memory most chats never use. Too small fails quietly, because Ollama drops the oldest turns without an error. 32,768 suits chat. For agents and coding tools, Ollama advises at least 64,000.

The third keeps the model loaded instead of unloading it after 5 minutes. ss must show only 127.0.0.1:11434, because the local API requires no authentication.

Step 4: Pull and run the model

ollama pull deepseek-r1:32b
ollama run deepseek-r1:32b --verbose "Explain in three sentences what a vector database is."
ollama ps

The reply shows the thinking between Thinking... and ...done thinking., then the answer and timings. The last line, eval rate, is your tokens per second. ollama ps should show 100% GPU and the context you set.

Step 5: Control the reasoning

ollama run deepseek-r1:32b --hidethinking "Is 9.9 bigger than 9.11?"
ollama run deepseek-r1:32b --think=false "Is 9.9 bigger than 9.11?"

The first prints only the answer, but the model still reasons unseen, so the wait is the same. The second inserts an empty think block. DeepSeek's model card says this pattern "can adversely affect the model's performance". What these tags then return is not documented. If reasoning still shows, keep thinking on and use --hidethinking.

Step 6: Call the API from code

These tags ship without a temperature, so Ollama uses its default of 0.8. DeepSeek recommends 0.5 to 0.7. Give the settings their own model name, for the chat window and every client:

cat > Modelfile <<'EOF'
FROM deepseek-r1:32b
PARAMETER num_ctx 32768
PARAMETER temperature 0.6
EOF
ollama create deepseek-r1-32k -f Modelfile
curl http://localhost:11434/api/chat -d '{
  "model": "deepseek-r1-32k",
  "messages": [{"role": "user", "content": "How many letter r are in strawberry?"}],
  "think": true,
  "stream": false
}'

One JSON object comes back, with the thinking in message.thinking and the answer in message.content. OpenAI-style code needs the base URL http://localhost:11434/v1/, any string as key, and this name, because that endpoint cannot set the context.

Step 7: Close every port except SSH

Units rented from us have a static public IPv4, and as our FAQ says, we do not filter inbound ports. The firewall is yours.

sudo ufw allow 22/tcp
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw enable
sudo ufw status verbose

Allow SSH before you enable ufw, or you lock yourself out. If your SSH port is not 22, change the first line. Over SSH, ufw enable asks for confirmation: answer y. Expect Status: active and incoming traffic denied.

Step 8: Start Open WebUI on loopback

openssl rand -hex 32
docker run -d --name open-webui --restart always \
  --network=host \
  -e HOST=127.0.0.1 \
  -e OLLAMA_BASE_URL=http://127.0.0.1:11434 \
  -e WEBUI_SECRET_KEY=your-secret-key \
  -v open-webui:/app/backend/data \
  ghcr.io/open-webui/open-webui:v0.13.5
ss -tlnp | grep -E ":8080|:11434"

Replace your-secret-key with the first line's output and keep it, because a container recreated with another key logs everyone out. If docker answers "permission denied", run sudo usermod -aG docker $USER, then newgrp docker, as NVIDIA's container guide says.

The usual command, also in our July guide, publishes the port with -p 3000:8080. A ufw rule does not close a published port. In Docker's words, "packets are diverted before it reaches the INPUT and OUTPUT chains that ufw uses". On a public address, whoever reaches a fresh Open WebUI first becomes its administrator.

Host networking publishes nothing and lets the container reach Ollama on loopback, as Open WebUI documents. HOST=127.0.0.1 keeps the web interface there too. Open WebUI documents each flag but not the pair. Once the container is up, check that the last command shows 127.0.0.1 for both ports. Otherwise only the firewall from step 7 protects port 8080.

Step 9: Reach it through an SSH tunnel

From your laptop, both of these must fail:

curl -m 5 http://your-spark-ip:11434/api/version
curl -m 5 http://your-spark-ip:8080

Then open the tunnel:

ssh -N -o ExitOnForwardFailure=yes -L 8080:127.0.0.1:8080 -L 11434:127.0.0.1:11434 youruser@your-spark-ip

The command seems to hang: that is the tunnel. http://localhost:8080 shows "Get started with Open WebUI". Create the admin account, and sign-up switches itself off.

Each colleague opens this tunnel with their own SSH login. For their accounts, turn on New Sign Ups under your avatar > Settings > Authentication, then approve them in the Admin Panel. A larger team needs a VPN such as WireGuard and a bind address other than loopback. That is beyond this guide.

Step 10: Survive a reboot

Run sudo reboot, reconnect, then:

systemctl is-active ollama
docker ps
curl http://localhost:11434/api/generate -d '{"model": "deepseek-r1:32b", "keep_alive": -1}'
ollama ps

Expect active and the container Up. After a boot the model is not in memory until the curl line preloads it with an empty request.

Step 11: Check that nothing leaves

Ollama's privacy policy says local prompts are not transmitted, but also that it "may collect limited device and usage metadata". Rather than rely on a policy, take the network away from the service with two more lines under [Service]:

sudo systemctl edit ollama
IPAddressDeny=any
IPAddressAllow=localhost
sudo systemctl restart ollama
ollama run deepseek-r1:32b "Reply with the single word: local"
ollama pull deepseek-r1:8b

With this systemd filter the service reaches loopback and nothing else, so the prompt must be answered and the pull must fail. If the pull succeeds, the filter is not active and the test proves nothing. The manual says the filter needs eBPF support in the kernel. Leave it on, and remove it only to pull another model.

The filter covers Ollama only. Open WebUI checks GitHub for updates and fetches an embedding model from Hugging Face. Once that model is cached, recreate the container with the same flags and key plus -e OFFLINE_MODE=True. Your data stays on the machine unless you send it somewhere, but your hosting provider still has physical control of the hardware.

What if it has to be DeepSeek V4?

With the official weights, one unit is out. So is Ollama, whose documentation covers several GPUs in one machine, not several machines. NVIDIA's recipe site lists DeepSeek-V4-Flash with vLLM for two linked units. In October 2026 NVIDIA measured V4-Flash-0731, the official July release, at 55.7 tokens per second, one request at a time on a coding benchmark. That run used speculative decoding, which drafts tokens ahead, so its figure does not compare with those above. The recipe runs on a community container, and NVIDIA marks it "Evaluation configuration only". We have not reproduced it.

Self-hosting does not change the model

NIST found in September 2025 that agents built on R1-0528, R1's May 2025 update, were on average 12 times more likely to follow malicious instructions than the U.S. models it compared. That November, CrowdStrike reported that the full R1 is up to 50% more likely to write code with severe vulnerabilities when a prompt touches topics politically sensitive in China. It added that its findings "largely translate one-to-one" to the 70B distill. Neither study tested V4 or the 32B distill. Review the code it writes, and supervise any agent built on it.

Test it before you promise anything

Run five prompts from your real work with --verbose on both tags and write down the eval rate and how long the thinking runs. If the team will not live with those numbers, the same steps work for any other tag. deepseek-r1:14b is much faster, and this overview shows what else runs well here.

If you have no unit yet, Sayob (Keyfinanz GmbH) can rent you a dedicated OEM GB10 system (the platform of NVIDIA's DGX Spark) with 128 GB of unified memory and root over SSH, hosted at Equinix FR5 in Frankfurt. A first week costs EUR 99 net for 7 days on one dedicated unit and is credited on your first monthly invoice if you continue: start with the first week. If you keep it, the unit is EUR 350/month net, and a linked pair is EUR 750/month net (rent a dedicated DGX Spark). We are an independent hosting provider, not affiliated with NVIDIA.

Related articles

Want help planning your hosting setup?

Talk to our team about configurations, locations and the right infrastructure for your workload.