✨

Generative Artificial Intelligence

Generative models in Azure OpenAI and responsible AI concepts in GenAI

⏱️ Estimated reading time: 22 minutes

Generative Models in Azure

Azure OpenAI Service provides access to advanced generative AI models developed by OpenAI.

Available Models:
- GPT (Generative Pre-trained Transformer): Language models for text generation, summarization, and chat
- DALL-E: Models for image generation from textual descriptions
- Codex: Models specialized in code generation and understanding
- Whisper: Models for audio transcription and translation

GPT Series:
- GPT-3.5: Versatile model for chat, writing, and analysis
- GPT-4: More advanced model with better reasoning and multimodal capabilities
- GPT-4 Turbo: Optimized version with higher speed and efficiency

Model Features:
- Scalability: Can handle tasks of different complexities
- Multilingual: Support for multiple languages
- Contextual: Maintains context in long conversations
- Customizable: Fine-tuning for specific use cases

🎯 Key Points

  • βœ“ GPT for text generation and understanding
  • βœ“ DALL-E for image creation from text
  • βœ“ Codex specialized in programming and code
  • βœ“ Scalable and multilingual models
  • βœ“ Ability to maintain conversational context
  • βœ“ Support for custom fine-tuning

Azure OpenAI Service

Azure OpenAI Service is Microsoft's platform for securely accessing and managing OpenAI models.

Azure Studio:
- Web interface for interacting with OpenAI models
- Tools for experimentation and prototyping
- Resource and cost management

Playgrounds:
- Chat Playground: For conversations and chatbots
- Completions Playground: For text generation
- DALL-E Playground: For image generation
- Code Playground: For code work

Basic Parameters:
- Temperature: Controls creativity (0-2, higher = more creative)
- Top P: Controls response diversity (0-1, higher = more diverse)
- Max Tokens: Limits response length
- Stop Sequences: Defines when to stop generation

Security and Compliance:
- Data encryption in transit and at rest
- Compliance with privacy standards
- Content filters for responsible use
- Usage monitoring and logging

🎯 Key Points

  • βœ“ Secure platform for OpenAI models
  • βœ“ Azure Studio for management and experimentation
  • βœ“ Specialized playgrounds by task type
  • βœ“ Adjustable parameters to control behavior
  • βœ“ Focus on security and compliance
  • βœ“ Usage and cost monitoring

Prompt Engineering

Prompt engineering is the art of designing effective instructions to get better responses from generative AI models.

Basic Techniques:
- Be specific: Give clear and detailed instructions
- Provide context: Include relevant background information
- Define format: Specify how the response should be structured
- Use examples: Show examples of desired input and output

Structure of a Good Prompt:
1. Role: Define the role the model should assume
2. Task: Clearly describe what it should do
3. Context: Provide necessary background information
4. Instructions: Give specific guidelines on format and style
5. Examples: Include examples when appropriate

Types of Prompts:
- Closed prompts: For specific and structured responses
- Open prompts: For creative and exploratory generation
- Few-shot prompts: With examples to guide behavior
- Chain-of-thought prompts: For step-by-step reasoning

🎯 Key Points

  • βœ“ Design clear and specific instructions
  • βœ“ Provide relevant context
  • βœ“ Define desired response format
  • βœ“ Use examples to guide behavior
  • βœ“ Consider the role the model should assume
  • βœ“ Experiment with different techniques

Copilots

Copilots are AI assistants integrated into Microsoft applications that help users be more productive.

Copilot Concept:
- Intelligent assistants that work alongside the user
- Integrated into familiar applications like Word, Excel, Teams
- Use generative AI to help with complex tasks
- Learn from user's context and behavior

Examples of Microsoft Copilots:
- GitHub Copilot: Programming assistant in VS Code
- Microsoft Copilot: General assistant in Windows and Edge
- Copilot in Office: Help in Word, Excel, PowerPoint
- Copilot in Teams: Improves meetings and collaboration

