Stephen Wolfram:概率从何而来?

news2024/10/10 2:21:51

Where Do the Probabilities Come From?

概率从何而来?

OK, so ChatGPT always picks its next word based on probabilities. But where do those probabilities come from? Let’s start with a simpler problem. Let’s consider generating English text one letter (rather than word) at a time. How can we work out what the probability for each letter should be?

好的,ChatGPT 总是根据概率选择下一个词。但这些概率是从哪里来的呢?让我们从一个更简单的问题开始。考虑每次生成英文文本一个字母(而不是单词)。我们如何计算每个字母的概率呢?

A very minimal thing we could do is just take a sample of English text, and calculate how often different letters occur in it. So, for example, this counts letters in the Wikipedia article on “cats”:

最简单的方法是只需取一段英文文本样本,然后计算不同字母出现的频率。例如,这是统计维基百科关于“猫”的文章中不同字母出现的次数:

60c92069adf17ed22ed10450493e21aa.png

And this does the same thing for “dogs”:

这是关于“狗”的文章中做的字母计数:

e055571fc3593c2b1e0a4c7334e19a3b.png

The results are similar, but not the same (“o” is no doubt more common in the “dogs” article because, after all, it occurs in the word “dog” itself). Still, if we take a large enough sample of English text we can expect to eventually get at least fairly consistent results:

结果是相似的,但不完全相同(毫无疑问 “o”在关于“狗”的文章中更常见,因为毕竟它出现在单词“dog”中)。但是,如果我们取足够大的英文文本样本,我们可以预期最终得到至少相对一致的结果:

e987b38fe3e06fc42eebb01c58dd337b.png

Here’s a sample of what we get if we just generate a sequence of letters with these probabilities:

这是我们根据这些概率生成字母序列的示例:

0bc520f1e06d5e419f6e645ee4060647.png

We can break this into “words” by adding in spaces as if they were letters with a certain probability:

我们可以通过添加空格作为字母的一种形式来将其分割成“单词”:

6c7091a41e620bf454133aadcaca5236.png

We can do a slightly better job of making “words” by forcing the distribution of “word lengths” to agree with what it is in English:

我们可以通过强制“单词长度”的分布与英文一致,进一步改进“单词”的生成:

2a0fd985c0d2283163f10fc8077f847f.png

We didn’t happen to get any “actual words” here, but the results are looking slightly better. To go further, though, we need to do more than just pick each letter separately at random. And, for example, we know that if we have a “q”, the next letter basically has to be “u”.

这里没有得到“实际单词”,但结果看起来稍微好一些。然而,要进一步,我们需要比仅随机选择每个字母要多做些事情。例如,我们知道如果有一个“q”,下一个字母基本上必须是“u”。

Here’s a plot of the probabilities for letters on their own:

这是字母概率图表:

c51687fd37d9f845079077f40de562eb.png

And here’s a plot that shows the probabilities of pairs of letters (“2-grams”) in typical English text. The possible first letters are shown across the page, the second letters down the page:

这是显示一对字母(“2-grams”)在典型英文文本中的概率的图表。可能的第一个字母显示在页面上方(横坐标),第二个字母显示在页面下方(纵坐标):

03ccae7701290277a8a6c6412a98e98b.png

And we see here, for example, that the “q” column is blank (zero probability) except on the “u” row. OK, so now instead of generating our “words” a single letter at a time, let’s generate them looking at two letters at a time, using these “2-gram” probabilities. Here’s a sample of the result—which happens to include a few “actual words”:

我们可以看到,例如,“q”列是空白的(概率为零),除了“u”行。好的,现在,我们不是每次仅随机生成一个字母,而是同时查看两个字母,使用这些“2-gram”概率来生成我们的“单词”。这是结果的一个示例,其中包括一些“实际单词”:

42844133bbd60a51affb7d5ebc9fe5af.png

