导语
本文主要整理和翻译自Open AI官网博客内容,用于了解Open AI官方对o1的描述和定位。综合了如下博客:
要点总结
- 通过增加训练时间和测试时间,o1模型的性能表现都可以持续提升
- 解码时的思维链对复杂推理很有帮助
- 使用思维链为安全性和对齐带来了显著的进展
- o1模型决定不向用户展示原始的思维链
学习与大语言模型进行推理
OpenAI o1是一种新的大型语言模型,它通过强化学习进行训练,以执行复杂的推理。o1 在回答之前会进行思考——它能够在回应用户之前产生一系列内部思维链(Chain-of-thought)。o1在编程竞赛(Codeforces)中排名第89百分位,在美国数学奥林匹克(AIME)的预选赛中名列全国前500名,并在物理、生物和化学问题(GPQA)的基准测试中超过了人类博士水平的准确性。尽管将这个新模型变得像当前模型一样易于使用的工作仍在进行中,目前已发布此模型的早期版本 OpenAI o1-preview,供 ChatGPT 和受信任的 API 用户立即使用。
OpenAI的规模化强化学习算法教会模型如何在高效的数据训练过程中以有效的思维链进行思考。研究者发现,o1 的性能随着更多的强化学习(训练时计算)和更多的思考时间(测试时计算)而持续改善。这种方法的扩展约束与 LLM 预训练的约束有显著不同,研究者正在继续对此进行研究。
如上图所示,可以看到,通过训练时间和测试时间的增加,o1模型的性能表现都可以光滑的提升。
评估
为了突出 o1 在推理方面相较于 GPT-4o 的提升,研究者在多种人类考试和机器学习基准测试中对模型进行了测试。结果显示,o1 在绝大多数重推理任务中显著优于 GPT-4o(除非另有说明,否则都是指在最大测试时间计算设置下评估了 o1)。
在许多重推理基准测试中,o1 的表现与人类专家相当。最近的前沿模型在 MATH 和 GSM8K 上表现优异,以至于这些基准测试已不再有效地区分模型。本文在 AIME 上评估了数学表现,这是一个旨在挑战美国最优秀高中数学学生的考试。在 2024 年 AIME 考试中,GPT-4o 平均只解决了 12%(1.8/15)的题目,而 o1 平均解决了 74%(11.1/15),在 64 个样本的共识下为 83%(12.5/15),当对 1000 个样本进行重新评分时,得分达到 93%(13.9/15)。13.9 的得分使其达到全国前 500 名的水准,并超过了美国数学奥林匹克的分数线。
本文还在 GPQA diamond 上评估了 o1,这是一个测试化学、物理和生物学专业知识的困难智能基准。为了将模型与人类进行比较,本文招募了拥有博士学位的专家来回答 GPQA-diamond 问题。结果发现,o1 超越了这些人类专家的表现,成为第一个在该基准上取得此成就的模型。这些结果并不意味着 o1 在所有方面都比博士更强,仅表明该模型在解决一些博士预期能解决的问题上更为熟练。在其他多个机器学习基准上,o1 也超越了现有的最先进水平。启用视觉感知能力后,o1 在 MMMU 上得分 78.2%,成为第一个与人类专家竞争的模型。此外,在 57 个 MMLU 子类别中,o1 在 54 个类别上优于 GPT-4o。
思维链
类似于人类在回答困难问题之前可能会长时间思考,o1 在解决问题时也会使用思维链。通过强化学习,o1 学会了磨练其思维链并精炼所使用的策略。它学会了识别并纠正自己的错误,学会了将复杂的步骤分解为更简单的步骤。当当前方法不奏效时,它也会尝试不同的解决方案。这一过程显著提升了模型的推理能力。为了展示这一进步,以下展示了 o1-preview 在若干困难问题上的思维链。
示例1:密码
- 用户输入:
oyfjdnisdr rtqwainr acxz mynzbhhx -> Think step by step
Use the example above to decode:
oyekaijzdf aaptcg suaokybhai ouow aqht mynznvaatzacdfoulxxz
- GPT-4o输出:
Let’s break this down step by step based on the example:
1. Example given:
• Input: oyfjdnisdr rtqwainr acxz mynzbhhx
• Output: **Think step by step**
By examining the words:
• The pattern involves selecting specific letters or transforming them.
2. Now, let’s decode the new phrase:
• Input: oyekaijzdf aaptcg suaokybhai ouow aqht mynznvaatzacdfoulxxz
**Step-by-step decoding process:**
**Identify possible word divisions.**
The first phrase might follow the same structure as the example. It seems like the input text could be broken into groups based on natural separations or patterns.
A possible division could be:
- oyekaijzdf
- aaptcg
- suaokybhai
- ouow
- aqht
- mynznvaatzacdfoulxxz
However, to make a meaningful decoding, I would need more context about the transformations or letter shifting that might be involved.
Could you provide any additional decoding rules or transformations used in this cipher?
2. OpenAI o1-preview(经过5s思考后)的输出:
To decode the given ciphertext using the example provided, we’ll use the pattern identified in the example.
**Ciphertext Example:**
oyfjdnisdr rtqwainr acxz mynzbhhx
**Decoded as:**
Think step by step
**Decoding Method:**
1. **Pair the letters** in the ciphertext.
2. **Convert each letter to its numerical position** in the alphabet (A=1, B=2, …, Z=26).
3. **Sum the numerical values** of each pair.
4. **Compute the average** of the sum (divide by 2).
5. **Convert the average back to a letter** (1=A, 2=B, …, 26=Z).
**Apply this method to the given ciphertext:**
oyekaijzdf aaptcg suaokybhai ouow aqht mynznvaatzacdfoulxxz
**Break down the ciphertext into pairs:**
1. **First word: “oyekaijzdf”**
a. Pairs: oy, ek, ai, jz, df
b. Decoded letters:
1). oy → (15+25)/2 = 20 → T
2). ek → (5+11)/2 = 8 → H
3). ai → (1+9)/2 = 5 → E
4). jz → (10+26)/2 = 18 → R
c. df → (4+6)/2 = 5 → E
d. Decoded word: **THERE**
2. **Second word: “aaptcg”**
a. Pairs: aa, pt, cg
b. Decoded letters:
1). aa → (1+1)/2 = 1 → A
2). pt → (16+20)/2 = 18 → R
3). cg → (3+7)/2 = 5 → E
4). Decoded word: **ARE**
3. **Third word: “suaokybhai”**
a. Pairs: su, ao, ky, bh, ai
b. Decoded letters:
1). su → (19+21)/2 = 20 → T
2). ao → (1+15)/2 = 8 → H
3). ky → (11+25)/2 = 18 → R
4). bh → (2+8)/2 = 5 → E
5). ai → (1+9)/2 = 5 → E
c. Decoded word: **THREE**
4. **Fourth word: “ouow”**
a. Pairs: ou, ow
b. Decoded letters:
1). ou → (15+21)/2 = 18 → R
2). ow → (15+23)/2 = 19 → S
c. Decoded letters: **R’S**
5. **Fifth word: “aqht”**
a. Pairs: aq, ht
b. Decoded letters:
1). aq → (1+17)/2 = 9 → I
2). ht → (8+20)/2 = 14 → N
c. Decoded word: **IN**
6. **Sixth word: “mynznvaatzacdfoulxxz”**
a. Pairs: my, nz, nv, aa, tz, ac, df, ou, lx, xz
b. Decoded letters:
1). my → (13+25)/2 = 19 → S
2). nz → (14+26)/2 = 20 → T
3). nv → (14+22)/2 = 18 → R
4). aa → (1+1)/2 = 1 → A
5). tz → (20+26)/2 = 23 → W
6). ac → (1+3)/2 = 2 → B
7). df → (4+6)/2 = 5 → E
8). ou → (15+21)/2 = 18 → R
9). lx → (12+24)/2 = 18 → R
10). xz → (24+26)/2 = 25 → Y
c. Decoded word: **STRAWBERRY**
**Final Decoded Message:**
THERE ARE THREE R'S IN STRAWBERRY
**Answer:
**THERE ARE THREE R’S IN STRAWBERRY
示例2:编码
- 用户输入:
Write a bash script that takes a matrix represented as a string with format '[1,2],[3,4],[5,6]' and prints the transpose in the same format.
- GPT-4o输出:
Here’s a bash script that takes a matrix represented as a string in the format "[1,2],[3,4],[5,6]" and prints its transpose in the same format:
#!/bin/bash
# Input matrix as a string
matrix_string=$1
# Remove square brackets
matrix_string=$(echo "$matrix_string" | tr -d '[]')
# Convert the string into an array of rows
IFS=',' read -r -a rows <<< "$matrix_string"
# Get the number of columns (length of the first row)
num_columns=$(echo "${rows[0]}" | awk -F',' '{print NF}')
# Initialize an array for the transpose
declare -a transpose
# Loop over each column
for ((i=0; i<num_columns; i++)); do
column=()
# Loop over each row and extract the i-th element
for ((j=0; j<${#rows[@]}; j+=num_columns)); do
element=${rows[$((j+i))]}
column+=("$element")
done
# Join the elements of the column with commas
transpose+=("[$(IFS=','; echo "${column[*]}")]")
done
# Print the transpose as a matrix
echo "$(IFS=','; echo "${transpose[*]}")"
**How to use the script:**
1. Save the script to a file, e.g., transpose_matrix.sh.
2. Make the script executable:
chmod +x transpose_matrix.sh
3. Run the script with the matrix string as an argument:
./transpose_matrix.sh "[1,2],[3,4],[5,6]"
**Expected Output:**
For the input "[1,2],[3,4],[5,6]", the script should output:
[1,3,5],[2,4,6] ❌
This output represents the transposed matrix.
- OpenAI o1-preview(经过5s思考后)的输出:
#!/bin/bash
input="$1"
# Remove any spaces
input="${input// /}"
# Split input into rows
IFS=']' read -ra rows <<< "$input"
# Initialize an array to hold the matrix
declare -a matrix
num_rows=0
for row in "${rows[@]}"; do
# Remove leading commas and brackets
row="${row#','}"
row="${row#'['}"
row="${row//]/}"
# Skip empty rows
if [ -z "$row" ]; then
continue
fi
# Split row into elements
IFS=',' read -ra elements <<< "$row"
# Store elements in matrix
matrix[$num_rows]="${elements[*]}"
((num_rows++))
done
# Number of columns (assuming at least one row)
IFS=' ' read -ra first_row_elements <<< "${matrix[0]}"
num_cols=${#first_row_elements[@]}
# Prepare an array to hold the transposed matrix
declare -a transposed
# For each column c
for (( c=0; c<$num_cols; c++ )); do
col_elements=()
# For each row r
for (( r=0; r<$num_rows; r++ )); do
# Get elements of row r
IFS=' ' read -ra row_elements <<< "${matrix[$r]}"
col_elements+=("${row_elements[$c]}")
done
# Store the column elements as a row in transposed matrix
transposed[$c]="${col_elements[*]}"
done
# Build output string
output=""
for (( i=0; i<${#transposed[@]}; i++ )); do
IFS=' ' read -ra elements <<< "${transposed[$i]}"
# Build a string '[elem1,elem2,...]'
row_string="[${elements[0]}"
for (( j=1; j<${#elements[@]}; j++ )); do
row_string="$row_string,${elements[$j]}"
done
row_string="$row_string]"
if [ -z "$output" ]; then
output="$row_string"
else
output="$output,$row_string"
fi
done
echo "$output"
这里只展示2个例子,更多的示例可以参考原博客。可以看到,o1的输出尽管速度不如GPT-4o,但是回答的思考深度提升了非常多的层次,给出了“深思熟虑”后的正确解答。
代码
研究者训练了一个模型,该模型在 2024 年国际信息学奥林匹克(IOI)中得分 213 分,排名第 49 百分位。这个模型以 o1 为基础进行初始化,并进一步训练以提升编程技能。它在 2024 年 IOI 中以与人类选手相同的条件进行竞争,解决六个具有挑战性的算法问题,时间为十小时,每个问题允许提交 50 次。
对于每个问题,o1系统从多个候选提交中进行抽样,并根据测试时间选择策略提交 50 个。提交的选择基于 IOI 公共测试用例的表现、模型生成的测试用例和学习到的评分函数。如果随机提交,平均得分仅为 156 分,这表明在竞争约束下,这一策略赢得了近 60 分。
在放宽提交约束后,本文发现模型的表现显著改善。当每个问题允许 10,000 次提交时,该模型得分达到 362.14,超过了金牌门槛,即使没有任何测试时间选择策略。
最后,本文模拟了由 Codeforces 主办的编程竞赛,以展示该模型的编码能力。评估严格遵循竞赛规则,并允许提交 10 次。GPT-4o 的 Elo 评分为 808,位于人类竞争者的第 11 百分位。而o1模型的 Elo 评分达到了 1807,远超 GPT-4o,表现优于 93% 的竞争者。
人类偏好评估
除了考试和学术基准外,本文还在广泛领域的挑战性开放式提示中评估了 o1-preview 与 GPT-4o 的人类偏好。在这项评估中,人类训练员查看了 o1-preview 和 GPT-4o 对同一提示的匿名回应,并投票选择他们更喜欢的回应。在数据分析、编码和数学等重推理类别中,o1-preview 明显优于 GPT-4o。然而,在某些自然语言任务中,o1-preview 的偏好度较低,这表明它并不适合所有用例。
安全性
思维链推理为对齐和安全性提供了新的机会。实验发现,将模型行为的政策整合到推理模型的思维链中是一种有效的方法,可以稳健地传授人类的价值观和原则。通过教导模型安全规则及其在上下文中的推理方式,研究者发现推理能力直接提升了模型的稳健性:o1-preview 在关键的越狱评估和最困难的内部基准测试中表现显著改善,以评估模型的安全拒绝边界。本文认为,使用思维链为安全性和对齐带来了显著的进展,因为(1)它使研究者能够以清晰的方式观察模型的思维过程,且(2)模型对安全规则的推理在面对分布外场景时更加稳健。
为了检验模型的改进效果,研究者在部署前根据框架进行了系列安全测试和红队评估。实验发现,思维链推理在评估中有助于能力提升。特别值得注意的是,本文观察到了一些有趣的奖励黑客实例。有关这些评估的详细结果可以在随附的系统卡中找到。
隐藏思维链
本文认为隐藏的思维链为监控模型提供了独特的机会。假设它是忠实和清晰的,隐藏的思维链使研究者能够“读取”模型的思维过程,理解其思考方式。例如,未来可能希望监控思维链,以查找操纵用户的迹象。然而,要实现这一点,模型必须能够以未修改的形式自由表达其思想,因此无法在思维链上训练任何政策合规性或用户偏好。同时,研究者也不希望让未对齐的思维链直接展现在用户面前。
因此,在权衡包括用户体验、竞争优势和监控思维链的选项等多个因素后,o1模型决定不向用户展示原始的思维链。本文承认这一决定存在缺点,并努力通过教导模型在答案中重现思维链中的任何有用想法来部分弥补这一缺陷。对于 o1 模型系列,本文展示了模型生成的思维链摘要。
结论
o1 在人工智能推理方面显著推动了技术的进步吧并计划在持续迭代的过程中发布改进版本。本文预期这些新的推理能力将提升模型与人类价值观和原则对齐的能力。本文相信,o1 及其后续版本将为科学、编程、数学及相关领域的人工智能开启许多新的用例。期待用户和 API 开发者发现它如何改善他们的日常工作。
附录A
| Dataset | Metric | gpt-4o | o1-preview | o1 |
|---|---|---|---|---|
| Competition Math | cons@64 | 13.4 | 56.7 | 83.3 |
| pass@1 | 9.3 | 44.6 | 74.4 | |
| Competition Code | Elo | 808 | 1,258 | 1,673 |
| Percentile | 11.0 | 62.0 | 89.0 | |
| GPQA Diamond | cons@64 | 56.1 | 78.3 | 78.0 |
| pass@1 | 50.6 | 73.3 | 77.3 | |
| Biology | cons@64 | 63.2 | 73.7 | 68.4 |
| pass@1 | 61.6 | 65.9 | 69.2 | |
| Chemistry | cons@64 | 43.0 | 60.2 | 65.6 |
| pass@1 | 40.2 | 59.9 | 64.7 | |
| Physics | cons@64 | 68.6 | 89.5 | 94.2 |
| pass@1 | 59.5 | 89.4 | 92.8 | |
| MATH | pass@1 | 60.3 | 85.5 | 94.8 |
| MMLU | pass@1 | 88.0 | 92.3 | 90.8 |
| MMMU (val) | pass@1 | 69.1 | n/a | 78.2 |
| MathVista (testmini) | pass@1 | 63.8 | n/a | 73.9 |