Features:
- Contextual: Understands the context of the current task
- Proactive: Suggests actions before they are requested
- Customizable: Adapts to user preferences
- Secure: Respects data privacy and security

Benefits:
- Increases productivity by automating repetitive tasks
- Reduces learning curve of complex tools
- Provides real-time expert assistance
- Improves creativity and problem-solving

🎯 Key Points

  • βœ“ AI assistants integrated into applications
  • βœ“ Work alongside users to increase productivity
  • βœ“ Contextual and adaptable to behavior
  • βœ“ Examples: GitHub Copilot, Copilot in Office
  • βœ“ Respect data privacy and security
  • βœ“ Automate tasks and provide expert assistance

Responsible AI in GenAI

Generative AI poses unique responsibility challenges that require specific security and ethical measures.

Content Filters:
- Jailbreak prevention: Blocks attempts to manipulate the model
- Content moderation: Filters harmful or inappropriate content
- Factual verification: Reduces hallucinations and incorrect information

Specific GenAI Challenges:
- Hallucinations: Generation of false but convincing information
- Amplified biases: Biases in training data propagate
- Disinformation: Ability to generate deceptive content at scale
- Deepfake abuse: Creation of realistic fake content

Mitigation Measures:
- Responsible fine-tuning: Additional training to reduce biases
- Continuous monitoring: Real-time detection of misuse
- Transparency: Documentation of limitations and capabilities
- Access controls: Restriction of use for high-risk cases
- User education: Awareness of AI limitations

Microsoft Framework:
- Six AI Principles: Applied specifically to generative models
- Content Safety: Automatic filters and human moderation
- Fairness in AI: Regular bias audits
- Accountability: Usage tracking and clear responsibility

🎯 Key Points

  • βœ“ Content filters prevent abuse and harmful content
  • βœ“ Hallucinations are a specific risk of GenAI
  • βœ“ Biases in training data are amplified
  • βœ“ Continuous monitoring and access controls needed
  • βœ“ Transparency about model limitations
  • βœ“ Application of the 6 responsible AI principles

Azure OpenAI on Your Data

One of the most important capabilities in the exam is the ability to connect language models (like GPT-4) to your own enterprise data without needing to retrain the model.

Concept (RAG - Retrieval Augmented Generation):
1. Ingestion: Azure indexes your documents (PDFs, Word, HTML) using Azure AI Search.
2. Retrieval: When a user asks a question, the system searches for relevant information in your documents.
3. Generation: Sends that information to the GPT model as 'context' to generate an answer based *only* on your data.

Benefits:
- Accurate answers: Prevents the model from making up information (hallucinations).
- Up-to-date data: Does not depend on the model's training cut-off date.
- Security: Private data is not used to train the base public model.
- Citations: The model can cite which document it used to answer.

🎯 Key Points

  • βœ“ Connects GPT to private enterprise data
  • βœ“ Uses Azure AI Search to index documents
  • βœ“ Prevents hallucinations by providing real context
  • βœ“ Does not require model retraining (Fine-tuning)
  • βœ“ Provides citations and references to sources

Technical Concepts: Tokens and Embeddings

To understand how these models work and are billed, it is necessary to know two fundamental units.

Tokens (The unit of text):
- Models do not read whole words, they read 'tokens' (character fragments).
- Rule of thumb: 1,000 tokens β‰ˆ 750 words.
- Importance: Azure OpenAI bills for every 1,000 tokens processed (input + output). There are also token limits per request (Context Window).

Embeddings (The unit of meaning):
- A special data representation format that converts text into numerical vectors (lists of numbers).
- Usage: Allows computers to understand the semantic relationship between words.
- Example: In a vector space, the word 'Queen' will be mathematically close to 'King' and 'Woman'. Used for intelligent searches.

🎯 Key Points

  • βœ“ Tokens are the unit for billing and limits
  • βœ“ 1,000 tokens are approx. 750 words
  • βœ“ Embeddings convert text into numbers (vectors)
  • βœ“ Embeddings capture semantic meaning
  • βœ“ Essential for understanding costs and search