ollama - 💡(How to fix) Fix Gibberish from some models with Vulkan

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

$ ollama serve
$ ollama run qwen2.5-coder:0.5b "Write a recursive Python function that computes Fibonacci's numbers!"
Certainly! Below is a Python recursive function to compute the Fibonacci sequence:

---

### Explanation:

1. **Base Case**: The function checks if `n` is less than or equal to 1. In this case, the base cases are when `n` is 0 or 1, in which case it returns `n` directly.

2. **Recursive Case**: For any other value of `n`, the function calls itself with `n-1` and `n-2`. It then adds these two results together to get the next Fibonacci number.

3. **Example Usage**: The function is called with `num = 10`, and the result is printed to verify that it correctly computes the Fibonacci number for this specific input.

This recursive approach efficiently calculates the Fibonacci sequence using a simple iterative approach, which avoids the overhead of recursion that can be seen in deeply nested loops.

---

$ OLLAMA_VULKAN=1 ollama serv
$ ollama run qwen2.5-coder:0.5b "Write a recursive Python function that computes Fibonacci's numbers!"
from#03#

---

But it can range from a some random C-code, _in medias res_ (e.g. some code from a middle of a function, then closing the function), all the way to something like `\.\.\.\.`. The best so far was this:

---

Again, the `qwen2.5-coer:1.5b` model works fine, if run without Vulkan, as does the `qwen3:0.6b` - but both are broken with Vulkan enabled.

Interestingly enought, `tinyllama` works, `yi-coder:1.5b` works, `llama3.2:1b` works,  `qwen3.5:0.8b` seems to work too, as well as `gemma3:270m`.



### OS
Linux Mint 22.3 Zena

### GPU
Intel Iris Xe - built in

### CPU
12th Gen Intel Core i5-1235U

### Ollama version
RAW_BUFFERClick to expand / collapse

What is the issue?

Some models (namely the qwen2.5-coder and qwen3 ones, but possibly others too) output gibberish, if used when running Ollama with OLLAMA_VULKAN=1; but seem to be working fine (albeit slower, I reckon) when loaded onto the CPU.

Hardware is a Microsoft Surface with built in GPU - i.e. shared memory.

Example with 100% CPU

$ ollama serve
$ ollama run qwen2.5-coder:0.5b "Write a recursive Python function that computes Fibonacci's numbers!"
Certainly! Below is a Python recursive function to compute the Fibonacci sequence:

```python
def fibonacci(n):
    if n <= 1:
        return n
    else:
        return fibonacci(n-1) + fibonacci(n-2)

# Example usage:
num = 10
result = fibonacci(num)
print(f"The {num}th Fibonacci number is: {result}")
```

### Explanation:

1. **Base Case**: The function checks if `n` is less than or equal to 1. In this case, the base cases are when `n` is 0 or 1, in which case it returns `n` directly.

2. **Recursive Case**: For any other value of `n`, the function calls itself with `n-1` and `n-2`. It then adds these two results together to get the next Fibonacci number.

3. **Example Usage**: The function is called with `num = 10`, and the result is printed to verify that it correctly computes the Fibonacci number for this specific input.

This recursive approach efficiently calculates the Fibonacci sequence using a simple iterative approach, which avoids the overhead of recursion that can be seen in deeply nested loops.

Example with Vulkan

$ OLLAMA_VULKAN=1 ollama serv
$ ollama run qwen2.5-coder:0.5b "Write a recursive Python function that computes Fibonacci's numbers!"
from#03#
```

Therefore, the answer is:

\[
\boxed{\text{Yes}}
\]

But it can range from a some random C-code, in medias res (e.g. some code from a middle of a function, then closing the function), all the way to something like \.\.\.\.. The best so far was this:

$ ollama run qwen2.5-coder:1.5b "Write a recursive Python function that computes Fibonacci's numbers!"
" +
``` +
``` +
``` +
``` +
``` +
``` +
``` +
``` +
``` +
``` +
``` +
``` +
``` +
``` +
``` +
``` +
``` +
^C

Again, the qwen2.5-coer:1.5b model works fine, if run without Vulkan, as does the qwen3:0.6b - but both are broken with Vulkan enabled.

Interestingly enought, tinyllama works, yi-coder:1.5b works, llama3.2:1b works, qwen3.5:0.8b seems to work too, as well as gemma3:270m.

OS

Linux Mint 22.3 Zena

GPU

Intel Iris Xe - built in

CPU

12th Gen Intel Core i5-1235U

Ollama version

ollama -v
ollama version is 0.21.2

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

ollama - 💡(How to fix) Fix Gibberish from some models with Vulkan