From Zero to AI

Lesson 1.4: AI in the Real World

Duration: 70 minutes

Learning Objectives

By the end of this lesson, you will be able to:

  • Recognize AI applications in everyday products and services
  • Understand how major companies use AI
  • Identify opportunities for AI in different industries
  • Recognize the limitations and challenges of current AI
  • Evaluate when AI is the right solution for a problem

AI Is Already Everywhere

You probably use AI dozens of times a day without realizing it. Let us look at where AI shows up in your daily life.

Your Morning Routine

6:30 AM - Phone alarm (AI optimized wake time based on sleep cycle)
6:35 AM - Check weather (AI-powered forecasting)
6:40 AM - News feed (AI-curated articles)
7:00 AM - Email (spam filtered by AI)
7:15 AM - Maps navigation (AI route optimization)
7:30 AM - Music streaming (AI recommendations)

Throughout Your Day

Activity AI Behind It
Unlocking phone with face Face recognition
Voice assistant Speech recognition + NLU
Social media feed Recommendation algorithm
Online shopping Product recommendations
Video streaming Content suggestions
Email composition Smart compose, grammar check
Photo organization Image classification
Banking app Fraud detection

AI in Major Products

Let us examine how leading companies use AI.

Search Engines (Google, Bing)

AI powers nearly every aspect of search:

// Simplified view of search AI components
type SearchQuery = string;

interface SearchProcess {
  // 1. Understanding the query
  queryUnderstanding: {
    intentClassification: 'informational' | 'navigational' | 'transactional';
    entityExtraction: string[]; // "restaurants", "New York"
    queryExpansion: string[]; // synonyms, related terms
  };

  // 2. Ranking results
  ranking: {
    relevanceScore: number;
    qualityScore: number;
    freshnessScore: number;
    personalizedScore: number;
  };

  // 3. Generating features
  features: {
    featuredSnippet?: string; // AI-generated answer
    relatedQuestions?: string[]; // "People also ask"
    knowledgePanel?: object; // Structured info
  };
}

Modern search includes LLM-powered features:

  • AI Overviews (Google)
  • Copilot answers (Bing)
  • Direct question answering

Social Media (Facebook, Instagram, TikTok)

The feed is 100% AI-driven:

// Content ranking factors
interface ContentScore {
  // Predicted engagement
  likelyToLike: number;
  likelyToComment: number;
  likelyToShare: number;
  likelyToWatch: number; // Video completion

  // Content analysis
  topicRelevance: number;
  visualQuality: number;
  textSentiment: number;

  // Social signals
  friendEngagement: number;
  creatorAuthority: number;

  // Final ranking
  overallScore: number;
}

TikTok's algorithm is particularly sophisticated:

  • Analyzes what you watch, skip, rewatch
  • Factors in watch time, likes, shares, comments
  • Understands video content (objects, text, audio)
  • Personalizes within minutes of using the app

E-commerce (Amazon, Shopify)

AI drives sales at every step:

// AI touchpoints in e-commerce
interface EcommerceAI {
  // Product discovery
  search: {
    queryUnderstanding: true;
    synonymMatching: true;
    visualSearch: true; // Search by image
  };

  // Recommendations
  recommendations: {
    'Customers also bought': true;
    'Frequently bought together': true;
    'Based on your history': true;
    homepagePersonalization: true;
  };

  // Pricing
  dynamicPricing: {
    demandForecasting: true;
    competitorMonitoring: true;
    inventoryOptimization: true;
  };

  // Operations
  operations: {
    fraudDetection: true;
    warehouseOptimization: true;
    deliveryRouting: true;
  };
}

Amazon reportedly generates 35% of revenue from recommendations.

Streaming Services (Netflix, Spotify, YouTube)

Content discovery is AI-powered:

