[GH-ISSUE #5339] Deepseek coder v2 is providing gibberish output #49854

Closed
opened 2026-04-28 13:13:03 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @Manik04IISER on GitHub (Jun 27, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/5339

What is the issue?

The Model being Deepseek Coder v2 16b q: 5_K_M
I provided a code block to the model and it started to produce gibberish. Whereas for any other model, it works fine.
Screenshot_2024-06-28-00-46-09_1920x1080

The log file :
Screenshot_2024-06-28-00-48-23_1920x1080

OS

Linux

GPU

Nvidia

CPU

AMD

Ollama version

0.1.47

Originally created by @Manik04IISER on GitHub (Jun 27, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/5339 ### What is the issue? The Model being Deepseek Coder v2 16b q: 5_K_M I provided a code block to the model and it started to produce gibberish. Whereas for any other model, it works fine. ![Screenshot_2024-06-28-00-46-09_1920x1080](https://github.com/ollama/ollama/assets/120251924/fceb7566-cc56-4537-bbb4-6ad431b92db7) The log file : ![Screenshot_2024-06-28-00-48-23_1920x1080](https://github.com/ollama/ollama/assets/120251924/4e9da3b8-a649-4b34-ada3-35fed1264b09) ### OS Linux ### GPU Nvidia ### CPU AMD ### Ollama version 0.1.47
GiteaMirror added the memorybug labels 2026-04-28 13:13:03 -05:00
Author
Owner

@rick-github commented on GitHub (Jun 27, 2024):

Seems to work OK with an NVIDIA GeForce RTX 4070, or at least generates sensible output. In this case, 24 layers get offloaded to the GPU. If I set layers to 0 (/set parameter num_gpu 0) so it all runs on CPU, it also works fine. But if I set num_gpu to 7,as per your log, I get gibberish output. So number of layers running on the GPU is an influencing factor.

<!-- gh-comment-id:2195686107 --> @rick-github commented on GitHub (Jun 27, 2024): Seems to work OK with an NVIDIA GeForce RTX 4070, or at least generates sensible output. In this case, 24 layers get offloaded to the GPU. If I set layers to 0 (`/set parameter num_gpu 0`) so it all runs on CPU, it also works fine. But if I set `num_gpu` to 7,as per your log, I get gibberish output. So number of layers running on the GPU is an influencing factor.
Author
Owner

@Manik04IISER commented on GitHub (Jun 27, 2024):

Yes for 0, it's fine but for 7 it's awful and the same is true for 6. If I run it fully on the cpu, performance is bad. So, hopefully someone updates it or perhaps a workaround.

<!-- gh-comment-id:2195722169 --> @Manik04IISER commented on GitHub (Jun 27, 2024): Yes for 0, it's fine but for 7 it's awful and the same is true for 6. If I run it fully on the cpu, performance is bad. So, hopefully someone updates it or perhaps a workaround.
Author
Owner

@Manik04IISER commented on GitHub (Jul 4, 2024):

Just an update I have been using the mannix version of the deepseek coder v2 and it's been working perfectly, no crashes, nothing gibberish, and no Chinese. So perhaps please check, what's up with the official one.

<!-- gh-comment-id:2209435247 --> @Manik04IISER commented on GitHub (Jul 4, 2024): Just an update I have been using the mannix version of the deepseek coder v2 and it's been working perfectly, no crashes, nothing gibberish, and no Chinese. So perhaps please check, what's up with the official one.
Author
Owner

@rick-github commented on GitHub (Nov 6, 2024):

This appears to have been fixed in 0.2.8, probably due to the update in llama.cpp.

It continues to work in 0.3.14 for all layer counts.

$ for i in {1..28} ; do printf "%2d " $i ; curl -s localhost:11434/api/chat -d '{"model":"deepseek-coder-v2:16b-lite-instruct-q5_K_M","messages":[{"role":"user","content":'"$(jq -sR . 5339.txt)"'}],"options":{"num_gpu":'$i',"num_predict":20},"stream":false}' | jq .message.content ; done
 1 " The provided Python script is designed to generate and visualize the 3D trajectory of the Lorentz attractor for"
 2 " This Python script is designed to simulate and visualize the Lorenz attractor, a system of three ordinary differential equations"
 3 " To complete the provided code, you need to define the `Lorentz` function and ensure that it"
 4 " The provided Python code is designed to simulate the Lorenz system, a set of ordinary differential equations that are"
 5 " The provided code snippet is a Python script that simulates and plots the trajectories of the Lorenz system,"
 6 " The provided Python code snippet is intended to generate and plot the 3D trajectories of a Lorenz system"
 7 " The provided code snippet is intended to generate and plot the 3D trajectories of the Lorentz attractor for"
 8 " This Python code is designed to simulate and visualize the Lorenz attractor, a system of three ordinary differential equations"
 9 " The code you've provided is a Python script that simulates the Lorentz attractor using the `solve"
10 " To complete the provided code, we need to define the Lorentz system and ensure that the plot is correctly"
11 " The provided code snippet is intended to visualize the bifurcation diagram of the Lorentz attractor by plotting 3D"
12 " This Python script is designed to generate and visualize the bifurcation diagram of the Lorentz attractor, a system of"
13 " The provided code is a Python script that uses the `solve_ivp` function from SciPy"
14 " The provided code snippet is intended to generate and visualize the 3D bifurcation diagram of the Lorentz attractor"
15 " It looks like you're trying to create a 3D bifurcation diagram for the Lorentz attractor by"
16 " The code provided is designed to visualize the 3D bifurcation diagram of the Lorenz system, which is"
17 " The code provided is designed to simulate and visualize the behavior of the Lorentz attractor, a chaotic system known"
18 " The provided Python code is designed to simulate the Lorentz attractor and visualize its 3D trajectory as a"
19 " The provided Python script is designed to generate and visualize the 3D bifurcation diagram of the Lorentz attractor"
20 " The provided Python code is designed to simulate and visualize the Lorenz attractor, a system of three ordinary differential"
21 " The provided Python script is designed to plot the 3D trajectories of the Lorentz attractor for a range"
22 " The provided Python code is designed to simulate the Lorentz attractor, a system of three ordinary differential equations that"
23 " The provided Python code is intended to simulate and visualize the behavior of the Lorenz system, a set of"
24 " It looks like you have a script to generate and plot the 3D trajectories of the Lorenz system"
25 " The provided Python code is intended to generate and plot the 3D trajectories of the Lorenz system,"
26 " It looks like you're trying to generate a 3D bifurcation diagram for the Lorentz attractor by"
27 " The provided code is a Python script that simulates the Lorentz attractor, which is a system of three"
28 " The provided code snippet is intended to generate and visualize the 3D bifurcation diagram of the Lorentz attractor"
<!-- gh-comment-id:2459609124 --> @rick-github commented on GitHub (Nov 6, 2024): This appears to have been fixed in 0.2.8, probably due to the [update](https://github.com/ollama/ollama/commit/f8fedbda20b1b2531499ba64758642b0568b6f01) in llama.cpp. It continues to work in 0.3.14 for all layer counts. ```console $ for i in {1..28} ; do printf "%2d " $i ; curl -s localhost:11434/api/chat -d '{"model":"deepseek-coder-v2:16b-lite-instruct-q5_K_M","messages":[{"role":"user","content":'"$(jq -sR . 5339.txt)"'}],"options":{"num_gpu":'$i',"num_predict":20},"stream":false}' | jq .message.content ; done 1 " The provided Python script is designed to generate and visualize the 3D trajectory of the Lorentz attractor for" 2 " This Python script is designed to simulate and visualize the Lorenz attractor, a system of three ordinary differential equations" 3 " To complete the provided code, you need to define the `Lorentz` function and ensure that it" 4 " The provided Python code is designed to simulate the Lorenz system, a set of ordinary differential equations that are" 5 " The provided code snippet is a Python script that simulates and plots the trajectories of the Lorenz system," 6 " The provided Python code snippet is intended to generate and plot the 3D trajectories of a Lorenz system" 7 " The provided code snippet is intended to generate and plot the 3D trajectories of the Lorentz attractor for" 8 " This Python code is designed to simulate and visualize the Lorenz attractor, a system of three ordinary differential equations" 9 " The code you've provided is a Python script that simulates the Lorentz attractor using the `solve" 10 " To complete the provided code, we need to define the Lorentz system and ensure that the plot is correctly" 11 " The provided code snippet is intended to visualize the bifurcation diagram of the Lorentz attractor by plotting 3D" 12 " This Python script is designed to generate and visualize the bifurcation diagram of the Lorentz attractor, a system of" 13 " The provided code is a Python script that uses the `solve_ivp` function from SciPy" 14 " The provided code snippet is intended to generate and visualize the 3D bifurcation diagram of the Lorentz attractor" 15 " It looks like you're trying to create a 3D bifurcation diagram for the Lorentz attractor by" 16 " The code provided is designed to visualize the 3D bifurcation diagram of the Lorenz system, which is" 17 " The code provided is designed to simulate and visualize the behavior of the Lorentz attractor, a chaotic system known" 18 " The provided Python code is designed to simulate the Lorentz attractor and visualize its 3D trajectory as a" 19 " The provided Python script is designed to generate and visualize the 3D bifurcation diagram of the Lorentz attractor" 20 " The provided Python code is designed to simulate and visualize the Lorenz attractor, a system of three ordinary differential" 21 " The provided Python script is designed to plot the 3D trajectories of the Lorentz attractor for a range" 22 " The provided Python code is designed to simulate the Lorentz attractor, a system of three ordinary differential equations that" 23 " The provided Python code is intended to simulate and visualize the behavior of the Lorenz system, a set of" 24 " It looks like you have a script to generate and plot the 3D trajectories of the Lorenz system" 25 " The provided Python code is intended to generate and plot the 3D trajectories of the Lorenz system," 26 " It looks like you're trying to generate a 3D bifurcation diagram for the Lorentz attractor by" 27 " The provided code is a Python script that simulates the Lorentz attractor, which is a system of three" 28 " The provided code snippet is intended to generate and visualize the 3D bifurcation diagram of the Lorentz attractor" ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#49854