Mastering Generative AI with OpenAI

Getting Started with OpenAI

OpenAI Model Variants

OpenAI’s API provides a rich set of model families and variants, each optimized for specific use cases—from code completion to conversational AI. Choosing the right model can help you balance performance, cost, and accuracy.

Model Families and Variants

A model family groups related variants by their primary function. Each variant carries a version identifier reflecting its training improvements and feature set. Below is a high-level overview:

Model Family (Use Case)VariantOptimized For
Davinci (Natural Language)text-davinci-002Instruction following
text-davinci-003Advanced NLU and generation
Codex (Code Completion)code-davinci-002Code autocomplete and synthesis
GPT-3.5 (Chat & Completion)gpt-3.5-turboLow-latency chat and multi-turn support

GPT-3.5 Variants Overview

The GPT-3.5 series balances capability and cost with varying token limits and data cutoffs:

VariantMax TokensTraining Data ThroughPrimary Use Case
text-davinci-0034,096June 2021Natural language tasks
gpt-3.5-turbo4,096September 2021Chat-style interfaces

The image is a table listing GPT-3.5 model variants, including their descriptions, maximum tokens, and training data. It categorizes models into "Chat" and "Word/Code Completion" types.

Note

gpt-3.5-turbo is optimized for multi-turn dialogues and often delivers lower latency and cost for chat applications.

OpenAI continually refines these variants, improving response quality, speed, and cost-effectiveness.

Fine-Tuning Models

Fine-tuning allows you to customize a base model on your domain-specific dataset. Benefits include:

  • Domain-tailored responses with higher relevance
  • Shorter prompts, reducing token usage and cost
  • Faster inference, since context is baked into the model

The image illustrates the process of model fine-tuning, showing a flow from custom data to a fine-tuned model that generates responses. It highlights benefits like higher quality results, token savings, and lower latency.

Fine-Tuning Workflow

  1. Format your dataset in JSONL with prompt–completion pairs.
  2. Upload data and create a fine-tuning job via the CLI or API.
  3. Monitor training, evaluate performance, and deploy your custom endpoint.

Warning

Ensure your training data is clean, balanced, and representative. Low-quality data can degrade performance.

Embeddings convert text into vector representations for advanced applications:

Use CaseDescription
Semantic SearchRetrieve documents based on contextual meaning
RecommendationSuggest similar content or products
Entity ClassificationCategorize text into predefined classes

OpenAI’s text-embedding-ada-002 model generates high-quality embeddings at scale.

The image illustrates an embedding model process where the text "anatine amigos" is converted into a vector using the "text-embedding-ada-002" model.

Other Model Families

OpenAI’s ecosystem extends beyond GPT and Codex:


Watch Video

Watch video content

Previous
OpenAI Foundation Models