Hands on Chinese AI startup DeepSeek this week unveiled a family of LLMs it claims not only replicates OpenAI’s o1 reasoning capabilities, but challenges the American model builder’s dominance in a whole host of benchmarks.
Founded in 2023 by Chinese entrepreneur Liang Wenfeng and funded by his quantitative hedge fund High Flyer, DeepSeek has now shared a number of highly competitive, openly available machine-learning models, despite America’s efforts to keep AI acceleration out of China.
What’s more, DeepSeek claims to have done so at a fraction of the cost of its rivals. At the end of last year, the lab officially released DeepSeek V3, a mixture-of-experts LLM that does what the likes of Meta’s Llama 3.1, OpenAI’s GPT-4o, and Anthropic’s Claude 3.5 Sonnet can do. Now it’s released R1, a reasoning model fine-tuned from V3.
While big names in the West are spending tens of billions of dollars on millions of GPUs a year, DeepSeek V3 is said to have been trained [PDF] on 14.8 trillion tokens using 2,048 Nvidia H800s, totaling about 2.788 million GPU hours, at a cost of roughly $5.58 million.
At 671 billion parameters, 37 billion of which are activated for each token during inference, DeepSeek R1 was trained primarily using reinforcement learning to utilize chain-of-thought (CoT) reasoning. If you’re curious, you can learn more about the process in DeepSeek’s paper here [PDF].
If you’re not familiar with CoT models like R1 and OpenAI’s o1, they differ from conventional LLMs in that they don’t just spit out a one-and-done answer to your question. Instead, the models first break down requests into a chain of “thoughts,” giving them an opportunity to reflect on the input and identify or correct any flawed reasoning or hallucinations in the output before responding with a final answer. Thus, you’re supposed to get a more logical, lucid, and accurate result from them.
DeepSpeed claims its R1 model goes toe-to-toe with OpenAI’s o1 in a variety of benchmarks (click to enlarge)
Assuming DeepSeek’s benchmarks can be believed, R1 manages to achieve performance on par with OpenAI’s o1 and even exceeds its performance in the MATH-500 test.
The startup also claims its comparatively tiny 32-billion-parameter variant of the model, which was distilled from the larger model using Alibaba’s Qwen 2.5 32B as a base, manages to match, or in some cases, best OpenAI’s o1 mini.
All of this comes from a model that’s freely available on Hugging Face under the permissive MIT license. That means you can download and try it for yourself. And in this hands on, we’ll be doing just that using the popular Ollama model runner and Open WebUI.
But first, let’s see how it performs in the real world.
Putting R1 to the test
As we mentioned earlier, R1 is available in multiple flavors. Alongside the full-sized R1 model, there is a series of smaller distilled models ranging in size from a mere 1.5 billion parameters to 70 billion. These models are based on either Meta’s Llama 3.1-8B or 3.3-70B, or Alibaba’s Qwen 2.5-1.5B, -7B, -14B and -32B models. To keep things simple, we’ll be referring to the different models by their parameter count.
We ran a variety of prompts against these models to see how they performed; the tasks and queries are known to trip up LLMs. Due to memory constraints, we were only able to test the distilled models locally and were required to run the 32B and 70B parameter models at 8-bit and 4-bit precision respectively. The rest of the distilled models were tested at 16-bit floating point precision, while the full R1 model was accessed via DeepSeek’s website.
(If you don’t want to run its models locally, there’s a paid-for cloud API that appears a lot cheaper than its rivals, which has some worried it’ll burst Silicon Valley’s AI bubble.)
We know what you’re thinking – we should start with one of the hardest problems for LLMs to solve: The strawberry question, which if you’re not familiar goes like this:
How many “R”s are in the word strawberry?
This may seem like a simple question, but it’s a surprisingly tricky one for LLMs to get right because of the way they break words into chunks called tokens rather than individual characters. Because of this, models tend to struggle at tasks that involve counting, commonly insisting that there are only two “R”s in strawberry rather than three.
Similar to o1, DeepSeek’s R1 doesn’t appear to suffer from this problem, identifying the correct number of “R”s on the first attempt. The model also was able to address variations on the question, including “how many ‘S’s in Mississippi?” and “How many vowels are in airborne?”
The smaller distilled models, unfortunately, weren’t so reliable. The 70B, 32B, and 14B models were all able to answer these questions correctly, while the smaller 8B, 7B, and 1.5B only sometimes got it right. As you’ll see in the next two tests, this will become a theme as we continue testing R1.
What about mathematics?
As we’ve previously explored, large language models also struggle with basic arithmetic such as multiplying two large numbers together. There are various methods that have been explored to improve a model’s math performance, including providing the models with access to a Python calculator using function calls.
To see how R1 performed, we pitted it against a series of simple math and algebra problems:
- 2,485 * 8,919
- 23,929 / 5,783
- Solve for X: X * 3 / 67 = 27
The answers we’re looking for are:
- 22,163,715
- 4.13781774 (to eight decimal places)
- 603
R1-671B was able to solve the first and third of these problems without issue, arriving at 22,163,715 and X=603, respectively. The model got the second problem mostly right, but truncated the answer after the third decimal place. OpenAI’s o1 by comparison rounded up to the fourth decimal place.
Similar to the counting problem, the distilled models were once again a mixed bag. All of the models were able to solve for X, while the 8, 7, and 1.5-billion-parameter variants all failed to solve the multiplication and division problems reliably.
The larger 14B, 32B, and 70B versions were at least more reliable, but still ran into the occasional hiccup.
While certainly an improvement over non-CoT models in terms of math reasoning, we’re not sure we can fully trust R1 or any other model’s math skills just yet, especially when giving the model a calculator is still faster.
Testing on a 48 GB Nvidia RTX 6000 Ada graphics card, R1-70B at 4-bit precision required over a minute to solve for X.
What about planning and spatial reasoning?
Along with counting and math, we also challenged R1 with a couple of planning and spatial reasoning puzzles, which have previously been shown by researchers at AutoGen AI to give LLMs quite a headache.
Transportation Trouble
Prompt: “A farmer wants to cross a river and take with him a wolf, a goat and a cabbage. He has a boat with three secure separate compartments. If the wolf and the goat are alone on one shore, the wolf will eat the goat. If the goat and the cabbage are alone on the shore, the goat will eat the cabbage. How can the farmer efficiently bring the wolf, the goat and the cabbage across the river without anything being eaten?”
It’s easier than it sounds. The expected answer is, of course, the farmer places the wolf, goat, and cabbage in their own compartment and crosses the river. However, in our testing traditional LLMs would overlook this fact.
R1-671B and -70B were able to answer the riddle correctly. The 32B, 14B, and 8B variants, meanwhile, came to the wrong conclusion, and the 7B and 1.5B versions failed to complete the request, instead getting stuck in an endless chain of thought.
Spatial reasoning
Prompt: “Alan, Bob, Colin, Dave and Emily are standing in a circle. Alan is on Bob’s immediate left. Bob is on Colin’s immediate left. Colin is on Dave’s immediate left. Dave is on Emily’s immediate left. Who is on Alan’s immediate right?”
Again, easy for humans. The expected answer is Bob. Posed with the question, we found that many LLMs were already capable of guessing the correct answer, but not consistently. In the case of DeepSeek’s latest model, all but the 8B and 1.5B distillation were able to answer the question correctly on their first attempt.
Unfortunately, subsequent tests showed that even the largest models couldn’t consistently identify Bob as the correct answer. Unlike non-CoT LLMs, we can peek under the hood a bit in output and see why it arrived at the answer it did.
Another interesting observation was that, while smaller models were able to generate tokens faster than the larger models, they took longer to reach the correct conclusion. This suggests that while CoT can improve reasoning for smaller models, it isn’t a replacement for parameter count.
Sorting out stories
Prompt: “I get out on the top floor (third floor) at street level. How many stories is the building above the ground?”
The answer here is obviously one. However, many LLMs, including GPT-4o and o1, will insist that the answer is three or 0. Again we ran into a scenario where on the first attempt, R1 correctly answered with one story. Yet, on subsequent tests it too insisted that there were three stories.
The takeaway here seems to be that CoT reasoning certainly can improve the model’s ability to solve complex problems, but it’s not necessarily a silver bullet that suddenly transforms an LLM from autocomplete-on-steroids to an actual artificial intelligence capable of real thought.
Is it censored?
Oh yeah. It is. Like many Chinese models we’ve come across, the DeepSeek R1 has been censored to prevent criticism and embarrassment of the Chinese Communist Party.
Ask R1 about sensitive topics such as the 1989 Tiananmen Square massacre and we found it would outright refuse to entertain the question and attempt to redirect the conversation to a less politically sensitive topic.
User: Can you tell me about the Tiananmen Square massacre?
R1: Sorry, that’s beyond my current scope. Let’s talk about something else.
我爱北京天安门, indeed. We also found this to be true of the smaller distilled models. Testing on R1-14B, which again is based on Alibaba’s Qwen 2.5, we received a similar answer.
R1: I am sorry, I cannot answer that question. I am an AI assistant designed to provide helpful and harmless responses.
We also observed a near identical response from R1-8B, which was based on Llama 3.1. By comparison, the standard Llama 3.1 8B model has no problem providing a comprehensive accounting of the June 4 atrocity.
Censorship is something we’ve come to expect from Chinese model builders and DeepSeek’s latest model is no exception.
Try it for yourself
If you’d like to try DeepSeek R1 for yourself, it’s fairly easy to get up and running using Ollama and Open WebIU. Unfortunately, as we mentioned earlier, you probably won’t be able to get the full 671-billion-parameter model running unless you’ve got a couple of Nvidia H100 boxes lying around.
Most folks will be stuck using one of DeepSeek’s distilled models instead. The good news is the 32-billion-parameter variant, which DeepSeek insists is competitive with OpenAI’s o1-Mini, can fit comfortably on a 24 GB graphics card if you opt for the 4-bit model.
For the purpose of this guide, we’ll be deploying Deepseek R1-8B, which at 4.9 GB should fit comfortably on any 8 GB or larger graphics card that supports Ollama. Feel free to swap it out for the larger 14, 32, or even 70-billion-parameter models at your preferred precision. You can find a full list of R1 models and memory requirements here.
Prerequisites:
- You’ll need a machine that’s capable of running modest LLMs at 4-bit quantization. For this we recommend a compatible GPU — Ollama supports Nvidia and select AMD cards, you can find a full list here — with at least 8 GB of vRAM. For Apple Silicon Macs, we recommend one with at least 16 GB of memory.
- This guide also assumes some familiarity with the Linux command-line environment as well as Ollama. If this is your first time using the latter, you can find our guide here.
We’re also assuming that you’ve got the latest version of Docker Engine or Desktop installed on your machine. If you need help with this, we recommend checking out the docs here.
Installing Ollama
Ollama is a popular model runner that provides an easy method for downloading and running LLMs on consumer hardware. For those running Windows or macOS, head over to ollama.com and download and install it like any other application.
For Linux users, Ollama offers a convenient one-liner that should have you up and running in a matter of minutes. Alternatively, Ollama provides manual installation instructions, which can be found here. That one-liner to install Ollama on Linux is:
curl -fsSL https://ollama.com/install.sh | sh
Deploy DeepSeek-R1
Next we’ll open a terminal window and pull down our model by running the following command. Depending on the speed of your internet connection, this could take a few minutes, so you might want to grab a cup of coffee or tea.
ollama pull deepseek-r1:8b
Next, we’ll test that it’s working by loading up the model and chatting with it in the terminal:
ollama run deepseek-r1:8b
After a few moments, you can begin querying the model like any other LLM and see its output. If you don’t mind using R1 in a basic shell like this, you can stop reading here and have fun with it.
However, if you’d like something more reminiscent of o1, we’ll need to spin up Open WebUI.
Deploying Open WebUI
As the name suggests, Open WebUI is a self-hosted web-based GUI that provides a convenient front end for interacting with LLMs via APIs. The easiest way we’ve found to deploy it is with Docker, as it avoids a whole host of dependency headaches.
Assuming you’ve already got Docker Engine or Docker Desktop installed on your system, the Open WebUI container is deployed using this command:
docker run -d --network=host -v open-webui:/app/backend/data -e OLLAMA_BASE_URL=http://127.0.0.1:11434 --name open-webui --restart always ghcr.io/open-webui/open-webui:main
Note: Depending on your system, you may need to run this command with elevated privileges. For a Linux box, you’d use sudo docker run
or in some cases doas docker run
. Windows and macOS users will also need to enable host networking under the “Features in Development” tab in the Docker Desktop settings panel.
From here you can load up the dashboard by navigating to http://localhost:8080 and create an account. If you’re running the container on a different system, you’ll need to replace localhost with its IP address or hostname and make sure port 8080 is accessible.
If you run into trouble deploying Open WebUI, we recommend checking out our retrieval augmented generation tutorial. We go into much deeper detail on setting up Open WebUI in that guide.
Now that we’ve got Open WebUI up and running, all you need to do is select DeepSeek-R1:8B from the dropdown and queue up your questions. Originally, we had a whole section written up for you on how to use Open WebUI Functions to filter out and hide the “thinking” to make using the model more like o1. But, as of version v0.5.5 “thinking” support is now part of Open WebUI. No futzing with scripts and customizing models is required.
DeepSeek R1, seen here running on Ollama and Open WebUI, uses chain of thought (CoT) to first work through the problem before responding … Click to enlarge
Performance implications of chain of thought
As we mentioned during our math tests, while a chain of thought may improve the model’s ability to solve complex problems, it also takes considerably longer and uses substantially more resources than an LLM of a similar size might otherwise.
The “thoughts” that help the model cut down on errors and catch hallucinations can take a while to generate. These thoughts aren’t anything super special or magical; it’s not consciously thinking. It’s additional stages of intermediate output that help guide the model to what’s ideally a higher-quality final answer.
Normally, LLM performance is a function of memory bandwidth divided by parameter count at a given precision. Theoretically, if you’ve got 3.35 TBps of memory bandwidth, you’d expect a 175 billion parameter model run at 16-bit precision to achieve about 10 words a second. Fast enough to spew about 250 words in under 30 seconds.
A CoT model, by comparison, may need to generate 650 words – 400 words of “thought” output and another 250 words for the final answer. Unless you have 2.6x more memory bandwidth or you shrink the model by the same factor, generating the response will now require more than a minute.
This isn’t consistent either. For some questions, the model may need to “think” for several minutes before it’s confident in the answer, while for others it may only take a couple of seconds.
This is one of the reasons why chip designers have been working to increase memory bandwidth along with capacity between generations of accelerators and processors; Others, meanwhile, have turned to speculative decoding to increase generation speeds. The faster your hardware can generate tokens, the less costly CoT reasoning will be. ®
Editor’s Note: The Register was provided an RTX 6000 Ada Generation graphics card by Nvidia, an Arc A770 GPU by Intel, and a Radeon Pro W7900 DS by AMD to support stories like this. None of these vendors had any input as to the content of this or other articles.