2020网络游戏排行榜/搜索引擎优化案例
The Concept of Embeddings
嵌入的概念
Neural nets—at least as they’re currently set up—are fundamentally based on numbers. So if we’re going to to use them to work on something like text we’ll need a way to represent our text with numbers. And certainly we could start (essentially as ChatGPT does) by just assigning a number to every word in the dictionary. But there’s an important idea—that’s for example central to ChatGPT—that goes beyond that. And it’s the idea of “embeddings”. One can think of an embedding as a way to try to represent the “essence” of something by an array of numbers—with the property that “nearby things” are represented by nearby numbers.
神经网络——至少在目前的设置中——是基于数字的。所以,如果我们要使用它们来处理像文本这样的东西,我们需要一种用数字表示文本的方法。当然,我们可以开始(就像 ChatGPT 所做的那样)为字典中的每个单词分配一个数字。但是,还有一个重要的想法——例如,这是 ChatGPT 的核心思想——超越了这一点。这个想法就是“嵌入”。我们可以将嵌入看作是一种尝试通过一组数字来表示事物“本质”的方法——其特性是“相邻的事物”由相邻的数字表示。
And so, for example, we can think of a word embedding as trying to lay out words in a kind of “meaning space” in which words that are somehow “nearby in meaning” appear nearby in the embedding. The actual embeddings that are used—say in ChatGPT—tend to involve large lists of numbers. But if we project down to 2D, we can show examples of how words are laid out by the embedding:
因此,例如,我们可以将词嵌入视为尝试在一种“意义空间”中布局单词,其中在意义上“相近”的单词在嵌入中也相邻。实际使用的嵌入——比如在 ChatGPT 中——倾向于涉及大量的数字列表。但如果我们将其投影到二维空间,我们可以展示单词在嵌入中的布局示例:
And, yes, what we see does remarkably well in capturing typical everyday impressions. But how can we construct such an embedding? Roughly the idea is to look at large amounts of text (here 5 billion words from the web) and then see “how similar” the “environments” are in which different words appear. So, for example, “alligator” and “crocodile” will often appear almost interchangeably in otherwise similar sentences, and that means they’ll be placed nearby in the embedding. But “turnip” and “eagle” won’t tend to appear in otherwise similar sentences, so they’ll be placed far apart in the embedding.
是的,我们看到的确实在很大程度上捕捉到了典型的日常印象。但是我们如何构建这样的嵌入呢?大致的想法是查看大量的文本(这里是来自网络的 50 亿个单词),然后看看不同单词出现的“环境”有多“相似”。因此,例如,“alligator”和“crocodile”通常会在其他相似的句子中几乎可以互换地出现,这意味着它们在嵌入中会被放置得很近。但“turnip”和“eagle”不会出现在其他类似的句子中,因此它们在嵌入中的位置会相距较远。
But how does one actually implement something like this using neural nets? Let’s start by talking about embeddings not for words, but for images. We want to find some way to characterize images by lists of numbers in such a way that “images we consider similar” are assigned similar lists of numbers.
但是,如何使用神经网络实际实现这样的功能呢?让我们先谈谈关于图像而不是单词的嵌入。我们希望建立某种方法,通过数字列表来描述图像,使得“我们认为相似的图像”被分配相似的数字列表。
How do we tell if we should “consider images similar”? Well, if our images are, say, of handwritten digits we might “consider two images similar” if they are of the same digit. Earlier we discussed a neural net that was trained to recognize handwritten digits. And we can think of this neural net as being set up so that in its final output it puts images into 10 different bins, one for each digit.
我们如何判断我们是否应该“认为图像相似”呢?好吧,如果我们的图像是,比如说,手写数字,我们可能会“认为两个图像相似”,如果它们是相同的数字。之前我们讨论了一个经过训练的神经网络,用于识别手写数字。我们可以将这个神经网络看作是设置成在其最终输出中将图像放入 10 个不同的箱子,每个数字一个。
But what if we “intercept” what’s going on inside the neural net before the final “it’s a ‘4’” decision is made? We might expect that inside the neural net there are numbers that characterize images as being “mostly 4-like but a bit 2-like” or some such. And the idea is to pick up such numbers to use as elements in an embedding.
但是,如果我们在最终做出“这是‘4’”的决定之前,“拦截”神经网络内部正在进行的操作会怎样呢?我们可能会期望神经网络内部有一些数字来表征图像,比如“大部分像 4,但有点像 2 ”之类的。这个想法就是利用这些数字作为嵌入中的元素。
So here’s the concept. Rather than directly trying to characterize “what image is near what other image”, we instead consider a well-defined task (in this case digit recognition) for which we can get explicit training data—then use the fact that in doing this task the neural net implicitly has to make what amount to “nearness decisions”. So instead of us ever explicitly having to talk about “nearness of images” we’re just talking about the concrete question of what digit an image represents, and then we’re “leaving it to the neural net” to implicitly determine what that implies about “nearness of images”.
这里是概念。我们不是直接尝试描述“哪个图像靠近哪个图像”,而是考虑一个可以获得明确训练数据的明确定义任务(在这种情况下是数字识别),然后利用神经网络在执行这个任务时必须隐含地进行类似“靠近决策”的事实。所以我们不需要明确地讨论“图像的靠近性”,我们只是讨论一个具体问题,即图像代表的数字是什么,然后我们“把它留给神经网络”来隐含地确定这对“图像的靠近性”意味着什么。
So how in more detail does this work for the digit recognition network? We can think of the network as consisting of 11 successive layers, that we might summarize iconically like this (with activation functions shown as separate layers):
那么,对于数字识别网络,这个方法具体是如何工作的呢?我们可以将网络看作是由 11 个连续的层组成,我们可以用图标表示如下(激活函数显示为单独的层):
At the beginning we’re feeding into the first layer actual images, represented by 2D arrays of pixel values. And at the end—from the last layer—we’re getting out an array of 10 values, which we can think of saying “how certain” the network is that the image corresponds to each of the digits 0 through 9.
在开始时,我们将实际图像(由像素值的二维数组表示)输入到第一层。在最后,从最后一层中,我们得到一个包含 10 个值的数组,我们可以认为它表示网络确定图像对应 0 到 9 的每个数字的“确定程度”。
Feed in the image
and the values of the neurons in that last layer are:
输入图像:最后一层神经元的值为:
In other words, the neural net is by this point “incredibly certain” that this image is a 4—and to actually get the output “4” we just have to pick out the position of the neuron with the largest value.
换句话说,到目前为止,神经网络“非常确定”这个图像是 4——要实际得到输出“4”,我们只需要找到数值最大的神经元的位置。
But what if we look one step earlier? The very last operation in the network is a so-called softmax which tries to “force certainty”. But before that’s been applied the values of the neurons are:
但是,如果我们再往前看一步会怎样呢?网络中的最后一个操作是所谓的“softmax”,它试图“强制确定”。但在应用“softmax”之前,神经元的值是:
The neuron representing “4” still has the highest numerical value. But there’s also information in the values of the other neurons. And we can expect that this list of numbers can in a sense be used to characterize the “essence” of the image—and thus to provide something we can use as an embedding. And so, for example, each of the 4’s here has a slightly different “signature” (or “feature embedding”)—all very different from the 8’s:
表示“4”的神经元仍然具有最高的数值。但是其他神经元的值中也有信息。我们可以期望这个数字列表在某种程度上用来描述图像的“本质”,从而提供我们可以用作嵌入的东西。因此,例如,这里的每个 4 都有一个略有不同的“签名”(或“特征嵌入”)——与 8 完全不同:
Here we’re essentially using 10 numbers to characterize our images. But it’s often better to use much more than that. And for example in our digit recognition network we can get an array of 500 numbers by tapping into the preceding layer. And this is probably a reasonable array to use as an “image embedding”.
在这里,我们实质上使用了 10 个数字来描述我们的图像。但通常使用更多的数字会更好。例如,在我们的数字识别网络中,我们可以通过连接到前一层来获得一个包含 500 个数字的数组。这可能是一个合理的“图像嵌入”。
If we want to make an explicit visualization of “image space” for handwritten digits we need to “reduce the dimension”, effectively by projecting the 500-dimensional vector we’ve got into, say, 3D space:
如果我们想为手写数字的“图像空间”制作一个明确的可视化,我们需要“降低维度”,实际上是将我们得到的 500 维向量投影到,例如,3D 空间:
We’ve just talked about creating a characterization (and thus embedding) for images based effectively on identifying the similarity of images by determining whether (according to our training set) they correspond to the same handwritten digit. And we can do the same thing much more generally for images if we have a training set that identifies, say, which of 5000 common types of object (cat, dog, chair, …) each image is of. And in this way we can make an image embedding that’s “anchored” by our identification of common objects, but then “generalizes around that” according to the behavior of the neural net. And the point is that insofar as that behavior aligns with how we humans perceive and interpret images, this will end up being an embedding that “seems right to us”, and is useful in practice in doing “human-judgement-like” tasks.
我们刚刚讨论了如何根据确定图像是否(根据我们的训练集)对应于相同的手写数字来识别图像的相似性,从而为图像创建一个特征(因此嵌入)。对于图像,如果我们有一个训练集,该训练集可以识别出,例如,每个图像是 5000 种常见类型的对象(猫、狗、椅子等)中的哪一种,我们可以做同样的事情。通过这种方式,我们可以制作一个以我们识别常见物体为“锚点”的图像嵌入,然后根据神经网络的行为“在此基础上进行推广”。关键在于,只要该行为与我们人类感知和解释图像的方式相一致,这将最终成为一个“对我们来说看似正确”的嵌入,并在实践中用于执行“类似人类判断”的任务。
OK, so how do we follow the same kind of approach to find embeddings for words? The key is to start from a task about words for which we can readily do training. And the standard such task is “word prediction”. Imagine we’re given “the ___ cat”. Based on a large corpus of text (say, the text content of the web), what are the probabilities for different words that might “fill in the blank”? Or, alternatively, given “___ black ___” what are the probabilities for different “flanking words”?
好的,那么我们如何采用相同的方法来找到单词的嵌入呢?关键是从一个可以轻松进行训练的单词任务开始。标准的这类任务是“单词预测”。想象一下,我们得到了“the ___ cat”。基于大量的文本语料库(比如,互联网的文本内容),可能填入空白处的不同单词的概率是多少?或者,换个说法,给定“___ black ___”,不同的“外围词”的概率是多少?
How do we set this problem up for a neural net? Ultimately we have to formulate everything in terms of numbers. And one way to do this is just to assign a unique number to each of the 50,000 or so common words in English. So, for example, “the” might be 914, and “ cat” (with a space before it) might be 3542. (And these are the actual numbers used by GPT-2.) So for the “the ___ cat” problem, our input might be {914, 3542}. What should the output be like? Well, it should be a list of 50,000 or so numbers that effectively give the probabilities for each of the possible “fill-in” words. And once again, to find an embedding, we want to “intercept” the “insides” of the neural net just before it “reaches its conclusion”—and then pick up the list of numbers that occur there, and that we can think of as “characterizing each word”.
我们如何为神经网络设置这个问题?归根结底,我们必须用数字来表达一切。实现这一目标的一种方法就是为英语中大约 50000 个常用单词中的每一个分配一个唯一的数字。例如,“the”可能是 914,“cat”(前面有一个空格)可能是 3542。(这些实际上是 GPT-2 使用的数字。)所以对于“the ___ cat”问题,我们的输入可能是{914, 3542}。输出应该是什么样的呢?嗯,它应该是一个包含大约 50000 个数字的列表,有效地给出每个可能的“填空”单词的概率。再次强调,要找到嵌入,我们希望在神经网络“得出结论”之前的某个时刻“拦截”它的“内部”,然后获取那里出现的数字列表,我们可以认为这个列表是“描述每个单词”的。
OK, so what do those characterizations look like? Over the past 10 years there’ve been a sequence of different systems developed (word2vec, GloVe, BERT, GPT, …), each based on a different neural net approach. But ultimately all of them take words and characterize them by lists of hundreds to thousands of numbers.
那么,这些描述看起来是什么样的呢?在过去的 10 年里,已经有一系列不同的系统(word2vec、GloVe、BERT、GPT等)被开发出来,每一个都基于不同的神经网络方法。但最终,它们都会将单词表示为包含数百到数千个数字的列表。
In their raw form, these “embedding vectors” are quite uninformative. For example, here’s what GPT-2 produces as the raw embedding vectors for three specific words:
在其原始形式下,这些“嵌入向量”并不包含太多信息。例如,这是 GPT-2 对三个特定单词生成的原始嵌入向量:
If we do things like measure distances between these vectors, then we can find things like “nearnesses” of words. Later we’ll discuss in more detail what we might consider the “cognitive” significance of such embeddings. But for now the main point is that we have a way to usefully turn words into “neural-net-friendly” collections of numbers.
如果我们测量这些向量之间的距离,那么我们可以找到诸如单词之间的“接近度”。稍后我们将更详细地讨论这种嵌入的“认知”意义。但目前最主要的一点是,我们有一种方法可以将单词有效地转换成适合神经网络的数字集合。
But actually we can go further than just characterizing words by collections of numbers; we can also do this for sequences of words, or indeed whole blocks of text. And inside ChatGPT that’s how it’s dealing with things. It takes the text it’s got so far, and generates an embedding vector to represent it. Then its goal is to find the probabilities for different words that might occur next. And it represents its answer for this as a list of numbers that essentially give the probabilities for each of the 50,000 or so possible words.
实际上,我们不仅可以通过数字集合来描述单词,还可以用它们来描述单词序列,甚至整个文本块。在 ChatGPT 中,就是这样处理事物的。它接收到目前为止的文本,并生成一个嵌入向量来表示它。然后它的目标是找到接下来可能出现的不同单词的概率。它将这个答案表示为一个数字列表,这个列表基本上给出了大约 50000 个可能单词的概率。
(Strictly, ChatGPT does not deal with words, but rather with “tokens”—convenient linguistic units that might be whole words, or might just be pieces like “pre” or “ing” or “ized”. Working with tokens makes it easier for ChatGPT to handle rare, compound and non-English words, and, sometimes, for better or worse, to invent new words.)
(严格来说,ChatGPT 处理的不是单词,而是“标记”——便捷的语言单位,可能是整个单词,也可能仅仅是像“pre”、“ing”或“ized”这样的部分。使用标记使 ChatGPT 更容易处理罕见、复合和非英语单词,有时候,或好或坏地,创造新词。)
“点赞有美意,赞赏是鼓励”
相关文章:

