Gen-ai 简明教程

ML and Generative AI

ChatGPT 于 2022 年 11 月 30 日首次发布后,人们对人工智能的兴趣变得广泛。ChatGPT(GPT 是生成式预训练转换器的缩写)是由 OpenAI 开发的会话式人工智能系统,任何人都可以尝试和使用,因为它促进了人与机器人之间的自然对话。

After the initial release of ChatGPT on November 30, 2022, the interest in artificial intelligence has become widespread. ChatGPT (GPT stands for Generative Pre-Trained Transformer) is a conversational AI system developed by OpenAI that anyone can experiment with and use as it facilitates natural conversations between humans and the bot.

在很短的时间内,ChatGPT 让我们思考人工智能如何影响我们的社会和经济。但有一件事是肯定的,人工智能正在成为我们生活的重要组成部分,并在未来几年塑造我们的未来。

Within a very short period of time, ChatGPT has made us think about how AI affects our society and economy. But one thing is sure, AI is becoming a crucial part of our lives and will shape our future in the coming years.

就像生成式人工智能是 ChatGPT 和 Dall-E3 等工具背后的思想一样,人们可以将“机器学习”和“深度学习”视为塑造生成式人工智能的主要组成部分。阅读本章以全面了解机器学习和深度学习,以及这两个概念如何对塑造生成式人工智能的当前形式发挥关键作用。

Just like Generative AI is the brain behind tools like ChatGPT and Dall-E3, one can regard "Machine Learning" and "Deep Learning" as the primary components that shape Generative AI. Read this chapter to get an overview of ML and DL and how these two concepts play a critical role in shaping Generative AI in its present form.

人工智能并非孤立的学科;它是帮助超越人类能力的每项技术的总称。借助以下给定的图表,让我们了解各个学科彼此之间以及与人工智能之间的关系。

AI is not an isolated discipline; it is an umbrella of every technology that helps transcend human capabilities. With the help of below given diagram, let’s understand the relationships of various disciplines to each other and to AI.

ml and generative ai

生成式 AI 是 AI 的最新子类型,它正在重塑创造力和创新的格局。其他类型的 AI,即机器学习和深度学习,奠定了生成式 AI 的基础。在本章中,我们将简要概述生成式 AI 的基础,包括机器学习、其子类型和深度学习。

Generative AI is the latest subtype of AI that is reshaping the landscape of creativity and innovation. Other subtypes of AI namely Machine Learning and Deep Learning lay the foundations of generative AI. In this chapter, we will briefly overview the foundations of generative AI, including machine learning, its subtypes, and deep learning.

Machine Learning - A Brief Overview

Machine LearningArtificial Intelligence 的一个子集,它使用算法或方法使计算机系统或机器能够从原始数据中提取模式。它通过从经验和可用数据中学习来构建自己的模型,而无需明确编程。

Machine Learning is a subset of Artificial Intelligence that enables computer systems or machines to extract patterns from raw data by using an algorithm or method. It builds a model themselves by learning from experience and available data, without being explicitly programmed.

基于训练方法和数据可用性,机器学习有以下三个基本学习类别 -

Based on training methods as well as data availability, machine learning has following three basic learning categories −

Supervised Learning

在这一类机器学习中,使用标记数据集对算法进行训练。基本上,在有监督学习中,算法或模型提供了输入-输出对,其中每个输入都与相应的输出或标签匹配。主要目标是使模型学习输入和输出之间的关系,使其能够准确预测或分类新的、看不见的数据。

In this category of machine learning, the algorithm is trained using a labeled dataset. Basically, the algorithm or model in supervised learning is provided with input-output pairs where every input is matched with a corresponding output or label. The main goal is to make a model to learn the relationship between input and outputs, enable it to accurately predict or classify new, unseen data.

Unsupervised Learning

在此类别中,与有监督学习相反,模型在没有标记数据集的情况下进行训练。它学会自主地分析和深入了解数据。主要目标是使模型学习未标记数据中的关系。

In this category, as opposed to supervised learning, the model is trained without labeled dataset. It learns to analyze and derive insights from data autonomously. The main goal is to make a model to learn the relationship within unlabeled data.

Reinforcement Learning

在这种机器学习范例中,模型不是使用标记或未标记的数据,而是借助代理和环境进行训练。代理通过与环境交互来学习决策。

In this paradigm of machine learning, rather than using labeled or unlabeled data, the model is trained with the help of agent and environment. The agent learns to make decisions by interacting with an environment.

首先,它在环境中采取行动,然后以奖励或惩罚的形式接收反馈。最后,代理使用反馈来改进其决策。

First it takes actions in the environment and then receives feedback in the form of rewards or punishments. Finally, the agent uses the feedback to improve its decision-making.

Contribution of ML in Generative AI

让我们了解机器学习如何为生成式 AI 的基础做出贡献 -

Let’s understand how machine learning contributes to the foundation of generative AI −

Learning From Data

在开发的早期阶段,生成式 AI 模型使用有监督学习来训练模型,以便他们能够根据学习到的输入和输出之间的关系生成内容。

In the early stages of development, generative AI models use supervised learning to train models so that they can generate content based on the learned relationship between input and outputs.

Understanding Patterns and Relationships