// Netflix recommendation system
interface NetflixRecommendations {
  // Multiple recommendation models
  models: {
    personalizedVideoRanker: true; // What to show you
    trendingNow: true; // Popular content
    continueWatching: true; // Resume suggestions
    becauseYouWatched: true; // Similar content
    topPicks: true; // Daily personalized
  };

  // Even the thumbnails are AI-selected
  thumbnailPersonalization: {
    // Different users see different thumbnails
    // for the same movie based on their preferences
    actorFocused: 'for users who like that actor';
    genreFocused: 'highlighting relevant genre elements';
    moodFocused: "matching user's typical watching mood";
  };
}

Spotify's Discover Weekly uses ML to find songs you will like but have not heard.

Email (Gmail, Outlook)

Multiple AI features protect and assist you:

// Gmail AI features
interface GmailAI {
  security: {
    spamDetection: true; // 99.9% accuracy
    phishingDetection: true; // Malicious links
    malwareScanning: true; // Attachment safety
  };

  productivity: {
    smartCompose: true; // Auto-complete sentences
    smartReply: true; // Quick response suggestions
    nudges: true; // "You haven't replied to..."
    priorityInbox: true; // Important emails first
  };

  organization: {
    categoryTabs: true; // Primary, Social, Promotions
    autoLabeling: true; // Suggested labels
    searchRanking: true; // Find relevant emails
  };
}

AI in Industries

Healthcare

AI is transforming medical care:

// Healthcare AI applications
const healthcareAI = {
  diagnosis: {
    // Image analysis
    xrayAnalysis: 'Detect pneumonia, fractures, tumors',
    skinCancerDetection: 'Analyze moles and lesions',
    retinalScanning: 'Detect diabetic retinopathy',

    // Pattern recognition
    ecgAnalysis: 'Detect heart arrhythmias',
    pathologySlides: 'Identify cancer cells',
  },

  drugDiscovery: {
    moleculeDesign: 'Generate potential drug compounds',
    proteinFolding: 'Predict protein structures (AlphaFold)',
    clinicalTrials: 'Identify suitable patients',
  },

  operations: {
    scheduling: 'Optimize appointment scheduling',
    staffing: 'Predict patient volume',
    documentation: 'Transcribe and summarize notes',
  },
};

Real example: AI can detect diabetic retinopathy from eye scans with higher accuracy than most doctors.

Finance

AI manages trillions of dollars:

// Financial AI applications
const financeAI = {
  trading: {
    algorithmicTrading: 'Execute trades in milliseconds',
    sentimentAnalysis: 'Analyze news for market impact',
    riskAssessment: 'Real-time portfolio risk',
  },

  banking: {
    fraudDetection: 'Flag suspicious transactions instantly',
    creditScoring: 'Assess loan applications',
    chatbots: '24/7 customer service',
    documentProcessing: 'Extract data from forms',
  },

  insurance: {
    claimsProcessing: 'Automate claim evaluation',
    riskPricing: 'Personalized premium calculation',
    damageAssessment: 'Analyze photos of damage',
  },
};

Credit card fraud detection must balance:

  • Catching fraud (false negatives are costly)
  • Not blocking legitimate transactions (false positives annoy customers)

Transportation

Self-driving cars are the most visible, but AI is everywhere:

// Transportation AI
const transportAI = {
  autonomous: {
    perception: 'Identify objects, lanes, signals',
    prediction: "Anticipate other drivers' actions",
    planning: 'Decide when to brake, turn, accelerate',
    mapping: 'Maintain HD maps of roads',
  },

  logistics: {
    routeOptimization: 'Minimize delivery time/cost',
    demandForecasting: 'Predict package volumes',
    warehouseRobotics: 'Automated picking and packing',
  },

  rideshare: {
    dynamicPricing: 'Surge pricing based on demand',
    matching: 'Pair riders with nearby drivers',
    etaEstimation: 'Accurate arrival predictions',
  },

  aviation: {
    predictiveMaintenance: 'Detect issues before failures',
    fuelOptimization: 'Efficient flight paths',
    crewScheduling: 'Complex constraint satisfaction',
  },
};

