[GH-ISSUE #3110] LLaMA2/Mistral generation extremely slow and errorenous #1912

Closed
opened 2026-04-12 12:02:00 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @RoManInv on GitHub (Mar 13, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/3110

Originally assigned to: @jmorganca on GitHub.

Hi all,
I just experienced a situation where LLaMA2 and Mistral generate a completion very slowly (sometimes even no response after around 1h) and seem not to be correct. I would like to ask if there is anything wrong when I use the kwarg "format": "json" in the request body, or if it is my prompt that caused that issue.

  • Server spec
    • CPU: enterprise-level 256 core
    • GPU: multiple Nvidia A-100 GPUs
    • System: Debian Bullseye
    • Access: admin, full access to all the computational resources
    • Others: ollama was the only process running on that server. Ollama is installed on the host machine, not VM or Docker. There is no VM/Docker or anything that restricts the computational resource for any user.

Here is the test case I'm using:

  • Preparation:

    • sudo service ollama start --> success
    • ollama pull llama2 --> success
    • ollama pull mistral --> success
  • LLaMA2 test call:

curl http://localhost:11434/api/generate -d '{
  "model": "llama2",
  "prompt":"Complete the following pattern. Q: China A: China, Beijing Q: Berlin A: Germany, Berlin Q: Italy A:",
  "stream": false,
  "format": "json",
  "options": {
    "seed": 101,
    "temperature": 0.2
  }
}'
  • Response:
{"model":"llama2","created_at":"2024-03-13T14:55:18.825061607Z","response":"{ }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","done":true,"context":[518,25580,29962,3532,14816,29903,29958,5299,829,14816,29903,6778,13,13,17813,278,1494,4766,29889,660,29901,7551,319,29901,7551,29892,1522,823,292,660,29901,5115,319,29901,9556,29892,5115,660,29901,12730,319,29901,518,29914,25580,29962,13,29912,500,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13],"total_duration":16179381781,"load_duration":610419,"prompt_eval_duration":20061000,"eval_count":1001,"eval_duration":16157638000}%

However, if I remove the format keyword, it is a little bit faster with some response seems to be reasonable.

  • LLaMA test call removing "format": "json" in the request body:
curl http://localhost:11434/api/generate -d '{
  "model": "llama2",
  "prompt":"Complete the following pattern. Q: China A: China, Beijing Q: Berlin A: Germany, Berlin Q: Italy A:",
  "stream": false,

  "options": {
    "seed": 101,
    "temperature": 0.2
  }
}'
  • Response of the above request:
{"model":"llama2","created_at":"2024-03-13T15:01:10.874304486Z","response":"\nSure! Here's the completed pattern:\n\nQ: China A: China, Beijing\nQ: Berlin A: Germany, Berlin\nQ: Italy A: Rome","done":true,"context":[518,25580,29962,3532,14816,29903,29958,5299,829,14816,29903,6778,13,13,17813,278,1494,4766,29889,660,29901,7551,319,29901,7551,29892,1522,823,292,660,29901,5115,319,29901,9556,29892,5115,660,29901,12730,319,29901,518,29914,25580,29962,13,13,29903,545,29991,2266,29915,29879,278,8676,4766,29901,13,13,29984,29901,7551,319,29901,7551,29892,1522,823,292,13,29984,29901,5115,319,29901,9556,29892,5115,13,29984,29901,12730,319,29901,9184],"total_duration":1596398280,"load_duration":1102959851,"prompt_eval_count":48,"prompt_eval_duration":122206000,"eval_count":40,"eval_duration":370584000}%  

For Mistral, the situation is worse. It won't give response in around 1 hour.

  • Mistral test call:
curl http://localhost:11434/api/generate -d '{
  "model": "mistral",
  "prompt":"Complete the following pattern. Q: China A: China, Beijing Q: Berlin A: Germany, Berlin Q: Italy A:",
  "stream": false,
  "format": "json",
  "options": {
    "seed": 101,
    "temperature": 0.2
  }
}'
  • Response: No response after around an hour, call aborted by sending Ctrl-C command. During waiting, htop says ollama was running and actually taking computational resources.

  • Mistral test call removing "format": "json" in the request body:

curl http://localhost:11434/api/generate -d '{
  "model": "mistral",
  "prompt":"Complete the following pattern. Q: China A: China, Beijing Q: Berlin A: Germany, Berlin Q: Italy A:",
  "stream": false,

  "options": {
    "seed": 101,
    "temperature": 0.2
  }
}'
  • Response (seems reasonable):
{"model":"mistral","created_at":"2024-03-13T15:12:29.747354811Z","response":" Italy, Rome\n\nThe pattern is to list the country name first, followed by a specific city that is well-known in that country. In this case, for Italy, the city \"Rome\" was given as an example.","done":true,"context":[733,16289,28793,28705,21929,272,2296,5340,28723,1186,28747,5077,330,28747,5077,28725,27112,1186,28747,8430,330,28747,7293,28725,8430,1186,28747,10828,330,28747,733,28748,16289,28793,10828,28725,10827,13,13,1014,5340,349,298,1274,272,2939,1141,907,28725,4961,486,264,2948,2990,369,349,1162,28733,4717,297,369,2939,28723,560,456,1222,28725,354,10828,28725,272,2990,345,28754,525,28739,403,2078,390,396,2757,28723],"total_duration":1943432265,"load_duration":1335220122,"prompt_eval_count":35,"prompt_eval_duration":134002000,"eval_count":49,"eval_duration":473637000}% 

Additionally, the examples provided in the API documentation worked fine with and without "format": "json". A response is given in a very short time.