With sufficiently much English text we can get pretty good estimates not just for probabilities of single letters or pairs of letters (2-grams), but also for longer runs of letters. And if we generate “random words” with progressively longer n-gram probabilities, we see that they get progressively “more realistic”:

通过足够多的英文文本,我们不仅可以得到单个字母或一对字母(2-grams)的概率的相当好的估计,还可以得到更长的字母序列的估计。如果我们使用越来越长的 n-gram 概率生成“随机单词”,我们会发现它们变得“更真实”:

2a236765b7a285ad9e2af9e2464b527d.png

But let’s now assume—more or less as ChatGPT does—that we’re dealing with whole words, not letters. There are about 40,000 reasonably commonly used words in English. And by looking at a large corpus of English text (say a few million books, with altogether a few hundred billion words), we can get an estimate of how common each word is. And using this we can start generating “sentences”, in which each word is independently picked at random, with the same probability that it appears in the corpus. Here’s a sample of what we get:

但是现在让我们假设——就像 ChatGPT 一样——我们处理的是整个单词,而不是字母。英语中有大约 40,000 个常用词汇。通过查看大量的英语文本语料库(比如几百亿个单词的数百万本书),我们可以估计每个词汇的常见程度。根据这个,我们可以开始生成“句子”,其中每个词汇都是独立地随机选择的,其概率与它在语料库中出现的概率相同。这是我们得到的一个示例:

42b3507008d279d5c5a5d8ca7ca3b581.png

Not surprisingly, this is nonsense. So how can we do better? Just like with letters, we can start taking into account not just probabilities for single words but probabilities for pairs or longer n-grams of words. Doing this for pairs, here are 5 examples of what we get, in all cases starting from the word “cat”:

不出所料,这是无意义的。那么我们该怎么做得更好呢?就像字母一样,我们可以开始考虑不仅仅是单词的概率,还有一对或更长的单词 n-grams 的概率。在考虑了一对单词后,以下是我们得到的5个示例,所有示例均从单词“cat”开始:

50b74e24bf73b3a6a6ce53d6b03eeea7.png

It’s getting slightly more “sensible looking”. And we might imagine that if we were able to use sufficiently long n-grams we’d basically “get a ChatGPT”—in the sense that we’d get something that would generate essay-length sequences of words with the “correct overall essay probabilities”. But here’s the problem: there just isn’t even close to enough English text that’s ever been written to be able to deduce those probabilities.

这看起来稍微更加“合理”。我们可以想象,如果我们能够使用足够长的 n-grams,我们基本上会“得到一个 ChatGPT”——在这个意义上,我们会得到一个可以生成具有“正确整体概率”的文章长度的单词序列。但问题在于:已经没有足够的英文文本被书写出来,可以推断出这些概率。

In a crawl of the web there might be a few hundred billion words; in books that have been digitized there might be another hundred billion words. But with 40,000 common words, even the number of possible 2-grams is already 1.6 billion—and the number of possible 3-grams is 60 trillion. So there’s no way we can estimate the probabilities even for all of these from text that’s out there. And by the time we get to “essay fragments” of 20 words, the number of possibilities is larger than the number of particles in the universe, so in a sense they could never all be written down.

在网页中爬行可能会有几百亿个单词;在数字化的书籍中可能有另外几百亿个单词。但是,对于 40,000 个常见单词,甚至可能的 2-grams 数量已经达到 16 亿,而可能的 3-grams 数量为 60 万亿。因此,我们无法从已有的文本中估计出所有这些概率。当我们到达 20 个单词的“文章片段”时,可能性的数量已超过宇宙中粒子的数量,因此在某种意义上,它们永远不可能全部被写下来。

So what can we do? The big idea is to make a model that lets us estimate the probabilities with which sequences should occur—even though we’ve never explicitly seen those sequences in the corpus of text we’ve looked at. And at the core of ChatGPT is precisely a so-called “large language model” (LLM) that’s been built to do a good job of estimating those probabilities.

