Skip to main content
In this lesson we review what generative AI and large language models (LLMs) can do, where they fall short, and what to consider when deploying them in production systems. We focus on practical trade-offs, operational best practices, and concrete mitigations for common failure modes. Generative AI and LLMs are general-purpose technologies that can be adapted to specific domains. Because many models are pre-trained, they enable cost‑effective, adaptable solutions across industries without requiring a full custom ML pipeline.
A slide titled "Why Generative AI and LLMs Matter" showing a central AI chip with circuit traces connecting to icons labeled Finance, Healthcare, Education, and Retail. A caption underneath notes that generative AI and LLMs are transforming industries with cost-effective, adaptable solutions.
Why organizations adopt generative models
  • Lower development effort and costs compared with building task-specific ML from scratch.
  • Transfer learning from large pre-trained models accelerates domain adaptation.
  • Flexible tooling: prompt engineering, fine-tuning, and retrieval methods let teams tailor behavior without a complete model rebuild.
Common practical applications include content generation, customer-service automation, summarization, and data analysis — all of which can act as force multipliers for productivity and innovation.
A presentation slide titled "Why Generative AI and LLMs Matter" showing three hexagon icons along a dotted line labeled "Content Generation," "Customer Service," and "Data Analysis."
Real-world examples where ML already augments systems
  • Search ranking, fraud detection, and personalized recommendations are common production examples of ML tailoring user experience.
  • E-commerce product recommendations, automated ticket triage, and content summarization reduce manual effort and time-to-insight.
A presentation slide titled "Generative AI in Daily Life" showing three example uses—Web Searches, Credit Card Fraud Detection, and Personalized Product Recommendations—each inside a rounded box with a simple icon.
Callouts — tips for early projects
Start small: focus on one clear user problem, measure business value (e.g., time saved, conversion uplift), and instrument metrics before expanding the scope of AI integration.
However, generative AI introduces important limitations and risks that you must address before deploying in production.
A slide titled "Generative AI — Challenges" showing four colored icons and short headings: Limited Task Performance, Ethical Considerations, Risks in Sensitive Areas, and Organizational Commitment. Each icon is paired with a brief note about handling complex tasks, responsible use, caution in healthcare/finance, and prioritizing ethics.
Key limitations and operational considerations
  • Task scope: LLMs excel at language reasoning and pattern completion but lack inherent domain expertise or human intuition. Domain-specific training data, rules, or guardrails are required for high-stakes fields (healthcare, legal, finance).
  • Ethics and values: Models do not automatically share societal values. Responsible behavior must be introduced through data selection, system prompts, policy layers, and human oversight.
  • Privacy and safety: Models can memorize portions of training data and may reveal sensitive content unless you implement data filtering, redaction, or policy control mechanisms.
Prompting and fine-tuning
  • Prompts should be explicit, contextual, and include clear instructions and examples for the task.
  • For binary classification tasks (e.g., “Is this email a complaint?”), off-the-shelf LLMs may fail on subtle signals unless you provide examples, few-shot prompts, or fine-tune the model.
  • Fine-tuning (including supervised fine-tuning and techniques like reinforcement learning from human feedback) helps teach task-specific distinctions and reduces unwanted behaviors.
Use supervised fine-tuning or RLHF when you need consistent, high-stakes behavior. Combine fine-tuning with testing on adversarial examples to ensure robustness.
A slide titled "LLMs and Memory Limitations" showing a chat interface labeled "Initial Conversation" where a user asks "Is this email a complaint?" and a bot replies "Yes, this is a complaint."
Memory and context
  • Context window: LLMs can reason only over tokens in the current input. They do not retain long-term memory across unrelated requests unless you implement persistence.
  • Persistence strategies: retrieval-augmented generation (RAG), database-backed conversation histories, or explicit memory stores let you persist and retrieve relevant context across sessions. See this RAG primer for more details: https://learn.kodekloud.com/user/courses/fundamentals-of-rag.
A presentation slide titled "LLMs and Memory Limitations" showing a chat interface labeled "Later in the Conversation" where a user asks, "Is this email related to delayed shipping?" and the chatbot replies that it doesn't have that information and asks for clarification.
If your product relies on previous interactions, explicitly persist and retrieve context (e.g., user profile, prior conversation snippets, or document embeddings). Otherwise, users will experience inconsistent behavior. Common failure modes and practical mitigations
  • Hallucinations: models can generate plausible but incorrect or fabricated content. Frequency varies by model and task.
  • Toxic or unsafe outputs: without filtering and alignment, models may produce offensive or harmful responses.
  • Inaccurate or misleading advice: dangerous in high-stakes domains.
