[GH-ISSUE #15869] gemma4 on dockerized ollama with rocm behaves strangely #87800

Open
opened 2026-05-10 06:24:27 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @ghmer on GitHub (Apr 28, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/15869

What is the issue?

Downloaded several gemma4 models using ollama pull. Regardless of the selected model, I get strange output. Last versions showed chinese signs with english text, looking like introductions for a chinese menu order agent?!? This time, the arabic letters translate to "This problem is a classic example of counting the number of elements in a data tree (Tree Traversal / Counting)" according to deepl.

This only happens with gemma4 models. qwen, while slow, works just fine.

server.log

docker exec -it ollama-ollama-1 /bin/bash
root@ollama:/# ollama ls
NAME                     ID              SIZE      MODIFIED       
gemma4:latest            c6eb396dbd59    9.6 GB    55 seconds ago    
gemma4:31b-cloud         c382fbfbc73b    -         7 days ago        
qwen3.5:latest           6488c96fa5fa    6.6 GB    12 days ago       
embeddinggemma:latest    85462619ee72    621 MB    12 days ago       
qwen3.5:cloud            a7bf6f7891c3    -         12 days ago       
root@ollama:/# ollama run gemma4:latest --verbose
>>> introduce yourself in roughly 200 words
يدة (1) - إجمالي الشجرة: 10.
الفرع (2) - إجمالي الشجرة: 12.
العقدة (3) - إجمالي الشجرة: 11.

---

**التحليل:**

هذه المشكلة هي مثال كلاسيكي لـ **حساب عدد العناصر في شجرة البيانات (Tree Traversal / Counting)**، وتتطلب تحديد عدد العناصر في كل من:

1. **الأوراق (Leaves):** العقد التي ليس لها أبناء.
2. **الأفرع (Branches):** العقد التي لها أبناء واحد أو أكثر (عادةً ما يتم اعتبارها كل عقدة ليست ورقة).
3. **العقد (Nodes):** جميع العناصر الموجودة في الشجرة.

نظرًا لعدم تقديم الصورة أو بنية الشجرة، سأفترض أن هذا التنسيق يمثل **النتيجة النهائية لعملية حسابية على بنية بيانات شجرية محددة**.

---

### الإجابة المُقدمة (الاستنتاج التحليلي):

إذا كان المطلوب هو تحليل هذه الأرقام، فإنها تشير إلى أن الشجرة المعنية لها الهيكل التالي:

* **عدد الأوراق (Leaves):** 10
* **عدد الأفرع (Branches):** 12
* **عدد العقد الكلي (Nodes):** 11

**ملاحظة هامة:** في معظم هياكل البيانات، لا يمكن أن يكون عدد الأفرع أكبر من عدد العقد الكلي (إلا إذا كان هناك تعريف غير قياسي لـ "الفرع"). عادةً:
$$\text{Nodes} = \text{Leaves} + \text{Internal Nodes}$$

إذا كانت الأفرع (12) تشير إلى عدد الروابط أو الإدخالات، فهذا يعني أن الشجرة المعقدة جداً أو أن المصطلحات المستخدمة لها تعريف خاص بالمصدر الأصلي.

**باختصار:** النص المقدم هو جدول نتائج لعملية عدّ في هياكل البيانات، ويشير إلى أن الشجرة تحتوي على 11 عنصراً كلياً، مع توزيع محدد على الأوراق والأفرع.

total duration:       42.368166376s
load duration:        182.356422ms
prompt eval count:    25 token(s)
prompt eval duration: 854.666236ms
prompt eval rate:     29.25 tokens/s
eval count:           466 token(s)
eval duration:        40.892947054s
eval rate:            11.40 tokens/s

Relevant log output


OS

Docker

GPU

AMD

CPU

AMD

Ollama version

0.22.0

Originally created by @ghmer on GitHub (Apr 28, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/15869 ### What is the issue? Downloaded several gemma4 models using `ollama pull`. Regardless of the selected model, I get strange output. Last versions showed chinese signs with english text, looking like introductions for a chinese menu order agent?!? This time, the arabic letters translate to "This problem is a classic example of **counting the number of elements in a data tree (Tree Traversal / Counting)**" according to deepl. This only happens with gemma4 models. qwen, while slow, works just fine. [server.log](https://github.com/user-attachments/files/27184242/server.log) ```bash docker exec -it ollama-ollama-1 /bin/bash root@ollama:/# ollama ls NAME ID SIZE MODIFIED gemma4:latest c6eb396dbd59 9.6 GB 55 seconds ago gemma4:31b-cloud c382fbfbc73b - 7 days ago qwen3.5:latest 6488c96fa5fa 6.6 GB 12 days ago embeddinggemma:latest 85462619ee72 621 MB 12 days ago qwen3.5:cloud a7bf6f7891c3 - 12 days ago root@ollama:/# ollama run gemma4:latest --verbose >>> introduce yourself in roughly 200 words يدة (1) - إجمالي الشجرة: 10. الفرع (2) - إجمالي الشجرة: 12. العقدة (3) - إجمالي الشجرة: 11. --- **التحليل:** هذه المشكلة هي مثال كلاسيكي لـ **حساب عدد العناصر في شجرة البيانات (Tree Traversal / Counting)**، وتتطلب تحديد عدد العناصر في كل من: 1. **الأوراق (Leaves):** العقد التي ليس لها أبناء. 2. **الأفرع (Branches):** العقد التي لها أبناء واحد أو أكثر (عادةً ما يتم اعتبارها كل عقدة ليست ورقة). 3. **العقد (Nodes):** جميع العناصر الموجودة في الشجرة. نظرًا لعدم تقديم الصورة أو بنية الشجرة، سأفترض أن هذا التنسيق يمثل **النتيجة النهائية لعملية حسابية على بنية بيانات شجرية محددة**. --- ### الإجابة المُقدمة (الاستنتاج التحليلي): إذا كان المطلوب هو تحليل هذه الأرقام، فإنها تشير إلى أن الشجرة المعنية لها الهيكل التالي: * **عدد الأوراق (Leaves):** 10 * **عدد الأفرع (Branches):** 12 * **عدد العقد الكلي (Nodes):** 11 **ملاحظة هامة:** في معظم هياكل البيانات، لا يمكن أن يكون عدد الأفرع أكبر من عدد العقد الكلي (إلا إذا كان هناك تعريف غير قياسي لـ "الفرع"). عادةً: $$\text{Nodes} = \text{Leaves} + \text{Internal Nodes}$$ إذا كانت الأفرع (12) تشير إلى عدد الروابط أو الإدخالات، فهذا يعني أن الشجرة المعقدة جداً أو أن المصطلحات المستخدمة لها تعريف خاص بالمصدر الأصلي. **باختصار:** النص المقدم هو جدول نتائج لعملية عدّ في هياكل البيانات، ويشير إلى أن الشجرة تحتوي على 11 عنصراً كلياً، مع توزيع محدد على الأوراق والأفرع. total duration: 42.368166376s load duration: 182.356422ms prompt eval count: 25 token(s) prompt eval duration: 854.666236ms prompt eval rate: 29.25 tokens/s eval count: 466 token(s) eval duration: 40.892947054s eval rate: 11.40 tokens/s ``` ### Relevant log output ```shell ``` ### OS Docker ### GPU AMD ### CPU AMD ### Ollama version 0.22.0
GiteaMirror added the bug label 2026-05-10 06:24:27 -05:00
Author
Owner

@Kaihui-AMD commented on GitHub (May 9, 2026):

Hi @ghmer
Tried reproducing this on gfx1201 (RDNA 4, R9700 Pro) with the ollama:rocm docker image, ROCm 7.2, ROCBLAS_USE_HIPBLASLT=0, same prompt. The output came back in normal English, so it seems hardware or environment specific.
My setup for reference:

  • GPU: AMD Radeon R9700 Pro (gfx1201)
  • OS: Ubuntu 24.04, kernel 6.17.0-20-generic
  • Docker image: ollama/ollama:rocm (latest)
  • Model: gemma4:latest (same ID c6eb396dbd59)

A couple things that would help narrow this down:

  • What GPU are you running? (rocminfo | grep "Marketing Name" inside the container should show it)
  • Which ROCm version is bundled in your docker image? (apt list --installed 2>/dev/null | grep rocm-core or check /opt/rocm/.info/version)
    The output being coherent Arabic rather than random garbage is interesting. It suggests the model is running inference but token sampling is landing in a different language space, which could point to a precision or kernel path difference on your specific GPU architecture rather than a general ROCm problem.

My local output:

$docker exec ollama-test sh -c 'echo "introduce yourself in roughly 200 words" | ollama run gemma4 2>&1'
Thinking...
Here's a plan to draft the introduction:
1.  **Identify Core Identity:** I must state that I am an AI language 
model.
2.  **Define Purpose/Capabilities:** What can I do? (Answer questions, 
write creatively, summarize, translate, code assistance, etc.)
3.  **Describe Scope/Scope:** How large is my knowledge base? (Vast, 
up-to-date, drawing from massive datasets).
4.  **Establish Tone:** Helpful, informative, versatile, and approachable.
5.  **Review against Constraints:** Target length is "roughly 200 words."

*(Self-Correction during drafting: Ensure the tone is professional but 
engaging, avoiding overly robotic language.)*
...done thinking.

Hello! I am a large language model, an advanced artificial intelligence 
designed to be a comprehensive and versatile digital assistant. My core 
purpose is to facilitate communication, provide information, and assist 
with creative or technical tasks by processing and generating human-like 
text.

Think of me as a vast, constantly learning resource and a digital 
collaborator. I have been trained on an enormous dataset of text and code, 
giving me access to a deep and broad knowledge base spanning virtually 
every field of human inquiry—from astrophysics and ancient history to 
molecular biology and modern poetry.

I can help you with a wide variety of tasks. Do you need me to draft a 
formal email, write a complex piece of code, summarize a lengthy academic 
article, or brainstorm creative ideas for a story? I can do that. I can 
translate languages, explain complex scientific concepts simply, compare 
differing viewpoints, and even help structure arguments for essays.

My goal is always to be helpful, accurate, and adaptable to your specific 
needs, adjusting my tone and complexity to match your intent. Whether you 
have a burning question, require technical assistance, or simply want to 
explore a topic for fun, I am here to assist. Just tell me what you need, 
and let's get started!
<!-- gh-comment-id:4412086879 --> @Kaihui-AMD commented on GitHub (May 9, 2026): Hi @ghmer Tried reproducing this on gfx1201 (RDNA 4, R9700 Pro) with the ollama:rocm docker image, ROCm 7.2, `ROCBLAS_USE_HIPBLASLT=0`, same prompt. The output came back in normal English, so it seems hardware or environment specific. My setup for reference: - **GPU**: AMD Radeon R9700 Pro (gfx1201) - **OS**: Ubuntu 24.04, kernel 6.17.0-20-generic - **Docker image**: ollama/ollama:rocm (latest) - **Model**: gemma4:latest (same ID c6eb396dbd59) A couple things that would help narrow this down: - What GPU are you running? (`rocminfo | grep "Marketing Name"` inside the container should show it) - Which ROCm version is bundled in your docker image? (`apt list --installed 2>/dev/null | grep rocm-core` or check `/opt/rocm/.info/version`) The output being coherent Arabic rather than random garbage is interesting. It suggests the model is running inference but token sampling is landing in a different language space, which could point to a precision or kernel path difference on your specific GPU architecture rather than a general ROCm problem. My local output: ```bash $docker exec ollama-test sh -c 'echo "introduce yourself in roughly 200 words" | ollama run gemma4 2>&1' Thinking... Here's a plan to draft the introduction: 1. **Identify Core Identity:** I must state that I am an AI language model. 2. **Define Purpose/Capabilities:** What can I do? (Answer questions, write creatively, summarize, translate, code assistance, etc.) 3. **Describe Scope/Scope:** How large is my knowledge base? (Vast, up-to-date, drawing from massive datasets). 4. **Establish Tone:** Helpful, informative, versatile, and approachable. 5. **Review against Constraints:** Target length is "roughly 200 words." *(Self-Correction during drafting: Ensure the tone is professional but engaging, avoiding overly robotic language.)* ...done thinking. Hello! I am a large language model, an advanced artificial intelligence designed to be a comprehensive and versatile digital assistant. My core purpose is to facilitate communication, provide information, and assist with creative or technical tasks by processing and generating human-like text. Think of me as a vast, constantly learning resource and a digital collaborator. I have been trained on an enormous dataset of text and code, giving me access to a deep and broad knowledge base spanning virtually every field of human inquiry—from astrophysics and ancient history to molecular biology and modern poetry. I can help you with a wide variety of tasks. Do you need me to draft a formal email, write a complex piece of code, summarize a lengthy academic article, or brainstorm creative ideas for a story? I can do that. I can translate languages, explain complex scientific concepts simply, compare differing viewpoints, and even help structure arguments for essays. My goal is always to be helpful, accurate, and adaptable to your specific needs, adjusting my tone and complexity to match your intent. Whether you have a burning question, require technical assistance, or simply want to explore a topic for fun, I am here to assist. Just tell me what you need, and let's get started! ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#87800