那么我们该怎么办呢?一个重要的想法是创建一个模型,让我们能够估计序列出现的概率——即使我们从未在查看过的文本语料库中明确看到过这些序列。ChatGPT 的核心正是一个被称为“大型语言模型(LLM)的模型,它的目标就是要能够很好地估计这些概率。

3d772edd68075684f71e703b1011d00f.jpeg

“点赞有美意,赞赏是鼓励”

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/790531.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Palo Alto Networks 智能网络安全保护任何地方的用户、应用和数据

Palo Alto Networks 不仅能够为数字企业提供当下所需的网络安全服务,还能为日后的工作打好安全基础,让企业无需在二者间权衡和纠结,这样的网络安全合作伙伴仅此一家。我们承诺将双管齐下,在保障数字企业的安全方面绝不妥协退让。下…

linux barrier 栅栏屏障,让多任务在栅栏处集合,全部到齐后同时出发

​专栏内容: postgresql内核源码分析 手写数据库toadb 并发编程 个人主页:我的主页 座右铭:天行健,君子以自强不息;地势坤,君子以厚德载物. 概述 pthread_barrier_t 这是posix定义线程同步方法&#xff0…

Windows电脑应用设置开机自启动

背景 比如我们程序员,开机就想电脑自启动谷歌浏览器和VS Code等开发工具,自己什么都不用动,怎么办?有人说可以在任务管理器的启动里设置,但还是有些工具里面没有的,也就是不能这样设置的,今天教…

Windows环境下git客户端中的git-bash和MinGW64

我们在 Windows10 操作系统下,安装了 git 客户端之后,可以通过 git-bash.exe 打开一个 shell: 执行一些 linux 系统里的命令: 注意到上图紫色的 MINGW64. Mingw-w64 是原始 mingw.org 项目的改进版,旨在支持 Window…

数据结构【线性表】

数据结构入门级 第二章 线性表 一、线性表的定义和基本操作 线性表的定义:具有相同属性数据类型的数据元素组成的一个有限序列;除第一个元素外的元素都有直接前驱,除最后一个元素外的元素都有直接后继;存在一个唯一被称为“第一个…

【ARM Coresight 系列文章 10.3 - ARM Coresight STM 寄存器介绍 及STM DMA 传输介绍】

文章目录 STM Register summarySTM DMA 相关的寄存器DMA TransferBurst requestSingle and burst request STM Register summary STM 的寄存器主要可以分为以下几类: STM DMA 相关的;STM HW Trigger 相关的;系统控制及状态寄存器&#xff1…

CSS布局定位+装饰

一、定位 1.1 网页常见布局方式 1. 标准流 1. 块级元素独占一行 → 垂直布局 2. 行内元素/行内块元素一行显示多个 → 水平布局 2. 浮动 1. 可以让原本垂直布局的 块级元素变成水平布局 3. 定位 1. 可以让元素自由的摆放在网页的任意位置 2. 一般用于 盒子之间的层叠情…

Java的运行时数据区域

Java 虚拟机在执行 Java 程序的过程中会把它所管理的内存划分为若干个不同的数据区域。这些区域有各自的用途,以及创建和销毁的时间,有些区域随着虚拟机进程的启动而一直存在,有些区域则是依赖用户线程的启动和结束而建立和销毁。 根据《Jav…

OpenAI宣布安卓版ChatGPT正式上线;一站式 LLM底层技术原理入门指南

🦉 AI新闻 🚀 OpenAI宣布安卓版ChatGPT正式上线 摘要:OpenAI今日宣布,安卓版ChatGPT已正式上线,目前美国、印度、孟加拉国和巴西四国的安卓用户已可在谷歌Play商店下载,并计划在下周拓展到更多地区。Chat…

VMware Network Adapter VMnet1和VMnet8 未识别的网络问题

