Unlocking the Future: Azure OpenAI Services

Introduction

Azure OpenAI Service offers REST API access to OpenAI's advanced language models, including GPT-4, GPT-35-Turbo, and the Embeddings model series. These models are meant for specific purposes and assist in various ways to,

  • Summarize text
  • Semantic search
  • Natural Language Understanding
  • Code translation

Users can access these services either as REST APIs or through SDKs available for Python, NodeJS, or a web-based interface accessible within the Azure OpenAI Studio platform.

Azure OpenAI Service Models

Some of the models are.

  1. GPT-3 (Generative Pre-trained Transformer 3): GPT-3 is a widely known language model capable of various natural language processing tasks, including text generation, translation, summarization, and more. GPT-3.5-Turbo is optimized for efficient and high-quality text generation tasks.
  2. GPT-4: An advanced version of GPT-3, offering improved performance and capabilities for natural language understanding and generation tasks.
  3. Embedding Models: These models are focused on generating high-quality textual embeddings or representations of text data. They are useful for tasks like similarity analysis and recommendation systems.
  4. Codex Models: The models used for synthesizing code with the given set of inputs. The inputs are accepted from the natural language and translated into the native code. Currently, code can be generated for Python, JavaScript, TypeScript, Ruby, Go, C#, and C++.
  5. Dall-e Models: Right now, the models are in preview mode, which is used for generating images from the natural language input.

Models are classified majorly into.

  • Chat & Completion
    • gpt-4-32k 
    • gpt-35-turbo-16k
  • Embeddings  
    • text-embedding-ada-002
  • Text generation
    • text-ada-001 (Legacy)
    • text-babbage-001 (Legacy)
    • text-curie-001 (Legacy)
    • text-davinci-001 (Legacy)
  • Code generation

    • code-davinci-002
    • code-cushman-001 (Legacy)
  • Image generation
    • dalle

Nomenclature of model names

Azure OpenAI model names typically correspond to the following naming conventions.

{capability}-{family}-{inputy-type}-{identifier/version}

{text}-{embedding}-{ada}-{002}

Difference between Azure OpenAI and OpenAI

  1. Azure OpenAI Service is offered only to businesses with advanced models with the security and enterprise-grade Azure Services
  2. Azure OpenAI jointly develops the APIs and builds models with OpenAI and hosts the models in the Azure cloud, so the transition will be seamless.
  3. Azure OpenAI also ensures Azure customers with private networking, regional availability, and responsible AI content filtering.

Key Terminologies


Prompts

The prompt is essentially a predefined instruction or question given to the model to elicit a specific type of response. It can be a text string or a series of text that sets the context or provides guidance for the model.

Example. "Write a short story about a detective solving a mysterious murder case in a small town."

Along with the context we set, the model has to write a story as defined in the prompt above.

Completion

Completion refers to the output or response generated by the model when given a prompt or input. With a given prompt to the model, it processes the input and generates a text completion that follows the context or instruction provided in the prompt.

Example. Complete the following sentence: 'The sun is shining, the birds are singing, and the flowers are blooming...'

The model would generate a completion to finish the sentence based on the context provided in the prompt. The completion might be something like:

Example. The sun is shining, the birds are singing, and the flowers are blooming in the vibrant garden.

In this case, the generated text, "in the vibrant garden," completes the sentence and is referred to as the "completion."

Tokens

A token is a fundamental unit of text that the model reads and processes. Tokens can be as short as one character or as long as one word in English, but they can vary in length in other languages. Tokens serve several important purposes:

  • Text Segmentation: The model segments the input text into tokens to process it effectively. For example, the sentence "ChatGPT is great!" would be split into six tokens: ["Chat", "G", "PT", " is", " great", "!"].
  • Counting Usage: Tokens are used to count the number of words or characters in a text. Most language models, including GPT-3 and GPT-4, have a maximum token limit for each input. Charges are based on the number of tokens used.
  • Limitations: The total number of tokens in an input affects how much text input can be sent to the model. If the input surpasses the model's token limit, then they may need to truncate, omit, or otherwise adjust the text to fit within the limit.
  • Response Length: Tokens also apply to the model's generated responses. The length of the response in tokens affects the cost and response time when using Azure OpenAI's API.

Prompt Engineering

Prompt engineering refers to the process of carefully crafting and optimizing prompts or inputs given to a language model to achieve desired outputs or responses. It involves tailoring the instructions, format, and content of the prompt to guide the model in producing accurate, relevant, and high-quality responses. Prompt engineering is especially crucial when working with AI models for various natural language processing tasks. Key aspects of prompt engineering include:

  • Iterative Testing: Experimenting with different prompts and iteratively refining them to achieve the desired results. This may involve trial and error to find the most effective prompt for a given task.
  • Bias and Fairness Considerations: Being mindful of potential bias in prompts and avoiding instructions that may lead to biased or objectionable responses.
  • Task Customization: Adapting prompts to the specific task or application, whether it's text generation, translation, summarization, or any other NLP task.

While constructing a prompt, keep this formula in mind.

Context + Specificity + Intent + Format
  • Context: Providing relevant context in the prompt can improve the model's understanding of the task or query. This might include background information, examples, or relevant details.
  • Specificity: Crafting clear and specific prompts that provide the model with precise instructions or context is essential. Vague or ambiguous prompts may result in inaccurate or unhelpful responses.
  • Intent: Getting the response in a very precise manner. It gives a clear goal of the task to be achieved. Count all the numbers in order, and predict the future with the history of information.
  • Format: Optimizing the length and format of the prompt to fit within the model's token limits and to convey information effectively. Longer prompts may require careful token management.

LLM

A large language model, abbreviated as LLM, is a category of machine learning model with the capability to undertake a range of natural language processing (NLP) activities. These activities comprise of tasks such as text generation and categorization, engaging in natural conversational question-answering, and availing language translation from one language to another.

Responsible AI

Responsible AI, also known as Ethical AI or AI Ethics, refers to the practice of designing, developing, and deploying artificial intelligence systems in a way that aligns with ethical and moral principles, respects human rights, and minimizes potential negative impacts on society. Responsible AI is a framework and set of guidelines aimed at ensuring that AI technologies are used in a manner that ensures the following aspects for the benefit of all the stakeholders.

  • Fairness
  • Reliability and Safety
  • Privacy and Security
  • Inclusiveness
  • Accountability
  • Transparency

Availability

As part of Microsoft’s commitment to responsible AI, Azure OpenAI is not readily available to all businesses, it is limited, and businesses must submit a form to Microsoft for initial experimentation and approval for moving to production. Additionally, registration is required if the business wants to modify content filters or modify abuse monitoring settings.