生成式 AI 利用无监督学习来发现模式和关系。它帮助生成式 AI 模型从未标记的数据中生成新内容。

Generative AI utilizes unsupervised learning to uncover patterns and relationships. It helps generative AI models to generate new content from unlabeled data.

Adaptability and Improvements

在生成式 AI 中,适应性非常重要,特别是对于需要持续改进的任务。生成式 AI 模型使用强化学习根据反馈和奖励来改进其输出。ChatGPT 实际上使用 Reinforcement Learning with Human Feedback (RLHF) ,其中涉及少量的人工反馈来改进代理的学习过程。

In generative AI, adaptability is very important, especially for the tasks that need continuous improvements. Generative AI models use reinforcement learning to refine their output based on feedback and rewards. ChatGPT, in fact, uses Reinforcement Learning with Human Feedback (RLHF) that involves a small increment of human feedback to refine the agent’s learning process.

Optimizing Model Parameters

生成式 AI 模型使用 ML 优化技术来微调参数。它提高了他们的性能,并且可以生成更准确的内容。

Generative AI models use ML optimization techniques to fine-tune parameters. It enhances their performance, and they can generate more accurate content.

Transfer Learning

生成式 AI 使用另一种称为转移学习的 ML 范例来预训练他们的模型。它帮助模型加速特定内容生成过程的学习。

Generative AI uses another ML paradigm called transfer learning, to pre-train their model. It helps the model to accelerate the learning for specific content generation process.

Deep Learning - A Brief Overview

Deep Learning 是受人脑结构和功能启发的 ML 子集。它使用称为人工神经网络(ANN)的算法的多层结构从输入数据中提取复杂特征。

Deep Learning is a subset of ML inspired by the structure and function of the human brain. It uses a multi-layered structure of algorithms called artificial neural network (ANN) to extract complex features from input data.

与算法不同,一旦建立了深度学习算法,便需要较少的人工干预。它也需要更少的时间进行测试,因此可以立即生成结果。

Deep Learning algorithms, in contrast to algorithms, once set up requires less human intervention. It also requires less time for testing and hence can generate results instantaneously.

让我们了解深度学习如何为生成式 AI 的基础做出贡献 -

Let’s understand how deep learning contribute to the foundation of generative AI −

Hierarchical Representations

为了生成多样化的内容,生成式 AI 需要学习数据的层级表示。深度神经网络(具有多层的神经网络),一种深度学习模型,帮助生成式 AI 模型做到这一点。

To generate diverse content, generative AI needs to learn hierarchical representations of data. Deep neural networks (neural networks with multiple layers), a kind of deep learning model, helps generative AI models to do so.

Convolutional Neural Network (CNNs)

它是一种用于分析图像的 ANN(人工神经网络)。他们使用卷积层从输入图像自动学习特征的空间层次。生成式 AI 模型使用 CNN 从视觉数据中提取特征并促进跨模态任务,例如文本到图像的生成。这使得 CNN 成为推进生成式 AI 能力的强大工具。

It is a type of ANN (artificial neural network) used for analyzing images. They automatically learn spatial hierarchies of features from input images using convolutional layers. Generative AI models use CNN to extract features from visual data and to facilitate cross-modal tasks like text-to-image generation. This makes CNN a powerful tool in advancing generative AI capabilities.

Recurrent Neural Network (RNN)

它们是具有闭环的前馈神经网络,即所有节点都连接到所有其他节点。RNN 中的每个节点同时充当输入和输出。生成式 AI 模型使用 RNN 从示例中学习并创建遵循已学习模式的新数据序列。

They are feedforward neural networks with closed loops i.e., all the nodes are connected to all the other nodes. Each node in RNN works as both input and output. Generative AI models use RNNs to learn from examples and create new sequences of data that follow patterns they have learned.

Large-Scale Data Handling

要训练生成式人工智能模型,我们需要访问大规模数据集。深度学习模型有助于处理此类数据集。

To train generative AI models we need to access large-scale datasets. Deep learning models help to handle such datasets.

Generative Adversarial Networks (GANs)

生成对抗网络 (GAN) 是一种用于生成建模的深度神经网络架构类型。GAN 因其在生成逼真图像、视频和其他类型内容方面的创新方法而被证明非常有效。

Generative Adversarial Networks (GANs) are a type of deep neural network architecture used for generative modelling. GANs have proven highly effective for their innovative approach to generate realistic images, videos, and other kinds of content generation.

Conclusion

在本章中,我们解释了人工智能的各个学科如何相互关联。我们还概述了机器学习和深度学习,以及它们如何在奠定生成式人工智能非凡能力的基础中发挥重要作用。

In this chapter, we explained how the various disciplines of AI are related to each other. We also seen an overview of machine learning and deep learning and how they play an important role in laying the foundation of generative AI’s remarkable capabilities.

我们还重点介绍了各种机器学习范例,包括监督式、无监督式和强化学习。显然,机器学习和深度学习将在释放生成式人工智能的全部潜力中发挥关键作用。

We also highlighted various ML paradigms including Supervised, Unsupervised, and Reinforcement learning. It’s clear that machine learning and deep learning will play crucial roles in unlocking the full potential of generative AI.