[GH-ISSUE #2391] Ollama outputs endless stream of random words #27151

Closed
opened 2026-04-22 04:07:49 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @ncarolan on GitHub (Feb 7, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2391

When running a model with any prompt, the output is a constant stream of random characters and words from various languages. The nonsensical output will continue until ollama is terminated. An example prompt and output is included below:

$ ollama run llama2
>>> hi
alseularoured阳negneg вер VALUESalling阳 statementençneg LageTX subsequent VALUES門 посownerençneg African 
calculate amerik calculate VALUES interrupted competed succeed subsequentcdot Lage VALUES VALUES 
segmentsetra Архиownerးularдні right Pubenç пос門 subsequent АрхиWR African calculate ante Storm ante 
calculateenç阳 Архи Mortремен concentrationularottedowneretraship succeed subsequent Архиeffect seis VALUE
верalse Lage stre VALUESular Lage calculateenç пос riv VALUES calculate nad Hannover облаouredoured
VALUES出 ante statement вер Betrieb calculatecdot VALUES阳TX Lage Lage subsequentishingcalled Stormalling
österreich阳 segments nad阳ovooured amerik ante верး succeed Pub Pub Архиownerishing calculate VALUES 
competed interruptedishing Stormular門shiputer nad concentration seis門 Mort Pubishing rightремен African 
MortInterceptor subsequent statement succeed Lage statementWRularençдні Lageenç African阳 Mortotted 
VALUESeffect ante門 succeedTX stre Australneg阳enç обла nad ante Hannoverbo antecdot посcalledenç посalse 
amerikowner segments阳 Lage Pub Mortularovoneg Storm Lage Архи Mortishing statement concentration門 ante Storm
Mort Betrieb riv вер Pub Africanးneg interrupted calculatenegenç wol阳 ante calculateular nadдні 
statementallingenç stre ante Архиalseençnegetraownerремен stre VALUES вер African Storm African nad 
calculate門 Africanownereffectouredneg Storm calculate верTX Africanotted ante VALUES antecdot Hannover Mort 
seis subsequent amerik subsequentboowner門阳 Mort concentrationenç обла African African Mortownerး пос Mort阳 
Stormship ante competed interruptedençetra subsequent Betrieb Lagecalled calculateular succeed anteдні riv阳
пос ante subsequentovo streuter segments succeed ante Pub succeed AustraleffectWR subsequent VALUES
...

The full output text is cut off to save space. This occurs with any prompt I tried for both llama2 and mistral. The same phenomenon occurs when using curl rather than the CLI.

Activity Monitor shows no GPU usage, so I suspect no model inference is actually occurring.

I am using a 16GB M2 Mac.

Originally created by @ncarolan on GitHub (Feb 7, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2391 When running a model with any prompt, the output is a constant stream of random characters and words from various languages. The nonsensical output will continue until ollama is terminated. An example prompt and output is included below: ``` $ ollama run llama2 >>> hi alseularoured阳negneg вер VALUESalling阳 statementençneg LageTX subsequent VALUES門 посownerençneg African calculate amerik calculate VALUES interrupted competed succeed subsequentcdot Lage VALUES VALUES segmentsetra Архиownerးularдні right Pubenç пос門 subsequent АрхиWR African calculate ante Storm ante calculateenç阳 Архи Mortремен concentrationularottedowneretraship succeed subsequent Архиeffect seis VALUE верalse Lage stre VALUESular Lage calculateenç пос riv VALUES calculate nad Hannover облаouredoured VALUES出 ante statement вер Betrieb calculatecdot VALUES阳TX Lage Lage subsequentishingcalled Stormalling österreich阳 segments nad阳ovooured amerik ante верး succeed Pub Pub Архиownerishing calculate VALUES competed interruptedishing Stormular門shiputer nad concentration seis門 Mort Pubishing rightремен African MortInterceptor subsequent statement succeed Lage statementWRularençдні Lageenç African阳 Mortotted VALUESeffect ante門 succeedTX stre Australneg阳enç обла nad ante Hannoverbo antecdot посcalledenç посalse amerikowner segments阳 Lage Pub Mortularovoneg Storm Lage Архи Mortishing statement concentration門 ante Storm Mort Betrieb riv вер Pub Africanးneg interrupted calculatenegenç wol阳 ante calculateular nadдні statementallingenç stre ante Архиalseençnegetraownerремен stre VALUES вер African Storm African nad calculate門 Africanownereffectouredneg Storm calculate верTX Africanotted ante VALUES antecdot Hannover Mort seis subsequent amerik subsequentboowner門阳 Mort concentrationenç обла African African Mortownerး пос Mort阳 Stormship ante competed interruptedençetra subsequent Betrieb Lagecalled calculateular succeed anteдні riv阳 пос ante subsequentovo streuter segments succeed ante Pub succeed AustraleffectWR subsequent VALUES ... ``` The full output text is cut off to save space. This occurs with any prompt I tried for both llama2 and mistral. The same phenomenon occurs when using curl rather than the CLI. Activity Monitor shows no GPU usage, so I suspect no model inference is actually occurring. I am using a 16GB M2 Mac.
GiteaMirror added the bug label 2026-04-22 04:07:49 -05:00
Author
Owner

@ncarolan commented on GitHub (Feb 7, 2024):

Closing as this eventually resolved itself after quitting ollama and trying again later.

<!-- gh-comment-id:1933026804 --> @ncarolan commented on GitHub (Feb 7, 2024): Closing as this eventually resolved itself after quitting ollama and trying again later.
Author
Owner

@fkauffmann commented on GitHub (Feb 23, 2024):

Same problem with ollama 0.1.25 and Mistral 7B (latest) on Ubuntu 22.04.3 LTS running with WSL2.
I'm using the following prompt to extract skills from a list of trainings:

Which skills can be acquired by following a training ollama named: {row.title}
Answer always in English. Never include comments, numbering, titles, notes or explanations in your results
Return only labels. Return a flat string like this: skillname|skillname|skillname

After several hours of execution, the return stream suddenly falls into an infinite loop.

---------------------------------------------------------------------------------------
Formation à distance: Gestion de production: Améliorer les flux logistiques - Les bases
---------------------------------------------------------------------------------------
 Production management|Logistics optimization|Industrial engineering
13167.94 ms
------------------------------------
Personal Leadership - MBA Highlights
------------------------------------
 Communication skills|Emotional intelligence|Critical thinking|Decision making|Time management|Goal setting|Problem-solving|Teamwork|Leadership|Strategic planning|Project management|Networking|Public speaking|Self-awareness|Adaptability|Creativity|Stress management|Negotiation skills|Financial literacy|Innovation|Mentoring and coaching|Conflict resolution|Active listening|Delegation|Customer focus|Accountability|Professional ethics|Integrity|Visionary thinking|Change management|Influence and persuasion|Cross-cultural effectiveness|Empathy|Resilience|Self-motivation|Adaptive leadership|Agility|Risk assessment|Feedback and reception|Global business awareness|Career development|Network building|Entrepreneurship|Professional presence|Work-life balance|Collaborative skills|Technical knowledge|Continuous learning|Multitasking|Adaptive communication|Flexibility|Initiative|Interpersonal skills|Positive attitude|Training and facilitation|Growth mindset|Empowerment|Diversity and inclusion|Social intelligence|Relationship management|Feedback delivery|Coaching for performance|Strategic networking|Vision implementation|Change leadership|Adaptive problem-solving|Flexible leadership|Continuous improvement|Cultural intelligence|Stakeholder management|Employee engagement|Collaborative problem-solving|Resourcefulness |Innovation implementation|Resilient leadership|Agile problem-solving|Crisis management|Mindset agility|Relationship building|Empathetic communication|Professional growth|Leveraging diversity|Developing others|Change facilitation|Networking for success|Goal alignment|Inspiring vision|Decision implementation|Accountability for results|Creative problem-solving|Adaptive decision making|Team leadership|Mentoring and sponsorship|Feedback culture|Collaborative decision making|Strategic thinking|Vision realization|Innovation execution|Empowered teams|Change readiness|Risk management|Professional development planning|Agile mindset|Cross-functional collaboration|Continuous improvement planning|Change readiness assessment|Strategic implementation|Collaborative visioning|Mentorship for success|Network for growth|Adaptive feedback culture|Innovative problem-solving|Empathetic leadership|Adaptive stakeholder management|Crisis communication|Adaptive decision delivery|Professional development planning and execution|Change readiness implementation|Strategic networking for growth|Collaborative vision realization|Mentoring for professional growth|Feedback for personal growth|Continuous improvement communication|Agile change leadership|Cross-functional problem-solving|Collaborative risk assessment|Resilient decision making|Empowered team development|Change leadership implementation|Adaptive stakeholder engagement|Crisis management planning|Professional growth planning|Collaborative vision execution|Mentorship for personal and professional growth|Feedback delivery and reception|Continuous improvement feedback culture|Adaptive problem solving approach|Strategic partnership building|Empowered collaboration|Change implementation communication|Resilient team development|Crisis management execution|Professional learning agility|Collaborative decision making approach|Cross-functional visioning|Agile stakeholder engagement|Flexible crisis management|Adaptive risk assessment and mitigation|Professional growth mindset|Empathetic problem solving|Change leadership communication|Adaptive team building|Crisis management planning and execution|Collaborative decision making implementation|Mentorship for adapting to change|Empowered innovation|Change implementation partnerships|Resilient vision realization|Professional development network|Adaptive crisis communication|Empathetic stakeholder engagement|Flexible problem solving approach|Agile change partnership building|Collaborative risk assessment and mitigation|Empowered decision making|Change leadership planning|Crisis management team development|Resilient vision implementation|Professional growth and development|Adaptive team performance improvement|Empathetic stakeholder collaboration|Flexible change communication|Agile problem solving partnerships|Collaborative risk assessment and mitigation implementation|Empowered strategic decision making|Change leadership execution|Crisis management partnerships|Resilient team vision realization|Professional development strategy|Adaptive team performance improvement planning|Empathetic stakeholder engagement planning|Flexible change implementation|Agile problem solving partnership planning|Collaborative risk assessment and mitigation planning|Empowered strategic communication|Change leadership strategy|Crisis management performance improvement|Resilient team vision execution|Professional development network building|Adaptive team performance improvement execution|Empathetic stakeholder engagement execution|Flexible change implementation execution|Agile problem solving partnership execution|Collaborative risk assessment and mitigation execution|Empowered strategic vision realization|Change leadership strategy execution|Crisis management team performance improvement|Resilient team development planning|Professional growth network building|Adaptive team performance improvement delivery|Empathetic stakeholder engagement delivery|Flexible change implementation delivery|Agile problem solving partnership delivery|Collaborative risk assessment and mitigation delivery|Empowered strategic decision delivery|Change leadership performance improvement|Crisis management team engagement|Resilient vision execution planning|Professional development strategy execution|Adaptive team performance improvement feedback|Empathetic stakeholder engagement feedback|Flexible change implementation feedback|Agile problem solving partnership feedback|Collaborative risk assessment and mitigation feedback|Empowered strategic communication feedback|Change leadership performance feedback|Crisis management team growth|Resilient vision execution delivery|Professional development network growth|Adaptive team performance improvement coaching|Empathetic stakeholder engagement coaching|Flexible change implementation coaching|Agile problem solving partnership coaching|Collaborative risk assessment and mitigation coaching|Empowered strategic decision coaching|Change leadership performance coaching|Crisis management team training|Resilient vision execution development|Professional development strategy development|Adaptive team performance improvement support|Empathetic stakeholder engagement support|Flexible change implementation support|...

Relaunching ollama solves the problem.

I'll test today with version 0.1.26.

However, is there a way to stop the stream when using the ollama.chat() function in Python, if the number of chunks returned is too high?

<!-- gh-comment-id:1960799999 --> @fkauffmann commented on GitHub (Feb 23, 2024): Same problem with ollama 0.1.25 and Mistral 7B (latest) on Ubuntu 22.04.3 LTS running with WSL2. I'm using the following prompt to extract skills from a list of trainings: ``` Which skills can be acquired by following a training ollama named: {row.title} Answer always in English. Never include comments, numbering, titles, notes or explanations in your results Return only labels. Return a flat string like this: skillname|skillname|skillname ``` After several hours of execution, the return stream suddenly falls into an infinite loop. ``` --------------------------------------------------------------------------------------- Formation à distance: Gestion de production: Améliorer les flux logistiques - Les bases --------------------------------------------------------------------------------------- Production management|Logistics optimization|Industrial engineering 13167.94 ms ------------------------------------ Personal Leadership - MBA Highlights ------------------------------------ Communication skills|Emotional intelligence|Critical thinking|Decision making|Time management|Goal setting|Problem-solving|Teamwork|Leadership|Strategic planning|Project management|Networking|Public speaking|Self-awareness|Adaptability|Creativity|Stress management|Negotiation skills|Financial literacy|Innovation|Mentoring and coaching|Conflict resolution|Active listening|Delegation|Customer focus|Accountability|Professional ethics|Integrity|Visionary thinking|Change management|Influence and persuasion|Cross-cultural effectiveness|Empathy|Resilience|Self-motivation|Adaptive leadership|Agility|Risk assessment|Feedback and reception|Global business awareness|Career development|Network building|Entrepreneurship|Professional presence|Work-life balance|Collaborative skills|Technical knowledge|Continuous learning|Multitasking|Adaptive communication|Flexibility|Initiative|Interpersonal skills|Positive attitude|Training and facilitation|Growth mindset|Empowerment|Diversity and inclusion|Social intelligence|Relationship management|Feedback delivery|Coaching for performance|Strategic networking|Vision implementation|Change leadership|Adaptive problem-solving|Flexible leadership|Continuous improvement|Cultural intelligence|Stakeholder management|Employee engagement|Collaborative problem-solving|Resourcefulness |Innovation implementation|Resilient leadership|Agile problem-solving|Crisis management|Mindset agility|Relationship building|Empathetic communication|Professional growth|Leveraging diversity|Developing others|Change facilitation|Networking for success|Goal alignment|Inspiring vision|Decision implementation|Accountability for results|Creative problem-solving|Adaptive decision making|Team leadership|Mentoring and sponsorship|Feedback culture|Collaborative decision making|Strategic thinking|Vision realization|Innovation execution|Empowered teams|Change readiness|Risk management|Professional development planning|Agile mindset|Cross-functional collaboration|Continuous improvement planning|Change readiness assessment|Strategic implementation|Collaborative visioning|Mentorship for success|Network for growth|Adaptive feedback culture|Innovative problem-solving|Empathetic leadership|Adaptive stakeholder management|Crisis communication|Adaptive decision delivery|Professional development planning and execution|Change readiness implementation|Strategic networking for growth|Collaborative vision realization|Mentoring for professional growth|Feedback for personal growth|Continuous improvement communication|Agile change leadership|Cross-functional problem-solving|Collaborative risk assessment|Resilient decision making|Empowered team development|Change leadership implementation|Adaptive stakeholder engagement|Crisis management planning|Professional growth planning|Collaborative vision execution|Mentorship for personal and professional growth|Feedback delivery and reception|Continuous improvement feedback culture|Adaptive problem solving approach|Strategic partnership building|Empowered collaboration|Change implementation communication|Resilient team development|Crisis management execution|Professional learning agility|Collaborative decision making approach|Cross-functional visioning|Agile stakeholder engagement|Flexible crisis management|Adaptive risk assessment and mitigation|Professional growth mindset|Empathetic problem solving|Change leadership communication|Adaptive team building|Crisis management planning and execution|Collaborative decision making implementation|Mentorship for adapting to change|Empowered innovation|Change implementation partnerships|Resilient vision realization|Professional development network|Adaptive crisis communication|Empathetic stakeholder engagement|Flexible problem solving approach|Agile change partnership building|Collaborative risk assessment and mitigation|Empowered decision making|Change leadership planning|Crisis management team development|Resilient vision implementation|Professional growth and development|Adaptive team performance improvement|Empathetic stakeholder collaboration|Flexible change communication|Agile problem solving partnerships|Collaborative risk assessment and mitigation implementation|Empowered strategic decision making|Change leadership execution|Crisis management partnerships|Resilient team vision realization|Professional development strategy|Adaptive team performance improvement planning|Empathetic stakeholder engagement planning|Flexible change implementation|Agile problem solving partnership planning|Collaborative risk assessment and mitigation planning|Empowered strategic communication|Change leadership strategy|Crisis management performance improvement|Resilient team vision execution|Professional development network building|Adaptive team performance improvement execution|Empathetic stakeholder engagement execution|Flexible change implementation execution|Agile problem solving partnership execution|Collaborative risk assessment and mitigation execution|Empowered strategic vision realization|Change leadership strategy execution|Crisis management team performance improvement|Resilient team development planning|Professional growth network building|Adaptive team performance improvement delivery|Empathetic stakeholder engagement delivery|Flexible change implementation delivery|Agile problem solving partnership delivery|Collaborative risk assessment and mitigation delivery|Empowered strategic decision delivery|Change leadership performance improvement|Crisis management team engagement|Resilient vision execution planning|Professional development strategy execution|Adaptive team performance improvement feedback|Empathetic stakeholder engagement feedback|Flexible change implementation feedback|Agile problem solving partnership feedback|Collaborative risk assessment and mitigation feedback|Empowered strategic communication feedback|Change leadership performance feedback|Crisis management team growth|Resilient vision execution delivery|Professional development network growth|Adaptive team performance improvement coaching|Empathetic stakeholder engagement coaching|Flexible change implementation coaching|Agile problem solving partnership coaching|Collaborative risk assessment and mitigation coaching|Empowered strategic decision coaching|Change leadership performance coaching|Crisis management team training|Resilient vision execution development|Professional development strategy development|Adaptive team performance improvement support|Empathetic stakeholder engagement support|Flexible change implementation support|... ``` Relaunching ollama solves the problem. I'll test today with version 0.1.26. However, is there a way to stop the stream when using the ollama.chat() function in Python, if the number of chunks returned is too high?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#27151