[GH-ISSUE #4206] Llama3 generating Incorrect and repeated response for my custom modelfile (finetuned llama3 8b) #64657

Closed
opened 2026-05-03 18:27:08 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @balaji-2k1 on GitHub (May 6, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/4206

What is the issue?

Fine-tuned the Llama3 8b model for my custom dataset following the llama3 template, used the unsloth library for fine-tuning, and generated the GGUF file.
Got relevant results when using this model for inference, but when I created the Modelfile and ran it as an Ollama process, the responses were irrelevant and repetitive.

Below is the prompt I used during the inference in the jupyter notebook (It generated the expected response):
prompt = """<|start_header_id|>system<|end_header_id|>You are Dbot, Respond to user questions naturally. <|eot_id|><|start_header_id|>user<|end_header_id|> {}<|eot_id|> <|start_header_id|>Dbot<|end_header_id|> {}<|eot_id|>"""

Below is my Modelfile
`FROM llama3_merged.gguf

TEMPLATE """<|start_header_id|>system<|end_header_id|>You are Dbot,
Respond to user questions naturally. >
<|eot_id|><|start_header_id|>user<|end_header_id|>
{{ .Prompt }}<|eot_id|>
<|start_header_id|>Dbot<|end_header_id|>
{{ .Response }}<|eot_id|>"""

PARAMETER stop "<|start_header_id|>"
PARAMETER stop "<|end_header_id|>"
PARAMETER stop "<|eot_id|>"
PARAMETER stop "<|reserved_special_token"
`
I used below command to run the Modelfile and infer the model which gave me irrelevant responses and did not stop.

`ollama run llama3:v1 "What is EoC"

EoC: Ecosystems and EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems.
The EoC: Ecosystems and EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems.
Ecosystems have a significant impact on the EoC: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems.
The EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems.
Ecosystems have a significant impact on the EoC: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems.
The EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems.
Ecosystems have a significant impact on the EoC: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems.
The EoP: Ecosystems, EoT: Ecosystems, and EoL: Ecosystems.
Ecosystems have a significant impact on the EoC: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems.
The EoT: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoE: Ecosystems.
Ecosystems have a significant impact on the EoC: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems.
The EoE: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems.
Ecosystems have a significant impact on the EoC: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems.
The EoT: Ecosystems, EoE: Ecosystems, and EoL: Ecosystems.
Ecosystems have a significant impact on the EoC: Ecos`

OS

Linux

GPU

Nvidia

CPU

Intel

Ollama version

0.1.32

Originally created by @balaji-2k1 on GitHub (May 6, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4206 ### What is the issue? Fine-tuned the Llama3 8b model for my custom dataset following the llama3 template, used the unsloth library for fine-tuning, and generated the GGUF file. Got relevant results when using this model for inference, but when I created the Modelfile and ran it as an Ollama process, the responses were irrelevant and repetitive. Below is the prompt I used during the inference in the jupyter notebook (It generated the expected response): `prompt = """<|start_header_id|>system<|end_header_id|>You are `Dbot,` Respond to user questions naturally. <|eot_id|><|start_header_id|>user<|end_header_id|> {}<|eot_id|> <|start_header_id|>Dbot<|end_header_id|> {}<|eot_id|>"""` Below is my Modelfile `FROM llama3_merged.gguf TEMPLATE """<|start_header_id|>system<|end_header_id|>You are Dbot, Respond to user questions naturally. > <|eot_id|><|start_header_id|>user<|end_header_id|> {{ .Prompt }}<|eot_id|> <|start_header_id|>Dbot<|end_header_id|> {{ .Response }}<|eot_id|>""" PARAMETER stop "<|start_header_id|>" PARAMETER stop "<|end_header_id|>" PARAMETER stop "<|eot_id|>" PARAMETER stop "<|reserved_special_token" ` I used below command to run the Modelfile and infer the model which gave me irrelevant responses and did not stop. `ollama run llama3:v1 "What is EoC" EoC: Ecosystems and EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems. The EoC: Ecosystems and EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems. Ecosystems have a significant impact on the EoC: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems. The EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems. Ecosystems have a significant impact on the EoC: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems. The EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems. Ecosystems have a significant impact on the EoC: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems. The EoP: Ecosystems, EoT: Ecosystems, and EoL: Ecosystems. Ecosystems have a significant impact on the EoC: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems. The EoT: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoE: Ecosystems. Ecosystems have a significant impact on the EoC: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems. The EoE: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems. Ecosystems have a significant impact on the EoC: Ecosystems, EoL: Ecosystems, EoP: Ecosystems, and EoT: Ecosystems. The EoT: Ecosystems, EoE: Ecosystems, and EoL: Ecosystems. Ecosystems have a significant impact on the EoC: Ecos` ### OS Linux ### GPU Nvidia ### CPU Intel ### Ollama version 0.1.32
GiteaMirror added the bug label 2026-05-03 18:27:08 -05:00
Author
Owner

@jkongWPJK commented on GitHub (Jul 12, 2024):

I'm having the same problem, still couldn't figure out why

<!-- gh-comment-id:2225650619 --> @jkongWPJK commented on GitHub (Jul 12, 2024): I'm having the same problem, still couldn't figure out why
Author
Owner

@qq1273834091 commented on GitHub (Dec 16, 2024):

我有同样的问题,仍然无法弄清楚为什么

<!-- gh-comment-id:2545011510 --> @qq1273834091 commented on GitHub (Dec 16, 2024): 我有同样的问题,仍然无法弄清楚为什么
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#64657