Generative AI and LLMs For Dummies®, Snowflake Special Edition (David Baum) (Z-Library)
Author: David Baum
教育
No Description
📄 File Format:
PDF
💾 File Size:
1.9 MB
55
Views
0
Downloads
0.00
Total Donations
📄 Text Preview (First 20 pages)
ℹ️
Registered users can read the full content for free
Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.
📄 Page
1
(This page has no text content)
📄 Page
2
These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
📄 Page
3
These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Generative AI and LLMs Snowflake Special Edition by David Baum
📄 Page
4
These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Generative AI and LLMs For Dummies®, Snowflake Special Edition Published by John Wiley & Sons, Inc. 111 River St. Hoboken, NJ 07030-5774 www.wiley.com Copyright © 2024 by John Wiley & Sons, Inc., Hoboken, New Jersey No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions. Trademarks: Wiley, For Dummies, the Dummies Man logo, The Dummies Way, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the United States and other countries, and may not be used without written permission. Snowflake and the Snowflake logo are trademarks or registered trademarks of Snowflake Inc. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: WHILE THE PUBLISHER AND AUTHORS HAVE USED THEIR BEST EFFORTS IN PREPARING THIS WORK, THEY MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES REPRESENTATIVES, WRITTEN SALES MATERIALS OR PROMOTIONAL STATEMENTS FOR THIS WORK. THE FACT THAT AN ORGANIZATION, WEBSITE, OR PRODUCT IS REFERRED TO IN THIS WORK AS A CITATION AND/ OR POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE PUBLISHER AND AUTHORS ENDORSE THE INFORMATION OR SERVICES THE ORGANIZATION, WEBSITE, OR PRODUCT MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING PROFESSIONAL SERVICES. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR YOUR SITUATION. YOU SHOULD CONSULT WITH A SPECIALIST WHERE APPROPRIATE. FURTHER, READERS SHOULD BE AWARE THAT WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. NEITHER THE PUBLISHER NOR AUTHORS SHALL BE LIABLE FOR ANY LOSS OF PROFIT OR ANY OTHER COMMERCIAL DAMAGES, INCLUDING BUT NOT LIMITED TO SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR OTHER DAMAGES. For general information on our other products and services, or how to create a custom For Dummies book for your business or organization, please contact our Business Development Department in the U.S. at 877-409-4177, contact info@dummies.biz, or visit www.wiley.com/go/custompub. For information about licensing the For Dummies brand for products or services, contact BrandedRights&Licenses@Wiley.com. ISBN 978-1-394-23842-2 (pbk); ISBN 978-1-394-23843-9 (ebk) Publisher’s Acknowledgments Some of the people who helped bring this book to market include the following: Development Editor: Nicole Sholly Project Manager: Jennifer Bingham Acquisitions Editor: Traci Martin Editorial Manager: Rev Mengle Sales Manager: Molly Daugherty Content Refinement Specialist: Saikarthick Kumarasamy
📄 Page
5
Table of Contents iii These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Table of Contents INTRODUCTION ............................................................................................... 1 About This Book ................................................................................... 1 Icons Used in This Book ....................................................................... 2 Beyond the Book .................................................................................. 2 CHAPTER 1: Introducing Gen AI and the Role of Data ................. 3 The Historical Context of Gen AI ........................................................ 3 Introducing LLMs and foundation models .................................. 4 Transforming the AI landscape ..................................................... 5 Accelerating AI functions ............................................................... 5 The Role of Data in AI Projects ........................................................... 6 Explaining the Importance of Generative AI to the Enterprise ....... 7 Pretrained models .......................................................................... 8 Security versus ease of use ........................................................... 9 Managing Gen AI Projects with a Cloud Data Platform ................. 10 CHAPTER 2: Understanding Large Language Models ................. 11 Categorizing LLMs .............................................................................. 11 Defining general-purpose LLMs .................................................. 12 Using task-specific and domain-specific LLMs .......................... 14 Reviewing the Technology Behind LLMs ......................................... 14 Introducing key terms and concepts .......................................... 15 Explaining the importance of vector embeddings .................... 16 Identifying developer tools and frameworks ............................ 17 Enforcing data governance and security ................................... 17 Extending governance for all data types.................................... 18 CHAPTER 3: LLM App Project Lifecycle ................................................... 19 Defining the Use Case and Scope .................................................... 19 Selecting the right LLM ................................................................. 20 Comparing small and large language models ........................... 21 Adapting LLMs to Your Use Case...................................................... 22 Engineering prompts .................................................................... 22 Learning from context .................................................................. 23 Augmenting text retrieval ............................................................ 23 Fine-tuning language models ...................................................... 24 Reinforcement learning ............................................................... 25 Using a vector database ............................................................... 25
📄 Page
6
iv Generative AI and LLMs For Dummies, Snowflake Special Edition These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Implementing LLM Applications ....................................................... 26 Deploying apps into containers .................................................. 26 Allocating specialized hardware .................................................. 27 Integrating apps and data............................................................ 27 CHAPTER 4: Bringing LLM Apps into Production ............................ 29 Adapting Data Pipelines .................................................................... 29 Semantic caching .......................................................................... 30 Feature injection ........................................................................... 30 Context retrieval ........................................................................... 31 Processing for Inference.................................................................... 31 Reducing latency ........................................................................... 32 Calculating costs ........................................................................... 33 Creating User Interfaces .................................................................... 33 Simplifying Development and Deployment .................................... 34 Orchestrating AI Agents ..................................................................... 34 CHAPTER 5: Reviewing Security and Ethical Considerations ............................................................................. 37 Reiterating the Importance of Security and Governance .............. 38 Centralizing Data Governance .......................................................... 39 Alleviating Biases ................................................................................ 40 Acknowledging Open-Source Risks .................................................. 40 Contending with Hallucinations ....................................................... 41 Observing Copyright Laws ................................................................ 42 CHAPTER 6: Five Steps to Generative AI ................................................ 43 Identify Business Problems ............................................................... 43 Select a Data Platform ....................................................................... 43 Build a Data Foundation .................................................................... 44 Create a Culture of Collaboration .................................................... 44 Measure, Learn, Celebrate ................................................................ 44
📄 Page
7
Introduction 1 These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Introduction Generative AI (gen AI) and large language models (LLMs) are revolutionizing our personal and professional lives. From supercharged digital assistants that manage our email to seemingly omniscient chatbots that can communicate with enterprise data across industries, languages, and specialties, these technologies are driving a new era of convenience, produc- tivity, and connectivity. In the business world, gen AI automates a huge variety of menial tasks, saving time and improving efficiency. It generates code, aids in data analysis, and automates content creation, freeing knowledge workers to focus on critical and creative tasks. It also enhances personal experiences by tailoring content to your pref- erences, delivering personalized recommendations for playlists, movies, and news feeds that enrich our daily lives. Traditional AI uses predictive models to classify data, recognize patterns, and predict outcomes within a specific context or domain, such as analyzing medical images to detect irregularities. Gen AI models generate entirely new outputs rather than simply making predictions based on prior experience. This shift from prediction to creation opens up new realms of innovation. For example, while a traditional predictive model can spot a suspicious lesion in an MRI of lung tissue, a gen AI app can also determine the likelihood that a patient will develop pneumonia or some other type of lung disease and offer treatment recommendations based on best prac- tices gleaned from thousands of similar cases. Both in the public sphere of the Internet and within the realm of private enterprise, the transformative potential of this rapidly evolving field is reshaping the way people live, work, and interact. About This Book This book provides an introductory overview to LLMs and gen AI applications, along with techniques for training, tuning, and deploying machine learning (ML) models. The objective is to pro- vide a technical foundation without “getting into the weeds,” and to help bridge the gap between AI experts and their counterparts in marketing, sales, finance, product, and more.
📄 Page
8
2 Generative AI and LLMs For Dummies, Snowflake Special Edition These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. In the pages that follow, you learn about the importance of gen AI applications that are secure, resilient, easy to manage, and that can integrate with your existing technology ecosystem. You also discover the importance of standardizing on a modern data plat- form to unlock the full potential of your data. Prepare to embark on a transformative journey that will shape the way your business operates. Icons Used in This Book Throughout this book, the following icons highlight tips, impor- tant points to remember, and more: Tips guide you to easier ways to perform a task or better ways to use gen AI in your organization. This icon highlights concepts worth remembering as you immerse yourself in the understanding and application of gen AI and LLM principles. The jargon beneath the jargon, explained. Beyond the Book If you like what you read in this book and want to know more, visit www.snowflake.com, where you can learn about the company and what it offers, try Snowflake for free, obtain details about different plans and pricing, view webinars, access news releases, get the scoop on upcoming events, access documentation, and get in touch with them — they would love to hear from you! Disclaimer: Snowflake’s AI features and capabilities that are refer- enced or described in this book may not be generally available, be different than described, or no longer exist at the time of reading.
📄 Page
9
CHAPTER 1 Introducing Gen AI and the Role of Data 3 These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Chapter 1 IN THIS CHAPTER » Reviewing the history of AI » Emphasizing the role of data in gen AI projects » Discussing the importance of gen AI to the enterprise » Using a cloud data platform to manage gen AI initiatives Introducing Gen AI and the Role of Data Traditional AI, often referred to as machine learning (ML), has primarily focused on analytic tasks like classification and prediction. Generative AI (gen AI) goes a step further with its ability to create new, original content. This creative breakthrough has the potential to transform nearly every indus- try, enhancing human creativity and pushing the boundaries of what machines can accomplish. This chapter puts gen AI in a his- torical context, defines key terms, and introduces the data foun- dation that organizations need to succeed with gen AI initiatives. The Historical Context of Gen AI Gen AI is a type of artificial intelligence that uses neural networks and deep learning algorithms to identify patterns within exist- ing data as a basis for generating original content. By learning patterns from large volumes of data, gen AI algorithms synthe- size knowledge to create original text, images, audio, video, and other forms of output. To understand the transformative nature
📄 Page
10
4 Generative AI and LLMs For Dummies, Snowflake Special Edition These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. of these unique technologies, it is helpful to place them in their historical context. AI has a rich history marked by decades of steady progress, occasional setbacks, and periodic breakthroughs. Although certain foundational ideas in AI can be traced back to the early 20th century, classical (or traditional) AI, which focused on rule- based systems, had its inception in the 1950s and came into prominence in the ensuing decades. ML, which involves train- ing computer algorithms to learn patterns and make predictions based on data, emerged in the 1980s. At about this same time, neural networks gained popularity, inspired by the structure and functioning of the human brain. These software systems use interconnected nodes (neurons) to process information. During the first two decades of the 21st century, deep learning revolutionized the AI landscape with its capability to handle large amounts of data and execute complex tasks. As a type of neural network, deep learning employs multiple layers of interconnected neurons, allowing for more sophisticated learning and represen- tation of data. This breakthrough led to significant advancements in computer vision, speech recognition, and natural language processing (NLP), launching the era of general-purpose AI bots such as Siri and Alexa. Convolutional neural networks (CNNs) proved themselves to be particularly successful at computer vision tasks, while recurrent neural networks (RNNs) excelled in sequential data processing, such as language modeling. These technologies laid the foundation for gen AI. Introducing LLMs and foundation models Large language models (LLMs) are advanced AI systems designed to understand the intricacies of human language and to generate intelligent, creative responses when queried. Successful LLMs are trained on enormous data sets typically measured in petabytes (a million gigabytes). Training data has often been sourced from books, articles, websites, and other text-based sources, mostly in the public domain. Using deep learning techniques, these models excel at understanding and generating text similar to human- produced content. Today’s LLMs power many modern applica- tions, including content creation tools, language translation apps, customer service chatbots, financial analysis sites, scientific research repositories, and advanced Internet search tools.
📄 Page
11
CHAPTER 1 Introducing Gen AI and the Role of Data 5 These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. In the field of AI, language models are powerful software systems designed to understand, generate, and manipulate human lan- guage. Some models handle images and other media along with text. These are often referred to as multimodal language models. Transforming the AI landscape AI systems with humanlike reasoning capabilities have been around since the 1950s, but only with the advent of LLMs have they gained widespread adoption. According to a recent Forbes article called “Transformers Revolutionized AI. What Will Replace Them?” a key breakthrough came in 2017 when the Google Brain team introduced the transformer architecture, a deep learning model that replaced traditional recurrent and convolutional structures with a new type of architecture that’s particularly effective at understanding and contextualizing language, as well as generat- ing text, images, audio, and computer code. LLMs based on the transformer architecture have enabled new realms of AI capabilities. Perhaps the best-known example is OpenAI’s ChatGPT, which stands for chatbot generative pre- trained transformer. A CNN article, “Microsoft confirms it’s investing billions in the creator of ChatGPT,” shows support for the development of progressively larger LLMs, some of which may incorporate hundreds of billions of parameters to generate coherent and contextually relevant responses. Accelerating AI functions Another important factor in the evolution of AI is the advent of accelerated hardware systems known as graphics processing units (GPUs). Although central processing units (CPUs) are designed for general-purpose computing tasks, GPUs, initially developed for graphics rendering, are specialized processors that have proven to be adept at ML tasks due to their unique architecture. GPUs have a large number of cores that can process multiple tasks simultaneously. Transformers use GPUs to process multiple threads of information, leading to faster training of AI models that effectively handle not just text but also images, audio, and video content. This parallel processing capability is crucial for the computationally intensive calculations involved in ML, such as
📄 Page
12
6 Generative AI and LLMs For Dummies, Snowflake Special Edition These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. matrix operations. GPUs can perform these computations much faster than CPUs, accelerating training and inference times and enhancing the overall performance of ML algorithms. Refer to Cloud Data Science For Dummies (Wiley) by David Baum for addi- tional information on these concepts. Figure 1-1 summarizes AI progress. The Role of Data in AI Projects As impressive as they are at language generation, reasoning, and translation, gen AI applications that have been built on public data can’t realize their full potential in the enterprise until they’re cou- pled with enterprise data stores. Most organizations store massive amounts of data, both on-premises and in the cloud. Many of these businesses have data science practices that leverage structured data for traditional analytics, such as forecasting. To maximize the value of gen AI, these companies need to open up to the vast world of unstructured and semistructured data as well. According to a February 2021 report from MIT titled “Tapping the Power of Unstructured Data,” 80 to 90 percent of data is unstructured — locked away in text, audio, social media, and other sources. For enterprises that figure out how to use this data, it can provide a competitive advantage, especially in the era of gen AI. To amass a complete data set, consider not only your internal first-party data, but also second-party data from partners and suppliers, and third-party data from a service provider or data marketplace. See the nearby sidebar for more information. FIGURE 1-1: Gen AI builds on traditional AI concepts while vastly expanding applicability, scaling potential — and with web-scale processing demands.
📄 Page
13
CHAPTER 1 Introducing Gen AI and the Role of Data 7 These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Explaining the Importance of Generative AI to the Enterprise Today’s LLMs have paved the way for an immense array of advanced applications centered around content generation, logi- cal reasoning, language translation, text retrieval, code genera- tion, content summarization, and search: » LLMs for content generation: Gen AI can streamline content creation by generating various types of media, including text, sound, and images. For instance, a marketing department can utilize gen AI to generate the first drafts of blogs, press releases, posts on X (formerly Twitter), and product descriptions, including producing custom images for promotional campaigns. One popular use of this technology in the enterprise is to develop chatbots that engage in conversational interactions with business users, helping them obtain accurate answers to their questions. By harnessing private data such as customer transaction histories and customer service records, these systems can even deliver personalized content to target audiences while maintaining data security. LLMs are also adept at analyzing documents, summarizing unstructured text, and converting unstructured text into structured table formats. CAST A WIDE DATA NET To maximize the potential of your gen AI endeavors, cast a wide net to utilize the three basic types of data sources: • First-party data is internal data produced via everyday business interactions with customers and prospects. • Second-party data is produced by or in collaboration with trusted partners, such as product inventory data shared with an e-commerce or retail sales channel. • Third-party data can be acquired from external sources to enrich internal data sets. Common examples include manufacturing sup- ply chain data and financial market data.
📄 Page
14
8 Generative AI and LLMs For Dummies, Snowflake Special Edition These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. » LLMs as logical reasoning engines: Within the field of AI, natural language understanding (NLU) focuses on compre- hending the intricate meaning in human communication. LLMs can unravel the underlying meaning in textual data, such as product reviews, social media posts, and customer surveys. This makes them valuable for sentiment analysis and other complex reasoning tasks that involve extracting meaningful insights from text and providing a deeper understanding of human language. » LLMs as translation engines: LLMs have transformed text translation between languages, making it easier for people to communicate across linguistic barriers. By leveraging this understanding, LLMs can accurately convert text from one language to another, ensuring effective and reliable transla- tion. This breakthrough in language processing has greatly enhanced accessibility and global communication, allowing individuals and businesses to connect, collaborate, and understand each other more easily, regardless of language differences. » LLMs for text retrieval, summarization, and search: LLMs are pretrained on vast amounts of text data, allowing them to grasp the nuances of language and comprehend the meaning of text. They can search through large databases or the Internet in general to locate relevant information based on user-defined queries. LLMs can also generate concise summaries while maintaining the essence of the original information. For example, a tech company might use an LLM to optimize content for search engines by suggesting relevant keywords, giving visibility into common search queries associated with the topic, and ensuring crawlability. Gen AI models, and hence the decisions made from those models, are only as good as the data that supports them. The more data these models ingest and the more situations they encounter, the smarter and more comprehensive they become. Pretrained models There’s a rapidly growing market for creating and customiz- ing gen AI foundation models in many different industries and domains. This has given rise to a surge of LLMs that have been pretrained on data sets with millions or even billions of records,
📄 Page
15
CHAPTER 1 Introducing Gen AI and the Role of Data 9 These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. allowing them to accomplish specific tasks. For example, as explained by SiliconAngle’s “Nvidia debuts new AI tools for bio- molecular research and text processing,” MegaMolBART (part of the NVIDIA BioNeMo service and framework) can understand the language of chemistry and learn the relationships between atoms in real-world molecules, giving researchers a powerful tool for faster drug discovery. Pharmaceutical companies can fine-tune these foundation models using their own proprietary data. Train- ing these commercial foundation models is an immense effort that costs tens of millions of dollars. Fortunately, businesses that use them don’t have to repeat that massive process to adapt an LLM to their needs; they can adapt an existing foundation model for a fraction of that amount. Large technology companies are constantly inventing new model architectures, even as they expand the capabilities of their exist- ing LLMs (for more on this, see Chapter 2). Thousands of open- source models are available on public sites such as GitHub and Hugging Face. Developers can use the pretrained AI models as a foundation for creating custom AI apps. Security versus ease of use All logical reasoning engines need data to function. Although many of today’s LLMs have been trained on vast amounts of Internet data, they become even more powerful and relevant when they’re trained with enterprise data. Because much of this data is pro- tected in private databases and resides behind network firewalls, the challenge facing today’s enterprises involves augmenting LLMs with this corporate data in a secure and governed manner. Gen AI systems learn from data; the more data they can access, the more capable they become. But how do you ensure that your business users, software developers, and data scientists can easily access a secure, consistent, governed data set — without adding onerous constraints that inhibit innovation? Enterprises need to be able to leverage gen AI technology in an easy, straightforward manner. They also need to uphold essential data security, gov- ernance, and regulatory issues — not only for their data but also for the models that learn from the data and extract information from it. How can you achieve this without squelching innovation? You start by unifying data in a comprehensive repository that multiple
📄 Page
16
10 Generative AI and LLMs For Dummies, Snowflake Special Edition These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. workgroups can access easily and securely. This allows you to centralize data governance and democratize access to gen AI ini- tiatives across your organization while minimizing complexity and optimizing costs. Managing Gen AI Projects with a Cloud Data Platform A cloud data platform is a specialized cloud service optimized for storing, analyzing, and sharing large and diverse volumes of data. It unifies data security and data governance activities by ensuring that all users leverage a single copy of data. It fosters collaboration and ensures that the organization has a scalable data environ- ment for new foundation models and related analytic endeavors. A cloud data platform extends your AI horizons by allowing you to store your first-party data and leverage a network of data from second- and third-party data providers as well. It provides a pro- tected ecosystem where you can easily and securely share models and data sets, internally and with partners and customers. By utilizing a cloud data platform, you can seamlessly leverage existing infrastructure to support gen AI initiatives with mini- mal hassle. As a fully managed service, the platform eliminates the need to deal with the complexities and technical overhead of building and managing infrastructure. You can easily provi- sion and effortlessly scale compute resources for each type of data, such as GPUs for model training, fine-tuning, and infer- ence activities. Finally, by using the same core data foundation for all your data-driven initiatives, you can ensure consistency and reliability in managing your gen AI, data science, and ana- lytics projects. Data is your core differentiator in the age of gen AI. The best way to harness and protect enterprise data for gen AI initiatives is to consolidate disparate sources into a cloud data platform that provides strong security and governance for data and the models customized with that data. Data can be structured tabular data; semistructured data from IoT devices, weblogs, and other sources; or unstructured data, such as image files and PDF documents.
📄 Page
17
CHAPTER 2 Understanding Large Language Models 11 These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Chapter 2 IN THIS CHAPTER » Categorizing and classifying LLMs » Reviewing the technologies that power LLMs » Understanding the role of vector databases » Identifying LLM terms, concepts, and frameworks » Reiterating the importance of data governance Understanding Large Language Models Large language models (LLMs) are widely known for their ability to generate written text, computer code, and other content, as well as for their astonishing ability to respond to queries in humanlike ways. However, the utility of these AI sys- tems extends beyond explaining concepts and summarizing text. Today’s LLMs have the potential to revolutionize how enterprises acquire, handle, and analyze information, opening up new ave- nues for exploration and inquiry. This chapter defines the various types of LLMs and discusses their applicability to the enterprise. Categorizing LLMs General-purpose LLMs handle a wide range of tasks and under- stand a broad spectrum of languages — both natural languages and computer languages. They are trained by scraping massive amounts of data from the Internet, as well as by ingesting data
📄 Page
18
12 Generative AI and LLMs For Dummies, Snowflake Special Edition These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. from private data sources that are relevant to the purpose of the model. This allows LLMs to generate contextually related feed- back on just about any topic. Foundation models are a class of generative AI (gen AI) models that are well suited for a wide range of use cases. To increase their usefulness at a specific task, these models can be specialized, trained, or modified for specific applications. Common founda- tion models include the following: » Task-specific LLMs such as Meta’s Code Llama specialize in unique, highly targeted tasks like generating software code. » Domain-specific LLMs apply gen AI technology to specific subjects and industries. For example, NVIDIA’s BioBERT, which has been trained on biomedical text, helps research- ers understand scientific literature and extract information from medical documents. Domain-specific and task-specific models are fine-tuned using data specific to the domain they’re built for, such as law, medi- cine, cybersecurity, art, and countless other fields. They aren’t limited to language. Some of them can also generate music, pic- tures, video, and other types of multimodal content. An LLM is a general-purpose model primarily useful for tasks related to unstructured text data. A foundation model serves as the basis for developing specialized applications adapted to specific industries, business problems, and use cases. A foundation model can often be multimodal, meaning it handles both text and other media such as images. Defining general-purpose LLMs GPT-3, a general-purpose LLM, was developed by OpenAI based on the Generative Pre-trained Transformer (GPT) series of machine learning (ML) models. ChatGPT isn’t a language model per se, but rather a user interface tailored around a particular lan- guage model such as GPT-3, GPT-3.5, or GPT-4, all of which have been optimized for conversational interactions within the Chat- GPT LLM platform. Other popular LLM options are described in the nearby sidebar.
📄 Page
19
CHAPTER 2 Understanding Large Language Models 13 These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Those listed in the sidebar and other language models are becom- ing progressively more relevant to the business world. According to a June 1, 2023, press release from Bloomberg Intelligence, the gen AI market is poised to explode, growing to $1.3 trillion over the next 10 years from a market size of just $40 billion in 2022 — a compound annual growth of 42 percent. SIZING UP THE CONTENDERS As the software industry steps up research and development into LLMs, several prominent offerings have emerged in this highly competitive sector: • OpenAI’s GPT family is based on the GPT series of models. These LLMs are renowned for their impressive language-generation capabilities and capability to perform well across various language tasks, including search, text generation, reasoning, and multime- dia content delivery. • Bidirectional Encoder Representations from Transformers (BERT), developed by Google, employs a masked language model to learn contextual representations, enabling it to better compre- hend the meaning of sentences. This model powers Google Bard’s conversational AI chat service. • Llama (Large Language Model Meta AI) is a family of LLMs intro- duced by Meta that excels at language translation, text generation, and question-answering. Llama 2 is an open-source model that is available for research and development purposes. • Code Llama, also developed by Meta AI, is a language model tailored to understand and generate code snippets and program- ming instructions. It has been trained to assist in coding tasks, code completion, and suggesting efficient coding techniques. • Snowflake Copilot, an LLM fine-tuned by Snowflake, generates SQL from natural language and refines queries through conversa- tion, improving user productivity. • XLNet, developed by Carnegie Mellon University and Google, focuses on generating high-quality text in multiple languages, making it useful for language translation and content creation.
📄 Page
20
14 Generative AI and LLMs For Dummies, Snowflake Special Edition These materials are © 2024 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Using task-specific and domain-specific LLMs Bing and Bard are examples of applications developed utiliz- ing their respective foundation LLMs. These applications have a user interface and have undergone additional specialized training, enhancing their capabilities for specific tasks. For example, Bard offers chatbot access to Google’s full suite of products — includ- ing YouTube, Google Drive, Google Flights, and others — to assist users in a wide variety of tasks. Google users can link their personal Gmail, Google Docs, and other account data to allow Bard to analyze and manage their personal information. For example, you can ask Bard to plan an upcoming trip based on suggestions from a recent email string, complete with flight options. You can also ask Bard to summarize meeting notes you have logged in the files and folders of your Google Drive hierarchy. Domain-specific LLMs focus on a specific subject area or indus- try. For example, BioBERT is trained on biomedical text, mak- ing it an excellent resource for understanding scientific literature and extracting information from medical documents. CodeBERT is a cybersecurity solution that has been trained to assist with IT security concerns such as vulnerability detection, code review, and software security analysis. These specialized LLMs can be further trained and fine-tuned using data specific to targeted areas of interest, and can incorporate additional sources of data to build proficiency on designated subjects. To gain adoption and drive value from models, AI teams must build user interfaces that allow users to interact with these LLMs in designated ways. Reviewing the Technology Behind LLMs Neural networks are a key component of AI systems. As discussed in the previous chapter, most neural networks use a combination of complex recurrent or CNN structures to do their jobs. However, today’s gen AI models also have an attention mechanism that helps the encoder (the part that understands the input) and the decoder (the part that generates the output) work together more effectively (see Figure 2-1).
The above is a preview of the first 20 pages. Register to read the complete e-book.