Retail

Beyond e-commerce, physical retail uses AI:

// Retail AI applications
const retailAI = {
  inStore: {
    inventoryManagement: 'Predict stock needs',
    shelfMonitoring: 'Detect empty shelves via cameras',
    checkoutFree: 'Amazon Go style stores',
    customerTracking: 'Analyze foot traffic patterns',
  },

  marketing: {
    personalization: 'Targeted offers and coupons',
    churnPrediction: 'Identify at-risk customers',
    lifetimeValue: 'Predict customer worth',
    campaignOptimization: 'A/B testing at scale',
  },

  supplyChain: {
    demandForecasting: 'Predict what will sell',
    priceOptimization: 'Dynamic markdown strategies',
    supplierSelection: 'Evaluate vendor performance',
  },
};

LLMs in Production

Large Language Models are being integrated everywhere:

Customer Service

// LLM-powered support
async function handleSupportQuery(
  query: string,
  customerHistory: CustomerHistory
): Promise<SupportResponse> {
  // 1. Classify the issue
  const intent = await classifyIntent(query);

  // 2. Retrieve relevant knowledge
  const articles = await searchKnowledgeBase(query);

  // 3. Generate personalized response
  const response = await llm.complete({
    systemPrompt: 'You are a helpful support agent...',
    context: `Customer history: ${customerHistory}
              Relevant articles: ${articles}`,
    query: query,
  });

  // 4. Check if human handoff needed
  if (needsHuman(response, intent)) {
    return { type: 'escalate', response };
  }

  return { type: 'automated', response };
}

Companies like Klarna report replacing hundreds of support agents with AI.

Code Assistance

GitHub Copilot and similar tools are changing how developers work:

// AI pair programming
interface CodeAssistant {
  features: {
    codeCompletion: 'Suggest next lines of code';
    codeExplanation: 'Explain what code does';
    codeGeneration: 'Write functions from descriptions';
    bugDetection: 'Identify potential issues';
    documentation: 'Generate docstrings and comments';
    testGeneration: 'Create unit tests';
    codeReview: 'Suggest improvements';
  };

  // Adoption statistics (2024)
  adoption: {
    developersUsingAI: '70%+';
    productivityGain: '30-50%';
    codeFromAI: '30-40% in some projects';
  };
}

Content Creation

Marketing teams use LLMs for:

// Content creation workflows
const contentAI = {
  writing: {
    blogPosts: 'Draft articles from outlines',
    socialMedia: 'Generate post variations',
    adCopy: 'Create multiple ad versions',
    emailCampaigns: 'Personalized email content',
  },

  optimization: {
    seoSuggestions: 'Improve search ranking',
    headlineTesting: 'Generate headline variants',
    translation: 'Localize content',
    summarization: 'Create excerpts',
  },

  personalization: {
    productDescriptions: 'Tailored to audience segments',
    emailSubjects: 'Personalized by recipient',
    landingPages: 'Dynamic content based on visitor',
  },
};

Limitations and Challenges

AI is powerful but not perfect. Understanding limitations is crucial.

Hallucinations

LLMs confidently generate false information:

// LLM hallucination example
const query = "Who wrote the book 'The Algorithmic Mind' published in 2019?";

// LLM might respond with:
// "The Algorithmic Mind was written by Dr. Sarah Chen,
//  a professor at MIT, and published by Academic Press in 2019."

// Problem: This book and author might not exist!
// The LLM generated plausible-sounding but false information.

Mitigation strategies:

  • Retrieval-augmented generation (RAG)
  • Fact-checking systems
  • Citation requirements
  • Human review for critical content

Bias

Models learn biases from training data:

// Bias example (simplified)
// If training data shows mostly male CEOs...
const prompt = 'The CEO walked into the meeting. He...';
// Model assumes "he" because of training data patterns

// This affects real applications:
// - Hiring systems favoring certain demographics
// - Loan approvals with racial bias
// - Image generation with stereotypes

