OpenAI GPT models

OpenAI offers an array of models that showcase varied capabilities and cost considerations. These models span from GPT-4, GPT-3.5, to GPT-3 Legacy, with each having unique attributes and enhancements.

GPT-4

Positioned as the most recent and technologically advanced model in the GPT series, GPT-4 is a large multimodal model equipped to tackle challenging tasks more accurately than any prior OpenAI models. This is attributable to its expansive general knowledge and advanced logical abilities. GPT-4 is primarily optimized for chat, but it is equally competent for traditional completions tasks via the Chat Completions API.

GPT-4 offers different versions, including gpt-4, gpt-4-0613, gpt-4-32k, and gpt-4-32k-0613, each version featuring unique attributes and capabilities. To illustrate, gpt-4-32k maintains similar capabilities to the base gpt-4 model but offers a 4 times longer context length.

Model

Description

Max Tokens

GPT-4

More capable than any GPT-3.5 model, able to do more complex tasks, and optimized for chat.

8,192

gpt-4-0613

Snapshot of gpt-4 from June 13th 2023 with function calling data.

8,192

gpt-4-32k

Same capabilities as the base gpt-4 mode but with 4x the context length.

32,768

gpt-4-32k-0613

Snapshot of gpt-4-32 from June 13th 2023.

32,768

GPT-3.5

GPT-3.5 models are capable of understanding and generating either natural language or code. The most effective and cost-efficient model in the GPT-3.5 suite is gpt-3.5-turbo. This model is primarily optimized for chat but performs well in traditional completions tasks too.

Model

Description

Max Tokens

gpt-3.5-turbo

Most capable GPT-3.5 model and optimized for chat at 1/10th the cost of text-davinci-003.

4,096

gpt-3.5-turbo-16k

Same capabilities as the standard gpt-3.5-turbo model but with 4 times the context.

16,384

gpt-3.5-turbo-0613

Snapshot of gpt-3.5-turbo from June 13th 2023 with function calling data.

4,096

gpt-3.5-turbo-16k-0613

Snapshot of gpt-3.5-turbo-16k from June 13th 2023.

16,384

Note: Differences between model gpt-3.5-turbo and gpt-3.5-turbo-0301

GPT-3 Legacy

GPT-3 Legacy models are proficient in understanding and generating natural language. These models were succeeded by the more potent GPT-3.5 generation models. However, the original GPT-3 base models, namely davinci, curie, ada, and babbage, are the only models currently available for fine-tuning.

Model

Description

Max Tokens

text-curie-001

Very capable, faster and lower cost than Davinci.

2,049

text-babbage-001

Capable of straightforward tasks, very fast, and lower cost.

2,049

text-ada-001

Capable of very simple tasks, usually the fastest model in the GPT-3 series, and lowest cost.

2,049

davinci

Most capable GPT-3 model. Can do any task the other models can do, often with higher quality.

2,049

curie

Very capable, but faster and lower cost than Davinci.

2,049

babbage

Capable of straightforward tasks, very fast, and lower cost.

2,049

ada

Capable of very simple tasks, usually the fastest model in the GPT-3 series, and lowest cost.

2,049

Use the API

Let’s see how we can use these models in a Python script using the OpenAI API.

import openai
openai.api_key = "{{SECRET_KEY}}"
response = openai.Completion.create(
engine="{{Model}}", # You can change this above to "gpt-3.5-turbo" or any other model
prompt="Translate the following English text to French: '{}'",
max_tokens=60
)
print(response.choices[0].text.strip())

Within this code snippet, you have the option to modify the engine parameter to the model of your choice. For instance, gpt-4 can be replaced with gpt-3.5-turbo if you wish to leverage the GPT-3.5 Turbo model.

Copyright ©2024 Educative, Inc. All rights reserved