Stephen Wolfram:嵌入的概念
The Concept of Embeddings 嵌入的概念 Neural nets—at least as they’re currently set up—are fundamentally based on numbers. So if we’re going to to use them to work on something like text we’ll need a way to represent our text with numbers. And certain…...

springboot,swagger多个mapper包,多个controller加载问题
启动类添加MapperScan({"xxx.xxx.xxx.mapper","xxx.xxx.xxx.mapper"}) swagger配置类添加 Bean public Docket api01() {return new Docket(DocumentationType.SWAGGER_2)//.enable(swagger_is_enabl).apiInfo(new ApiInfoBuilder().title("你的title…...

湖大CG满分教程:作业训练四编程题20. 回文串(暴力×动态规划算法√)
问题描述 “回文串”是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串。给你一个字符串,问最少在字符串尾添加多少字符,可以使得字符串变为回文串。 输入格式 有多组测试数据。 每组测试数据第一行是一个正整数N…...

使用toad库进行机器学习评分卡全流程
1 加载数据 导入模块 import pandas as pd from sklearn.metrics import roc_auc_score,roc_curve,auc from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression import numpy as np import math import xgboost as xgb …...

Python数据容器——列表(list)
数据容器入门 Python中的数据容器: 一种可以容纳多份数据的数据类型,容纳的每一份数据称之为1个元素 每一个元素,可以是任意类型的数据,如字符串、数字、布尔等。 数据容器根据特点的不同,如:是否支持重复元…...

Linux CEF(Chromium Embedded Framework)源码下载编译详细记录
Linux CEF(Chromium Embedded Framework)源码下载编译 背景 由于CEF默认的二进制分发包不支持音视频播放,需要自行编译源码,将ffmpeg开关打开才能支持。这里介绍的是Linux平台下的CEF源码下载编译过程。 前置条件 下载的过程非…...

Adaptive AUTOSAR—— Communication Management 3.1
9 Communication Management 9.1 What is Communication Management? 通信管理是自适应平台架构中的一个功能集群。 作为一个功能集群,通信管理向应用程序提供了一个C++ API,实现了面向服务的通信。服务是一个由应用程序提供的功能单元,可以在运行时被另一个应用程序动态…...

VMnet0 桥接设置
VMnet0 一定要设置为你的硬件物理网卡,不能设置自动,不然后,网线一断,就再也连不上了。必须重启电脑才能连上,这个问题找了很久才找到。 下面有个hyper-V虚拟网卡,如果选自动的话,物理网卡一掉…...

Sublime Text 4 Build 4151 4152 发布及注册方法
Sublime Text 是一个商业代码编辑器。它原生支持许多编程语言和标记语言,用户可以通过插件来扩展它的功能,这些插件通常是由社区建立的,并以自由软件许可证的形式维护。为了方便插件,Sublime Text 有一个 Python API。 Sublime T…...

第八篇: K8S Prometheus Operator实现Ceph集群企业微信机器人告警
Prometheus Operator实现Ceph集群企业微信告警 实现方案 我们的k8s集群与ceph集群是部署在不同的服务器上,因此实现方案如下: (1) ceph集群开启mgr内置的exporter服务,用于获取ceph集群的metrics (2) k8s集群通过 Service Endponit Ser…...

软件单元测试
单元测试目的和意义 对于非正式的软件(其特点是功能比较少,后续也不有新特性加入,不用负责维护),我们可以使用debug单步执行,内存修改,检查对应的观测点是否符合要求来进行单元测试,…...

Redis | 集群模式
Redis | 集群模式 随着互联网应用规模的不断扩大,单一节点的数据库性能已经无法满足大规模应用的需求。为了提高数据库的性能和可扩展性,分布式数据库成为了解决方案之一。Redis 作为一个高性能的内存数据库,自然也有了自己的分布式部署方式…...

8.3day04git+数据结构
文章目录 git版本控制学习高性能的单机管理主机的心跳服务算法题 git版本控制学习 一个免费开源,分布式的代码版本控制系统,帮助开发团队维护代码 作用:记录代码内容,切换代码版本,多人开发时高效合并代码内容 安装g…...

04-5_Qt 5.9 C++开发指南_QComboBox和QPlainTextEdit
文章目录 1. 实例功能概述2. 源码2.1 可视化UI设计2.2 widget.h2.3 widget.cpp 1. 实例功能概述 QComboBox 是下拉列表框组件类,它提供一个下拉列表供用户选择,也可以直接当作一个QLineEdit 用作输入。OComboBox 除了显示可见下拉列表外,每个…...

Sqlserver_Oracle_Mysql_Postgresql不同关系型数据库之主从延迟的理解和实验
关系型数据库主从节点的延迟是否和隔离级别有关联,个人认为两者没有直接关系,主从延迟在关系型数据库中一般和这两个时间有关:事务日志从主节点传输到从节点的时间事务日志在从节点的应用时间 事务日志从主节点传输到从节点的时间࿰…...

Clickhouse学习系列——一条SQL完成gourp by分组与不分组数值计算
笔者在近一两年接触了Clickhouse数据库,在项目中也进行了一些实践,但一直都没有一些技术文章的沉淀,近期打算做个系列,通过一些具体的场景将Clickhouse的用法进行沉淀和分享,供大家参考。 首先我们假设一个Clickhouse数…...

做好“关键基础设施提供商”角色,亚马逊云科技加快生成式AI落地
一场关于生产力的革命已在酝酿之中。全球管理咨询公司麦肯锡在最近的报告《生成式人工智能的经济潜力:下一波生产力浪潮》中指出,生成式AI每年可能为全球经济增加2.6万亿到4.4万亿美元的价值。在几天前的亚马逊云科技纽约峰会中,「生成式AI」…...

如何使用 ChatGPT 规划家居装修
你正在计划家庭装修项目,但不确定从哪里开始?ChatGPT 随时为你提供帮助。从集思广益的设计理念到估算成本,ChatGPT 可以简化你的家居装修规划流程。在本文中,我们将讨论如何使用 ChatGPT 有效地规划家居装修,以便你的项…...

题解 | #1002.Random Nim Game# 2023杭电暑期多校7
1002.Random Nim Game 诈骗博弈题 题目大意 Nim是一种双人数学策略游戏,玩家轮流从不同的堆中移除棋子。在每一轮游戏中,玩家必须至少取出一个棋子,并且可以取出任意数量的棋子,条件是这些棋子都来自同一个棋子堆。走最后一步棋…...

篇九:组合模式:树形结构的力量
篇九:“组合模式:树形结构的力量” 开始本篇文章之前先推荐一个好用的学习工具,AIRIght,借助于AI助手工具,学习事半功倍。欢迎访问:http://airight.fun/。 另外有2本不错的关于设计模式的资料,…...

【注册表】windows系统注册表常用修改方案
文章目录 ◆ 修改IE浏览器打印页面参数设置◆气泡屏幕保护◆彩带屏幕保护程序◆过滤IP(适用于WIN2000)◆禁止显示IE的地址栏◆禁止更改IE默认的检查(winnt适用)◆允许DHCP(winnt适用)◆局域网自动断开的时间(winnt适用)◆禁止使用“重置WEB设置”◆禁止更…...

ant-design-vue 4.x升级问题-样式丢失问题
[vue] ant-design-vue 4.x升级问题-样式丢失问题 项目环境问题场景解决方案 该文档是在升级ant-design-vue到4.x版本的时候遇到的问题 项目环境 "vue": "^3.3.4", "ant-design-vue": "^4.0.0", "vite": "^4.4.4&quo…...

【果树农药喷洒机器人】Part3:变量喷药系统工作原理介绍
本专栏介绍:免费专栏,持续更新机器人实战项目,欢迎各位订阅关注。 关注我,带你了解更多关于机器人、嵌入式、人工智能等方面的优质文章! 文章目录 一、变量喷药系统工作原理二、液压通路设计与控制系统封装2.1液压通路…...

GoogLeNet创新点总结
GoogLeNet是一种深度卷积神经网络架构,于2014年由Google团队提出,是ILSVRC(ImageNet Large Scale Visual Recognition Challenge)比赛的冠军模型,其创新点主要集中在以下几个方面: Inception模块&#…...

不同路径1、2、3合集(980. 不同路径 III)
不同路径一 矩形格,左上角 到 右下角。 class Solution {int [] directX new int[]{-1,1,0,0};int [] directY new int[]{0,0,-1,1};int rows;int cols;public int uniquePathsIII(int[][] grid) {if (grid null || grid.length 0 || grid[0].length 0) {ret…...

【云原生】Yaml文件详解
目录 一、YAML 语法格式1.1查看 api 资源版本标签1.2 写一个yaml文件demo1.3 详解k8s中的port 一、YAML 语法格式 Kubernetes 支持 YAML 和 JSON 格式管理资源对象JSON 格式:主要用于 api 接口之间消息的传递YAML格式:用于配置和管理,YAML 是…...

ffmpeg下载安装教程
ffmpeg官网下载地址https://ffmpeg.org/download.html 这里以windows为例,鼠标悬浮到windows图标上,再点击 Windows builds from gyan.dev 或者直接打开 https://www.gyan.dev/ffmpeg/builds/ 下载根据个人需要下载对应版本 解压下载的文件,并复制bin所在目录 新打开一个命令…...

uniapp之当你问起“tab方法触发时eventchange也跟着触发了咋办”时
我相信没有大佬会在这个问题上卡两个小时吧,记下来大家就当看个乐子了。 当时问题就是,点击tab头切换的时候,作为tab滑动事件的eventchange同时触发了,使得接口请求了两次 大概是没睡好,我当时脑子老想着怎么阻止它冒…...

TS 踩坑之路(四)之 Vue3
一、在使用定义默认值withDefaults和defineProps 组合时,默认值设置报错 代码案例 报错信息 不能将类型“{ isBackBtn: false; }”分配给类型“(props: PropsType) > RouteMsgType”。 对象字面量只能指定已知属性,并且“isBackBtn”不在类型“(pro…...

【音视频】edge与chrome在性能上的比较
目录 结论先说 实验 结论 实验机器的cpu配置 用EDGE拉九路编辑 google拉五路就拉不出来了 资源使用情况 edge报错编辑 如果服务器端 性能也满 了,就会不回复;验证方式 手动敲 8081,不回应。 结论先说 实验 用chrome先拉九路&#…...