Addressing bias requires:

  • Diverse training data
  • Bias testing and auditing
  • Human oversight
  • Continuous monitoring

Context Limitations

LLMs have limited context windows:

// Context window limitations
interface ContextLimits {
  gpt4: '128K tokens (~300 pages)';
  claude3: '200K tokens (~500 pages)';

  // But practical limits are lower:
  practical: {
    costConsideration: 'More tokens = more cost';
    qualityDegradation: 'Very long contexts reduce accuracy';
    latency: 'Longer contexts = slower responses';
  };
}

// You cannot just paste an entire codebase
// and ask "find the bug" - it will not work well

Knowledge Cutoff

Models do not know recent events:

// Knowledge cutoff problem
const model = {
  trainingCutoff: '2023-04', // Example

  // Cannot answer accurately:
  questions: [
    "What happened in yesterday's news?",
    'What is the latest iPhone model?',
    'Who won the recent election?',
  ],
};

// Solution: Provide context or use RAG
const response = await llm.complete({
  context: 'Based on this article from today: [article text]',
  query: 'Summarize the key points',
});

Reasoning Limitations

LLMs struggle with certain tasks:

// Tasks LLMs find difficult
const limitations = {
  math: 'Complex calculations often wrong',
  planning: 'Multi-step planning can fail',
  consistency: 'May contradict themselves',
  counting: 'Struggle with counting characters/words',
  spatial: 'Poor at spatial reasoning',
  currentInfo: 'Cannot access real-time data',
};

// Example: Ask to count letters
// Query: "How many r's in 'strawberry'?"
// LLM might say: "2" (correct is 3)

Privacy and Security

AI systems raise data concerns:

// Privacy considerations
interface AIPrivacyRisks {
  dataExposure: {
    risk: 'Sensitive data in prompts may be logged';
    mitigation: 'Use enterprise APIs with data protection';
  };

  modelMemory: {
    risk: 'Fine-tuned models may memorize data';
    mitigation: 'Careful training data curation';
  };

  promptInjection: {
    risk: 'Malicious inputs can manipulate AI behavior';
    mitigation: 'Input validation, output filtering';
  };
}

When to Use AI

AI is not always the answer. Here is a decision framework:

Good Fit for AI

Characteristic Example
Pattern recognition at scale Spam detection on millions of emails
Personalization Product recommendations
Natural language tasks Translation, summarization
Prediction with historical data Demand forecasting
Content generation Marketing copy
80/20 automation Customer service (handle common cases)

Poor Fit for AI

Characteristic Example
Requires 100% accuracy Medical diagnosis (alone)
Novel situations only One-time decisions
Simple rules suffice Basic form validation
No data available Brand new product category
Explainability required Regulated decisions (loans, hiring)
Real-time factual accuracy Breaking news

The Right Questions

Before implementing AI, ask:

interface AIDecisionChecklist {
  // Problem fit
  'Do we have enough data?': boolean;
  'Is the problem well-defined?': boolean;
  'Can humans do this task?': boolean;

  // Value
  'What is the cost of errors?': 'low' | 'medium' | 'high';
  'What is the current solution cost?': number;
  'What is the potential improvement?': number;

  // Practicality
  'Do we have the expertise?': boolean;
  'Can we measure success?': boolean;
  'Can we handle edge cases with humans?': boolean;
}

Exercises

Exercise 1: Identify the AI

For each product feature, identify what type of AI is likely being used:

  1. Gmail suggesting three short reply options
  2. Netflix showing different thumbnails to different users
  3. Your phone recognizing your face to unlock
  4. Google Maps predicting traffic in 30 minutes
  5. Amazon showing "frequently bought together" products
