
Generative AI Foundations in Python
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
The intricacies and breadth of generative AI (GenAI) and large language models can sometimes eclipse their practical application. It is pivotal to understand the foundational concepts needed to implement generative AI. This guide explains the core concepts behind -of-the-art generative models by combining theory and hands-on application. Generative AI Foundations in Python begins by laying a foundational understanding, presenting the fundamentals of generative LLMs and their historical evolution, while also setting the stage for deeper exploration. You'll also understand how to apply generative LLMs in real-world applications. The book cuts through the complexity and offers actionable guidance on deploying and fine-tuning pre-trained language models with Python. Later, you'll delve into topics such as task-specific fine-tuning, domain adaptation, prompt engineering, quantitative evaluation, and responsible AI, focusing on how to effectively and responsibly use generative LLMs. By the end of this book, you'll be well-versed in applying generative AI capabilities to real-world problems, confidently navigating its enormous potential ethically and responsibly.
All prices
More details
Other editions
Additional editions

Content
- Intro
- Title Page
- Copyright and Credits
- Dedications
- Foreword
- Contributors
- Table of Contents
- Preface
- Part 1: Foundations of Generative AI and the Evolution of Large Language Models
- Chapter 1: Understanding Generative AI: An Introduction
- Generative AI
- Distinguishing generative AI from other AI models
- Briefly surveying generative approaches
- Clarifying misconceptions between discriminative and generative paradigms
- Choosing the right paradigm
- Looking back at the evolution of generative AI
- Overview of traditional methods in NLP
- Arrival and evolution of transformer-based models
- Development and impact of GPT-4
- Looking ahead at risks and implications
- Introducing use cases of generative AI
- The future of generative AI applications
- Summary
- References
- Chapter 2: Surveying GenAI Types and Modes: An Overview of GANs, Diffusers, and Transformers
- Understanding General Artificial Intelligence (GAI) Types - distinguishing features of GANs, diffusers, and transformers
- Deconstructing GAI methods - exploring GANs, diffusers, and transformers
- A closer look at GANs
- A closer look at diffusion models
- A closer look at generative transformers
- Applying GAI models - image generation using GANs, diffusers, and transformers
- Working with Jupyter Notebook and Google Colab
- Stable diffusion transformer
- Scoring with the CLIP model
- Summary
- References
- Chapter 3: Tracing the Foundations of Natural Language Processing and the Impact of the Transformer
- Early approaches in NLP
- Advent of neural language models
- Distributed representations
- Transfer Learning
- Advent of NNs in NLP
- The emergence of the Transformer in advanced language models
- Components of the transformer architecture
- Sequence-to-sequence learning
- Evolving language models - the AR Transformer and its role in GenAI
- Implementing the original Transformer
- Data loading and preparation
- Tokenization
- Data tensorization
- Dataset creation
- Embeddings layer
- Positional encoding
- Multi-head self-attention
- FFN
- Encoder layer
- Encoder
- Decoder layer
- Decoder
- Complete transformer
- Training function
- Translation function
- Main execution
- Summary
- References
- Chapter 4: Applying Pretrained Generative Models: From Prototype to Production
- Prototyping environments
- Transitioning to production
- Mapping features to production setup
- Setting up a production-ready environment
- Local development setup
- Visual Studio Code
- Project initialization
- Docker setup
- Requirements file
- Application code
- Creating a code repository
- CI/CD setup
- Model selection - choosing the right pretrained generative model
- Meeting project objectives
- Model size and computational complexity
- Benchmarking
- Updating the prototyping environment
- GPU configuration
- Loading pretrained models with LangChain
- Setting up testing data
- Quantitative metrics evaluation
- Alignment with CLIP
- Interpreting outcomes
- Responsible AI considerations
- Addressing and mitigating biases
- Transparency and explainability
- Final deployment
- Testing and monitoring
- Maintenance and reliability
- Summary
- Part 2: Practical Applications of Generative AI
- Chapter 5: Fine-Tuning Generative Models for Specific Tasks
- Foundation and relevance - an introduction to fine-tuning
- PEFT
- LoRA
- AdaLoRA
- In-context learning
- Fine-tuning versus in-context learning
- Practice project: Fine-tuning for Q&A using PEFT
- Background regarding question-answering fine-tuning
- Implementation in Python
- Evaluation of results
- Summary
- References
- Chapter 6: Understanding Domain Adaptation for Large Language Models
- Demystifying domain adaptation - understanding its history and importance
- Practice project: Transfer learning for the finance domain
- Training methodologies for financial domain adaptation
- Evaluation and outcome analysis - the ROUGE metric
- Summary
- References
- Chapter 7: Mastering the Fundamentals of Prompt Engineering
- The shift to prompt-based approaches
- Basic prompting - guiding principles, types, and structures
- Guiding principles for model interaction
- Prompt elements and structure
- Elevating prompts - iteration and influencing model behaviors
- LLMs respond to emotional cues
- Effect of personas
- Situational prompting or role-play
- Advanced prompting in action - few-shot learning and prompt chaining
- Practice project: Implementing RAG with LlamaIndex using Python
- Summary
- References
- Chapter 8: Addressing Ethical Considerations and Charting a Path Toward Trustworthy Generative AI
- Ethical norms and values in the context of generative AI
- Investigating and minimizing bias in generative LLMs and generative image models
- Constrained generation and eliciting trustworthy outcomes
- Constrained generation with fine-tuning
- Constrained generation through prompt engineering
- Understanding jailbreaking and harmful behaviors
- Practice project: Minimizing harmful behaviors with filtering
- Summary
- References
- Index
- About Packt
- Other Books You May Enjoy
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.
File format: ePUB
Copy protection: without DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Use a reader that can handle the file format ePUB, such as Adobe Digital Editions or FBReader – both free (see eBook Help).
- Tablet/Smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePUB works well for novels and non-fiction books – i.e., 'flowing' text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook does not use copy protection or Digital Rights Management
For more information, see our eBook Help page.