Mitigations:
  • Human-in-the-loop review for critical outputs.
  • Content filtering and safety layers to block unsafe content.
  • Use retrieval to ground responses in verified sources (RAG).
  • Confidence scoring and fallback flows to escalation when the model is uncertain.
  • Domain-specific fine-tuning and post-processing to correct repeated errors.
A slide titled "LLMs – Common Issues" showing a three-part timeline across Undesirable Outputs, Consequences, and Solutions. It lists examples like toxic language and hallucinations, resulting in misleading or inaccurate outputs, with fixes such as safeguards and ensuring ethical content.
Warning: production readiness
Do not deploy generative models into production without safety tests, access controls, and monitoring. For regulated or high-risk use cases, require human review and clear escalation procedures.
Evaluating LLM performance
  • Use task-appropriate automated metrics alongside human evaluation.
  • Common metrics:
    • Summarization: ROUGE measures overlap between generated and reference summaries.
    • Translation: BLEU compares n-gram overlap between candidate and reference translations.
  • Automated metrics are useful for rapid iteration but are imperfect; human judgment is often required for final quality assessment.
Table — Evaluation metrics at a glance Illustrative example:
  • Reference: “Cat’s on the mat.”
  • Candidate: “Cat is sitting on the mat.” — may score well on ROUGE for summarization though wording differs.
Choosing the right generative model
  • Match model families to tasks and data availability. Consider architecture, compute costs, and the quality required by the application.
Table — Model families and primary use cases
An infographic titled "Evaluating LLM Performance" comparing ROUGE (summarization) and BLEU (translation) metrics. Each panel shows example generated vs. reference sentences about a cat on a mat and example scores (80% ROUGE, 75% BLEU).
Fine-tuning and human feedback
  • Incorporate human labeling and preference data (for example, RLHF) to align the model to desired behaviors: helpfulness, honesty, and safety.
  • Best practice: start from a strong foundation model, fine-tune for the specific domain and user expectations, and validate with both automated and human tests.
An infographic pyramid titled "Foundation Models — A Starting Point." It shows GPT-4 at the base, a middle layer for fine-tuning/customization, and a top layer representing a customer support chatbot and specialized applications.
Business metrics and KPIs
  • Instrument metrics that measure business value and model quality:
    • Task accuracy, conversion uplift, cost per query, and user satisfaction.
    • Relevance, coherence, and factual accuracy for content outputs.
  • Use A/B testing and continuous monitoring to detect drift or regressions and trigger retraining or policy updates.
A dark-slide titled "Tracking Business Metrics With AI" showing section 02: "Purpose of Metrics." It lists two points with icons: "Assess AI Value" and "Insights for Optimization."
Predefined quality checks and continuous evaluation help protect ROI and ensure alignment with business goals.
A presentation slide titled "Ensuring Output Quality" showing a computer monitor with an "AI" chip under a magnifying glass and a checklist on the right marking Relevance, Coherence, and Accuracy. The footer notes predefined quality standards help businesses monitor AI performance.
Operational use cases and scaling
  • Ensure outputs are relevant and meet user needs by defining success criteria and automated monitoring (alerts for low confidence, unusual outputs, or KPI drops).
  • Orchestration: foundation models can be combined across agents and platforms to automate workflows (e.g., multi-channel support, personalized content pipelines).
  • Scaling considerations include prompt design, context management, monitoring, governance, and cost optimization — not just infrastructure.
A slide titled "Ensuring Output Quality" showing two dark panels labeled 01 and 02: "AI-powered customer support" with a book/play icon, and "Content generation systems" with a headset icon.
A slide titled "Scaling AI With Foundation Models" showing two use cases: "Automate customer service across platforms" with a megaphone-in-gear icon, and "Provide content recommendations for user segments" with a user/profile web-page icon separated by a vertical divider.
Summary — practical checklist before production
  • Choose the right model family for your task (text vs. image vs. structured prediction).
  • Add domain adaptation: fine-tuning, prompts, or retrieval to ground outputs.
  • Persist and retrieve context for multi-turn experiences (RAG or explicit memory).
  • Implement safety layers: filtering, human review, and escalation paths.
  • Define and monitor KPIs: accuracy, user satisfaction, cost per query, and drift detection.
  • Start small, iterate, and scale once metrics and safety guarantees meet your requirements.
Thanks for reading — that concludes this section on the capabilities and limitations of generative AI and LLM applications.

Watch Video