Solution
  1. Gmail Smart Reply: Text generation (LLM or smaller NLU model) + Classification (categorize email type)

  2. Netflix thumbnails: Image classification + Recommendation system (which image appeals to this user)

  3. Face unlock: Computer vision, specifically face recognition (deep learning)

  4. Traffic prediction: Time series forecasting (regression) using historical and real-time data

  5. Frequently bought together: Association mining / collaborative filtering (recommendation system)

Exercise 2: Evaluate AI Fit

For each scenario, decide if AI is a good solution and explain why:

  1. A small bakery wants to predict how many croissants to make each day
  2. A hospital wants to automatically diagnose rare diseases
  3. A news website wants to generate personalized headlines
  4. A government wants to automatically approve visa applications
  5. A music streaming service wants to create daily playlists for users
Solution
  1. Bakery demand prediction: Maybe

    • Pro: Pattern exists (weekday vs weekend, weather, etc.)
    • Con: Small data set, simple rules might work
    • Verdict: Start with simple rules, consider ML if volume grows
  2. Rare disease diagnosis: Poor fit (alone)

    • Con: Rare = little training data
    • Con: High stakes require human oversight
    • Better: AI assists doctors, flags possibilities
  3. Personalized headlines: Good fit

    • Pro: Lots of data (clicks, reads)
    • Pro: Errors are low-cost
    • Pro: Clear success metric
    • Verdict: Good use case
  4. Visa auto-approval: Poor fit

    • Con: Requires explainability (legal)
    • Con: Bias risks (discrimination)
    • Con: High stakes (people's lives)
    • Better: AI assists human reviewers
  5. Daily playlists: Excellent fit

    • Pro: Massive data (listening history)
    • Pro: Low-cost errors (skip button exists)
    • Pro: Personalization at scale impossible without AI
    • Verdict: Textbook AI use case

Exercise 3: Limitation Awareness

You are building an AI-powered customer support chatbot. For each potential issue, describe how you would mitigate it:

  1. The AI gives incorrect information about your product
  2. The AI cannot handle angry customers appropriately
  3. The AI is asked about topics outside your business
  4. The AI generates responses that sound like competitors
Solution
  1. Incorrect information:

    • Use RAG with your product documentation
    • Limit responses to verified information
    • Add "I'm not sure" fallback for low confidence
    • Human review for complex questions
    • Regular accuracy audits
  2. Angry customers:

    • Train on de-escalation examples
    • Detect negative sentiment and escalate
    • Set clear escalation triggers
    • Never argue or be defensive
    • Human handoff for severe cases
  3. Off-topic questions:

    • Classify intent before responding
    • Politely redirect to supported topics
    • "I can help with [your topics]. For other questions..."
    • Do not attempt answers on unknown topics
  4. Competitor-like responses:

    • Strong system prompt with brand voice
    • Review and filter outputs
    • Include brand guidelines in prompts
    • Regular output auditing
    • Fine-tune on your content if needed

Key Takeaways

  1. AI is everywhere - you use it dozens of times daily
  2. Major products rely heavily on AI (search, social, e-commerce, streaming)
  3. Every industry is being transformed (healthcare, finance, transport, retail)
  4. LLMs are entering production in customer service, coding, content creation
  5. Limitations exist - hallucinations, bias, context limits, knowledge cutoff
  6. AI is not always the answer - evaluate fit carefully
  7. Human oversight remains essential for high-stakes decisions

Resources

Resource Type Description
AI Index Report 2024 Report Stanford's annual AI progress report
State of AI Report Report Annual industry analysis
MIT Technology Review AI Articles Latest AI news and analysis

Module Summary

Congratulations on completing Module 1! You now understand:

  • The difference between AI, ML, deep learning, and LLMs
  • How machine learning models are trained
  • The types of tasks ML can solve
  • Where AI is used in the real world
  • The limitations and challenges of current AI

This foundation will help you as we dive deeper into how LLMs specifically work in the next module.


Next Module

Now that you understand AI fundamentals, let us explore Large Language Models in detail - how they work, what tokens are, and why context windows matter.

Continue to Module 2: How LLMs Work