在安装虚拟机的时候使用的网络类型未NAT模式,但是却无法和外部网络ping通,并且使用Xshell进行连接反应也非常慢;于是在我查询半天问题之后,这个问题得到了解决,具体如下: 在使用NAT网络模式的时候需要进行…

【portswigger】第二专题-XSS(二)

portswigger 靶场(第二章节)XSS 视频同步更新至bilibili bibi地址欢迎关注微信公众号:微光安全团队 这是官方备忘录: https://portswigger.net/web-security/cross-site-scripting/cheat-sheet总体目录 我这里简单总结一下每个…

nodejs+vue+elementui高校科研队伍管理系统_2byeq

系统阐述的是使用科研管理系统,对于nodejs、B/S结构、MySql进行了较为深入的学习与应用。主要针对系统的设计,描述,实现和分析与测试方面来表明开发的过程。开发中使用了vue框架和MySql数据库技术搭建系统的整体架构。利用这些技术结合实际需…

【Haclon】Liunx每个月过期了怎么使用

Liunx每个月过期怎么使用 1.去gitHub进行下载2. 下载最新的Halcon_licenses3.进行替换 1.去gitHub进行下载 https://github.com/lovelyyoshino/Halcon_licenses 2. 下载最新的Halcon_licenses sudo vim ~/.bashrc找到/opt/halcon 3.进行替换 /opt/halcon/license 将这个目…

百万数据分页查询优化方案

分页问题 分页列表查询是项目中的热点需求,这种需求的特点是:字段多、数据量大、访问频繁、使用率高的特点,这个功能是给用户最直观的展示系统的信息,针对于多、大、频、热这几个特点,会引申出一个问题:列…

swmm模型城市内涝一维二维耦合;海绵城市+SWMM完整版教程

随着计算机的广泛应用和各类模型软件的发展,将排水系统模型作为城市洪灾评价与防治的技术手段已经成为防洪防灾的重要技术途径。本次将聚焦于综合利用GIS及CAD等工具高效地进行大规模城市排水系统水力模型的建立,利用SWMM实现排水系统水力模拟。讲解SWMM…

el-table 表格头部合并

<el-table v-loading"listLoading" :key"tableKey" :data"list" stripe border fit highlight-current-rowstyle"width: 100%;" size"mini"><el-table-column label"第一行" align"center">…

Windows 安装 Redis5

Windows 安装 Redis5 安装包 Redis for Windows 5.0.14.1 https://github.com/tporadowski/redis/releases/tag/v5.0.14.1 安装教程 选择安装路径&#xff0c;并勾选下方&#xff0c;将 Redis 添加到系统环境变量 这个是 Redis 默认的端口号&#xff0c;无特殊需求不用改 设置…

ES6 模块编程(新思路方便复习笔记)

文章目录 ES6 模块编程(新思路方便复习笔记)介绍需求说明思路分析/图解代码实现创建common.js创建use_common.js 其它导出形式--直接导出创建common2.js创建use_common2.js 其它导出形式--默认导出创建common3.js创建use_common3.js--导入默认导出模块/数据注意事项和使用细节导…

毓恬冠佳冲刺上市:打破汽车天窗外商垄断,长安汽车为其主要客户

撰稿|行星 来源|贝多财经 7月23日&#xff0c;上海毓恬冠佳科技股份有限公司&#xff08;以下简称“毓恬冠佳”&#xff09;在深圳证券交易所的审核状态变更为“已问询”。据贝多财经了解&#xff0c;毓恬冠佳于2023年6月27日递交招股书&#xff0c;准备在创业板上市。 本次冲…

十一、数据结构——树(Tree)的基本概念

数据结构之树(Tree) 目录 树的基本概念树的分类树的基本操作树的应用结语 树的基本概念 树是一种重要的数据结构&#xff0c;它在计算机科学中被广泛应用。树的特点是以分层的方式存储数据&#xff0c;具有层次结构&#xff0c;类似于现实生活中的树状结构。在树中&#xff…