Originally created by @RoManInv on GitHub (Mar 13, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/3110 Originally assigned to: @jmorganca on GitHub. Hi all, I just experienced a situation where LLaMA2 and Mistral generate a completion very slowly (sometimes even no response after around 1h) and seem not to be correct. I would like to ask if there is anything wrong when I use the kwarg "format": "json" in the request body, or if it is my prompt that caused that issue. * Server spec - CPU: enterprise-level 256 core - GPU: multiple Nvidia A-100 GPUs - System: Debian Bullseye - Access: admin, full access to all the computational resources - Others: ollama was the only process running on that server. Ollama is installed on the host machine, not VM or Docker. There is no VM/Docker or anything that restricts the computational resource for any user. Here is the test case I'm using: * Preparation: - sudo service ollama start --> success - ollama pull llama2 --> success - ollama pull mistral --> success * LLaMA2 test call: ``` curl http://localhost:11434/api/generate -d '{ "model": "llama2", "prompt":"Complete the following pattern. Q: China A: China, Beijing Q: Berlin A: Germany, Berlin Q: Italy A:", "stream": false, "format": "json", "options": { "seed": 101, "temperature": 0.2 } }' ``` * Response: ``` {"model":"llama2","created_at":"2024-03-13T14:55:18.825061607Z","response":"{ }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","done":true,"context":[518,25580,29962,3532,14816,29903,29958,5299,829,14816,29903,6778,13,13,17813,278,1494,4766,29889,660,29901,7551,319,29901,7551,29892,1522,823,292,660,29901,5115,319,29901,9556,29892,5115,660,29901,12730,319,29901,518,29914,25580,29962,13,29912,500,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13],"total_duration":16179381781,"load_duration":610419,"prompt_eval_duration":20061000,"eval_count":1001,"eval_duration":16157638000}% ``` However, if I remove the format keyword, it is a little bit faster with some response seems to be reasonable. * LLaMA test call removing "format": "json" in the request body: ``` curl http://localhost:11434/api/generate -d '{ "model": "llama2", "prompt":"Complete the following pattern. Q: China A: China, Beijing Q: Berlin A: Germany, Berlin Q: Italy A:", "stream": false, "options": { "seed": 101, "temperature": 0.2 } }' ``` * Response of the above request: ``` {"model":"llama2","created_at":"2024-03-13T15:01:10.874304486Z","response":"\nSure! Here's the completed pattern:\n\nQ: China A: China, Beijing\nQ: Berlin A: Germany, Berlin\nQ: Italy A: Rome","done":true,"context":[518,25580,29962,3532,14816,29903,29958,5299,829,14816,29903,6778,13,13,17813,278,1494,4766,29889,660,29901,7551,319,29901,7551,29892,1522,823,292,660,29901,5115,319,29901,9556,29892,5115,660,29901,12730,319,29901,518,29914,25580,29962,13,13,29903,545,29991,2266,29915,29879,278,8676,4766,29901,13,13,29984,29901,7551,319,29901,7551,29892,1522,823,292,13,29984,29901,5115,319,29901,9556,29892,5115,13,29984,29901,12730,319,29901,9184],"total_duration":1596398280,"load_duration":1102959851,"prompt_eval_count":48,"prompt_eval_duration":122206000,"eval_count":40,"eval_duration":370584000}% ``` For Mistral, the situation is worse. It won't give response in around 1 hour. * Mistral test call: ``` curl http://localhost:11434/api/generate -d '{ "model": "mistral", "prompt":"Complete the following pattern. Q: China A: China, Beijing Q: Berlin A: Germany, Berlin Q: Italy A:", "stream": false, "format": "json", "options": { "seed": 101, "temperature": 0.2 } }' ``` * Response: No response after around an hour, call aborted by sending Ctrl-C command. During waiting, htop says ollama was running and actually taking computational resources. * Mistral test call removing "format": "json" in the request body: ``` curl http://localhost:11434/api/generate -d '{ "model": "mistral", "prompt":"Complete the following pattern. Q: China A: China, Beijing Q: Berlin A: Germany, Berlin Q: Italy A:", "stream": false, "options": { "seed": 101, "temperature": 0.2 } }' ``` * Response (seems reasonable): ``` {"model":"mistral","created_at":"2024-03-13T15:12:29.747354811Z","response":" Italy, Rome\n\nThe pattern is to list the country name first, followed by a specific city that is well-known in that country. In this case, for Italy, the city \"Rome\" was given as an example.","done":true,"context":[733,16289,28793,28705,21929,272,2296,5340,28723,1186,28747,5077,330,28747,5077,28725,27112,1186,28747,8430,330,28747,7293,28725,8430,1186,28747,10828,330,28747,733,28748,16289,28793,10828,28725,10827,13,13,1014,5340,349,298,1274,272,2939,1141,907,28725,4961,486,264,2948,2990,369,349,1162,28733,4717,297,369,2939,28723,560,456,1222,28725,354,10828,28725,272,2990,345,28754,525,28739,403,2078,390,396,2757,28723],"total_duration":1943432265,"load_duration":1335220122,"prompt_eval_count":35,"prompt_eval_duration":134002000,"eval_count":49,"eval_duration":473637000}% ``` Additionally, the examples provided in the API documentation worked fine with and without "format": "json". A response is given in a very short time.
GiteaMirror added the bugperformance labels 2026-04-12 12:02:00 -05:00
Author
Owner

@jmorganca commented on GitHub (Nov 15, 2024):

This should perform much better with newer models (i.e. llama3.1 or llama3.2). Keep in mind when using JSON mode to specify in the prompt that the reply should be JSON

<!-- gh-comment-id:2479475135 --> @jmorganca commented on GitHub (Nov 15, 2024): This should perform much better with newer models (i.e. `llama3.1` or `llama3.2`). Keep in mind when using JSON mode to specify in the prompt that the reply should be JSON
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1912