[GH-ISSUE #3151] Doubt about openai compatibility with temperature parameter #48449

Closed
opened 2026-04-28 08:24:27 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @ejgutierrez74 on GitHub (Mar 14, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/3151

I have one doubt, about the use of temperature.
As i have understood, temperature in llama2 is from 0.0 to 1.0.

But if you use chat.completion from openai ( https://github.com/ollama/ollama/blob/main/docs/openai.md), if you read the documentation temperature values range from 0.0 to 2.0, so seems a little mismatch.

For example if you write temperature 1.0, in llama2 would be the more random parameter, but in case of openai, would be medium ( the max should be 2.0)

So when i use:


chat_completion = client.chat.completions.create(
    messages=[
        {
            'role': 'user',
            'content': 'Say this is a test',
        }
    ],
    model='llama2',
    temperature=1.0
)

What should i expect, medium randomness as openai documentation, or full random as llama2

Thanks in advance

Originally created by @ejgutierrez74 on GitHub (Mar 14, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/3151 I have one doubt, about the use of temperature. As i have understood, temperature in llama2 is from 0.0 to 1.0. But if you use chat.completion from openai ( https://github.com/ollama/ollama/blob/main/docs/openai.md), if you read the documentation temperature values range from 0.0 to 2.0, so seems a little mismatch. For example if you write temperature 1.0, in llama2 would be the more random parameter, but in case of openai, would be medium ( the max should be 2.0) So when i use: ``` chat_completion = client.chat.completions.create( messages=[ { 'role': 'user', 'content': 'Say this is a test', } ], model='llama2', temperature=1.0 ) ``` What should i expect, medium randomness as openai documentation, or full random as llama2 Thanks in advance
Author
Owner

@igorschlum commented on GitHub (Mar 14, 2024):

@ejgutierrez74 I think you have a good point. If you work with ollama using ChatGPT format, temperature should range from 0 to 2 and then Ollama should divide temperature by 2 before processing the prompt.

<!-- gh-comment-id:1998646407 --> @igorschlum commented on GitHub (Mar 14, 2024): @ejgutierrez74 I think you have a good point. If you work with ollama using ChatGPT format, temperature should range from 0 to 2 and then Ollama should divide temperature by 2 before processing the prompt.
Author
Owner

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

1.0 should be median – it's adjusted to a rough equivalent with llama2 and other models. Hope this helps, and let me know if you see anything off 😊

<!-- gh-comment-id:1998754915 --> @jmorganca commented on GitHub (Mar 15, 2024): 1.0 should be median – it's adjusted to a rough equivalent with llama2 and other models. Hope this helps, and let me know if you see anything off 😊
Author
Owner

@ejgutierrez74 commented on GitHub (Mar 15, 2024):

Im following a course of Llama2, seems official as the former is Amit Sangani Senior Director of Eng @Meta. It says that in Llama the value varies from 0 to 1 ( says that 0.9 is a higher value). Thats the doubt....id follow the course and try to get possible inconsistencies between openai official API and Llama2 LLM

Thanks
@jmorganca by the way i reopened the ubuntu bug with ollama
.

<!-- gh-comment-id:2000235667 --> @ejgutierrez74 commented on GitHub (Mar 15, 2024): Im following a course of Llama2, seems official as the former is Amit Sangani Senior Director of Eng [@Meta](https://twitter.com/Meta). It says that in Llama the value varies from 0 to 1 ( says that 0.9 is a higher value). Thats the doubt....id follow the course and try to get possible inconsistencies between openai official API and Llama2 LLM Thanks @jmorganca by the way i reopened the ubuntu bug with ollama .
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#48449