Chapter 36
8. 思维骨架提示
第八章 思维骨架提示
一、引言
人类如何高效地回答问题?我们并不总是按顺序思考问题,然后给出答案。相反,我们通常会首先根据一些策略为各种类型的问题构建一个思考的框架,然后在此基础上添加细节以进一步阐述。在提供咨询、参加考试或撰写论文等正式场合中,这一点尤其重要。我们能否让大语言模型(Large Language Models, LLMs)以这样的方式进行思考?
受人类思考和写作过程的启发,清华和微软的研究者提出了「思维骨架」(Skeleton of Thought,SoT)。SoT 是以数据为中心优化推理效率的初步尝试,并展示了通过明确规划语言中的答案结构来获得高质量答案的潜力。相应的论文成功发表于 ICLR 2024 - Skeleton-of-Thought: Large Language Models Can Do Parallel Decoding
具体来说,我们可以引导 LLM 首先构建出一个思维骨架。在这个骨架的基础上,LLM 可以并行处理每个部分,从而提高处理速度。SoT 不仅可以用于加速开源模型的分批解码,还可以用于加速闭源模型的并行 API 调用。下面是思维骨架 (SoT) 的示意图。
(1)SoT 并不是按顺序生成答案,而是并行地生成答案的不同部分。
(2)更具体地说,当问题给定时,SoT 会首先引导 LLM 构建思维骨架,然后进行批量解码或并行 API 调用以并行扩展多个要点,最后汇总输出结果以得出最终答案。
(3)需要注意的是,目前的 SoT 适用于需要较长答案的问题,这些问题的结构可以提前规划,但不适用于需要逐步推理或只需要简短答案的问题。
本章将详细介绍思维骨架提示。我们将深入阐述关键原理,并提供实际的代码示例,以帮助读者全面理解并掌握思维骨架提示 的关键原理和实际应用。阅读本章后,读者将能够更专业、准确地理解和应用思维骨架提示。
二、思维骨架提示
注意:我使用的测试环境是 UV + Python3.12+。Python 的版本要求 Python3.12+。
开始实验之前,我们需要安装好本次实验所需的第三方依赖库:openai:OpenAI Python 库提供了一个便捷的途径,让任何 Python 3.7+ 应用程序可以访问 OpenAI REST API。
导入此次实验所需的依赖库
import os
import re
from dotenv import load_dotenv, find_dotenv
from openai import OpenAI
from concurrent.futures import ThreadPoolExecutor
loaded = load_dotenv(find_dotenv(), override=True)
# 从环境变量中获取 OpenAI API Key 或者直接赋值
API_KEY = os.getenv("API_KEY")
# 如果您使用的是官方 API,就直接用 https://api.siliconflow.cn/v1 就行。
BASE_URL = "https://api.siliconflow.cn/v1"
# 如果您使用的不是官方 API,而是通过代理进行请求,请设置您的代理 URL。
# BASE_URL = "https://api.xxx.../v1"# 实例化 OpenAI 对象
# 传入参数:OpenAI API Key(必需)、Base URL 和最大重试次数
client = OpenAI(api_key=API_KEY, base_url=BASE_URL, max_retries=3)# 参数 n,整数或 Null,可选项,默认为 1。为每条输入信息生成多少个聊天完成选项。
# 参数 temperature,实数值或 Null,可选项,默认为 1。使用的采样温度,介于 0 和 2 之间。0.8 等较高值会使输出更加随机,而 0.2 等较低值会使输出更加集中和确定。
def get_completions(llm_prompt, model_endpoint):
extra_body = {}
if "Qwen3" in model_endpoint:
extra_body={
"enable_thinking": False
}
response = client.chat.completions.create(model=model_endpoint,
messages=[
{"role": "user", "content": llm_prompt}
],
n=1, temperature=0.20, seed=42,
presence_penalty=0, frequency_penalty=0,
max_tokens=4096, extra_body = extra_body
)
return response.choices[0].message.content.strip()2.1 骨架提示模板
骨架提示阶段(配有 2-shot 演示)。我们编写骨架提示模板的目的是为了引导 LLM 输出简洁明了的答案骨架。这样,我们就可以从 LLM 的骨架响应中提取关键信息。
llm = "Qwen/Qwen3-8B"
question_Chinese = "经常锻炼有什么好处呢?"
skeleton_prompt_Chinese = f"""您是一位组织者,只负责提供回答问题的骨架(而非完整内容)。
以要点列表(编号为 1.、2.、3.等)的形式提供骨架,以回答问题。
每个要点应非常简短,只有 2∼8 个字,而不是写一个完整的句子。
一般来说,骨架应包含 3∼10 个要点。
问题:
中国菜有哪些典型类型?
骨架:
1. 饺子。
2. 面条。
3. 点心。
4. 火锅。
5. 云吞。
6. 麻婆豆腐。
7. 叉烧。
8. 炒饭。
问题:
对于个体有哪些减少碳排放的实用建议?
骨架:
1. 节约能源。
2. 高效交通。
3. 家庭能效。
4. 减少用水量。
5. 可持续饮食。
6. 可持续的旅行。
现在,请为下面的问题提供骨架。
{question_Chinese}
骨架:
"""
skeleton_result_Chinese = get_completions(skeleton_prompt_Chinese, llm)
print(f"生成的思维骨架-中文:\n{skeleton_result_Chinese}")Output
生成的思维骨架-中文: 1. 增强体质。 2. 提高免疫力。 3. 改善心情。 4. 增强心肺功能。 5. 控制体重。 6. 改善睡眠。 7. 延缓衰老。 8. 提升专注力。 9. 增强骨骼。 10. 促进代谢。
llm = "Qwen/Qwen3-8B"
question_English = "What are the benefits of regular exercise?"
skeleton_prompt_English = f"""You are an organizer responsible for only giving the skeleton (not the full content) for answering the question.\
Provide the skeleton in a list of points (numbered 1., 2., 3., etc.) to answer the question. \
Instead of writing a full sentence, each skeleton point should be very short with only 2∼6 words. \
Generally, the skeleton should have 3∼10 points.
Question:
What are the typical types of Chinese dishes?
Skeleton:
1. Dumplings.
2. Noodles.
3. Dim Sum.
4. Hot Pot.
5. Wonton.
6. Ma Po Tofu.
7. Char Siu.
8. Fried Rice.
Question:
What are some practical tips for individuals to reduce their carbon emissions?
Skeleton:
1. Energy conservation.
2. Efficient transportation.
3. Home energy efficiency.
4. Reduce water consumption.
5. Sustainable diet.
6. Sustainable travel.
Now, please provide the skeleton for the following question.
{question_English}
Skeleton:
"""
skeleton_result_English = get_completions(skeleton_prompt_English, llm)
print(f"生成的思维骨架-英文:\n{skeleton_result_English}")Output
生成的思维骨架-英文: 1. Improve health. 2. Boost mood. 3. Increase strength. 4. Enhance endurance. 5. Aid weight management. 6. Improve sleep. 7. Reduce stress. 8. Enhance flexibility. 9. Support heart health. 10. Increase lifespan.
2.2 要点展开模板
要点扩展阶段。我们基于得到的骨架,让 LLM 在每个要点上进行并行扩展。最后,当所有要点完成后,我们将各点的扩展响应连接起来,形成最终答案。
# 我们可以使用一个专门设计的正则表达式 "(\d+)\.\s?([\s\S]+?)(?=\n|\n*$)" 从骨架响应中提取要点索引和要点骨架。
key_point_skeleton_English = re.findall(r"(\d+)\.\s?([\s\S]+?)(?=\n|\n*$)", skeleton_result_English)
key_point_skeleton_Chinese = re.findall(r"(\d+)\.\s?([\s\S]+?)(?=\n|\n*$)", skeleton_result_Chinese)
print(key_point_skeleton_English)
print(key_point_skeleton_Chinese)Output
[('1', 'Improve health. '), ('2', 'Boost mood. '), ('3', 'Increase strength. '), ('4', 'Enhance endurance. '), ('5', 'Aid weight management. '), ('6', 'Improve sleep. '), ('7', 'Reduce stress. '), ('8', 'Enhance flexibility. '), ('9', 'Support heart health. '), ('10', 'Increase lifespan.')]
[('1', '增强体质。 '), ('2', '提高免疫力。 '), ('3', '改善心情。 '), ('4', '增强心肺功能。 '), ('5', '控制体重。 '), ('6', '改善睡眠。 '), ('7', '延缓衰老。 '), ('8', '提升专注力。 '), ('9', '增强骨骼。 '), ('10', '促进代谢。')]
def expand_point_English(point_data):
point_index, key_point = point_data
point_expanding_prompt = f"""You are responsible for continuing the writing of one and only one point \
in the overall answer to the following question.
{question_English}
The skeleton of the answer is:
{skeleton_result_English}
Continue and only continue the writing of point {point_index}. \
Write it accurately and concisely in 2∼4 sentences, and do not continue with other points!
"""
point_expanding = get_completions(point_expanding_prompt, llm)
return (point_index, point_expanding)
def expand_point_Chinese(point_data):
point_index, key_point = point_data
point_expanding_prompt = f"""您有责任在下面问题的总答案中续写一个且仅一个要点。
{question_Chinese}
答案的骨架是:
{skeleton_result_Chinese}
继续且仅继续书写点 {point_index}。用 4∼6 句话准确、简洁地写完,不要续写其他要点!
"""
point_expanding = get_completions(point_expanding_prompt, llm)
return (point_index, point_expanding)llm = "Qwen/Qwen3-8B"
question_Chinese = "经常锻炼有什么好处呢?"
final_result_Chinese = ""
# For 循环顺序执行
# for point_index, key_point in key_point_skeleton_Chinese:
# point_expanding_prompt = f"""您有责任在下面问题的总答案中续写一个且仅一个要点。
# {question_Chinese}
# 答案的骨架是:
# {skeleton_result_Chinese}
# 继续且仅继续书写点 {point_index}。用 3∼6 句话准确、简洁地写完,不要续写其他要点!
# """
# point_expanding = get_completions(point_expanding_prompt, llm)
# if point_index == key_point_skeleton[-1][0]:
# final_result_Chinese += f"{point_index}. {point_expanding}"
# else:
# final_result_Chinese += f"{point_index}. {point_expanding}\n"
# 使用 ThreadPoolExecutor 来并发执行 expand_point_Chinese 函数
results = []
max_workers = len(key_point_skeleton_Chinese)
with ThreadPoolExecutor(max_workers=max_workers) as executor:
results = list(executor.map(expand_point_Chinese, key_point_skeleton_Chinese))
for point_index, point_expanding in results:
# print(f"Point Index: {point_index}, Point Expanding: {point_expanding}")
if point_expanding[0].isnumeric(): # 判断有没有数字编号
pass
else:
point_expanding = f"{point_index}. {point_expanding}"
if point_index == key_point_skeleton_Chinese[-1][0]:
final_result_Chinese += f"{point_expanding}"
else:
final_result_Chinese += f"{point_expanding}\n"
print(f"要点扩展后的内容-中文:\n{final_result_Chinese}")Output
要点扩展后的内容-中文: 1. 增强体质。经常锻炼可以提高肌肉力量和耐力,促进骨骼健康,使身体更加协调灵活,从而增强整体的身体素质和运动能力。它还能改善身体的协调性和平衡感,降低受伤的风险。此外,规律的运动有助于维持健康的体重,减少慢性疾病的发生概率。 2. 提高免疫力意味着身体能够更有效地抵抗疾病和感染。经常锻炼可以促进白细胞的生成和循环,增强免疫系统的功能。此外,运动还能减少慢性炎症,降低患感冒、流感等常见疾病的风险。适度的有氧运动和力量训练都有助于提升免疫反应,使身体更加健康强壮。长期坚持锻炼的人通常比不运动的人更少生病,恢复也更快。 3. 改善心情。锻炼能够促进大脑释放内啡肽和多巴胺等“快乐激素”,有助于缓解压力、焦虑和抑郁情绪,提升整体的心理健康水平。此外,规律的运动还能增强自信心,使人更加积极乐观。对于许多人在运动过程中,还能通过释放内啡肽来获得一种愉悦感,从而改善日常情绪状态。 4. 增强心肺功能有助于提高心脏泵血效率和肺部的氧气交换能力,使身体在运动时更高效地获取能量。长期坚持锻炼可以降低心血管疾病的风险,如高血压和冠心病。此外,良好的心肺功能还能提升整体耐力,使人更有精力应对日常活动和挑战。 5. 控制体重。经常锻炼可以加速热量消耗,帮助维持健康的体重水平,减少肥胖风险。它还能提高基础代谢率,使身体在休息时也能持续燃烧脂肪。结合合理饮食,锻炼是有效管理体重的重要手段。 6. 改善睡眠。规律的锻炼有助于调节身体的生物钟,促进深度睡眠,提高睡眠质量,使人在夜间更容易进入休息状态,从而增强第二天的精力和工作效率。不过,应避免在睡前两小时内剧烈运动,以免影响入睡。适度的运动还能减少焦虑和压力,帮助缓解失眠问题。 7. 延缓衰老。经常锻炼可以促进细胞修复和再生,增强身体的抗氧化能力,从而减缓因年龄增长带来的身体机能退化。运动还能刺激生长激素的分泌,有助于维持皮肤弹性、肌肉质量以及整体身体活力。此外,规律的锻炼有助于保持大脑健康,降低与衰老相关的认知衰退风险。 8. 提升专注力。 规律的锻炼可以促进大脑释放多巴胺和内啡肽等神经递质,有助于提高注意力和思维敏捷性。 运动还能增强大脑的血液循环,为神经细胞提供更多的氧气和营养。 研究表明,经常锻炼的人在学习和工作中更容易保持集中,减少分心和疲劳感。 因此,坚持锻炼对提升学习效率和工作表现有积极作用。 9. 增强骨骼。经常锻炼,尤其是负重运动如跑步、跳跃和力量训练,可以刺激骨密度增加,预防骨质疏松,使骨骼更加坚固有力。运动还能促进钙质的吸收和利用,有助于维持骨骼的健康状态。对于老年人来说,规律的锻炼是延缓骨质流失、降低骨折风险的重要手段。 10. 促进代谢。 经常锻炼可以加速身体的新陈代谢,帮助更有效地消耗热量,维持体内能量平衡。运动还能刺激细胞更新,提高身体对营养物质的利用效率。此外,规律的运动有助于调节激素水平,进一步优化代谢过程。
llm = "Qwen/Qwen3-8B"
question_English = "What are the benefits of regular exercise?"
final_result_English = ""
# For 循环顺序执行
# for point_index, key_point in key_point_skeleton_English:
# point_expanding_prompt = f"""You are responsible for continuing the writing of one and only one point \
# in the overall answer to the following question.
# {question_English}
# The skeleton of the answer is:
# {skeleton_result_English}
# Continue and only continue the writing of point {point_index}. \
# Write it accurately and concisely in 3∼5 sentences, and do not continue with other points!
# """
# point_expanding = get_completions(point_expanding_prompt, llm)
# if point_index == key_point_skeleton[-1][0]:
# final_result_English += f"{point_index}. {point_expanding}"
# else:
# final_result_English += f"{point_index}. {point_expanding}\n"
# 使用 ThreadPoolExecutor 来并发执行 expand_point_English 函数
results = []
max_workers = len(key_point_skeleton_English)
with ThreadPoolExecutor(max_workers=4) as executor:
results = list(executor.map(expand_point_English, key_point_skeleton_English))
for point_index, point_expanding in results:
# print(f"Point Index: {point_index}, Point Expanding: {point_expanding}")
if point_expanding[0].isnumeric(): # 判断有没有数字编号
pass
else:
point_expanding = f"{point_index}. {point_expanding}"
if point_index == key_point_skeleton_English[-1][0]:
final_result_English += f"{point_expanding}"
else:
final_result_English += f"{point_expanding}\n"
print(f"要点扩展后的内容-英文:\n{final_result_English}")Output
要点扩展后的内容-英文: 1. Regular exercise improves health by strengthening the cardiovascular system, enhancing immune function, and reducing the risk of chronic diseases such as diabetes, hypertension, and certain cancers. It also promotes better circulation, lowers cholesterol levels, and helps maintain a healthy weight, contributing to overall physical well-being. Additionally, consistent physical activity can reduce inflammation and improve metabolic function, which are key factors in preventing illness and maintaining vitality. 2. Boost mood by releasing endorphins and serotonin, which are natural mood elevators. Regular physical activity can also reduce symptoms of anxiety and depression, promoting a sense of well-being. This positive effect is often experienced even after a single session of exercise, making it an effective and accessible tool for mental health support. 3. Increase strength. Regular exercise, particularly resistance training, helps build and maintain muscle mass, which in turn supports joint health and improves overall physical function. It also enhances the body's ability to perform daily tasks with greater ease and reduces the risk of injuries. Strength gains contribute to better posture and balance, especially as people age. 4. Enhance endurance. Regular exercise improves the body's ability to sustain physical activity over time by increasing the efficiency of the cardiovascular system and strengthening muscles. This leads to better stamina and performance in daily tasks and sports. Endurance training also helps in delaying the onset of fatigue during prolonged exertion. 5. Aid weight management. Regular exercise helps burn calories and increase metabolism, making it an effective tool for maintaining a healthy weight. It also promotes the development of lean muscle mass, which can further boost calorie expenditure even at rest. Combined with a balanced diet, physical activity supports long-term weight control and reduces the risk of obesity-related conditions. 6. Improve sleep. Regular exercise helps regulate sleep patterns by promoting deeper and more restful sleep, which can reduce the time it takes to fall asleep and increase the overall duration of sleep. It also helps alleviate symptoms of insomnia and improves the quality of rest, leading to better overall recovery and energy levels. 7. Reduce stress. Regular exercise helps reduce stress by triggering the release of endorphins, which are natural mood lifters. It also lowers levels of stress hormones like cortisol, promoting a sense of calm and well-being. Physical activity can serve as a healthy outlet for tension, improving mental resilience and emotional balance. 8. Enhance flexibility. Regular exercise, particularly activities like yoga, stretching, or aerobic workouts, helps improve the range of motion in joints and muscles, reducing the risk of injury and promoting better posture. It also supports overall physical performance and can alleviate muscle stiffness and tension. Flexibility is essential for maintaining mobility as one ages. 9. Support heart health. Regular exercise helps strengthen the heart muscle, making it more efficient at pumping blood throughout the body. It also lowers blood pressure, improves cholesterol levels, and reduces the risk of developing cardiovascular diseases. These benefits contribute to a healthier circulatory system and overall longevity. 10. Increase lifespan. Regular exercise has been shown to contribute to a longer life by reducing the risk of chronic diseases such as heart disease, diabetes, and certain cancers. It also promotes healthier aging and helps maintain overall physical and mental well-being, which can lower the likelihood of premature death. Studies indicate that individuals who engage in consistent physical activity tend to live up to several years longer than those who do not.
2.3 骨架提示和要点展开合并模板
思维骨架 (SoT) 方法通常使用两步提示:一是骨架提示,二是要点展开。
实际上,我们可以通过一次性提示来合并这两步:首先构建思维骨架,然后填充它。只需更新问题并执行提示即可!这其实是在利用上下文学习(In-Context Learning)。
llm = "Qwen/Qwen3-8B"
question_Chinese = "人工智能专业的研究生应该养成那些良好的科研习惯?"
prompt_SoT_Chinese = f"""您的任务是分两步回答下面的问题。\
首先,用一个要点列表(编号为 1.、2.、3.等)列出简明扼要的答案要点。\
每个要点应非常简短,只有 2∼8 个字。一般来说,骨架应包含 3∼10 个要点。\
提供骨架后,用 3∼6 句话简要扩展每个要点。
示例问题:
经常锻炼有什么好处呢?
骨架:
1. 增强心肺功能。
2. 控制体重。
3. 提高免疫力。
4. 改善睡眠质量。
5. 减少患疾病风险。
6. 提升心情和情绪。
7. 延缓衰老。
要点扩展后的答案:
1. 经常锻炼可以增强心肺功能,使心脏更加强壮,提高肺活量,增加氧气的吸收量。这有助于提高身体的耐力和抵抗力,减少疲劳感,让我们在日常生活中更加精力充沛和活力十足。
2. 控制体重。经常锻炼可以帮助消耗多余的热量,从而帮助控制体重。此外,锻炼还可以增加肌肉质量,提高新陈代谢率,进一步帮助维持健康的体重。保持适当的体重有助于预防肥胖相关疾病,如心血管疾病和糖尿病。因此,通过坚持锻炼,可以更好地控制体重,保持身体健康。
3. 经常锻炼可以提高免疫力,使身体更加抵抗疾病。锻炼可以促进血液循环,增加白细胞数量,从而帮助身体更快地应对病毒和细菌的入侵。此外,锻炼还可以减少患感冒和流感等呼吸道疾病的风险,让身体更加健康。
4. 锻炼可以帮助改善睡眠质量,使人更容易入睡并保持深度睡眠状态。适当的运动可以调节身体的生物钟,帮助人们建立规律的作息时间。此外,锻炼也有助于减轻焦虑和压力,使人们在睡前更加放松,从而提高睡眠质量。良好的睡眠对身体健康和心理健康都至关重要。
5. 经常锻炼可以减少患疾病的风险,包括心脏病、中风、糖尿病和某些癌症。运动有助于控制体重,减少肥胖引发的健康问题。此外,锻炼还可以提高身体的新陈代谢,促进身体内部的废物排出,保持身体健康。
6. 锻炼可以释放身体内的内啡肽和多巴胺等神经递质,提升心情和情绪。这些化学物质可以帮助减轻焦虑和抑郁,让人感到更加愉快和放松。通过锻炼,人们可以更好地处理压力和情绪波动,保持心理健康。
7. 锻炼还可以增加身体的灵活性和力量,减少关节疼痛和肌肉疲劳。此外,定期锻炼还可以改善身体姿势和平衡能力,降低摔倒和受伤的风险。最重要的是,锻炼可以提高自信心和自尊心,让人更加积极乐观地面对生活中的挑战。
您的任务是回答:```{question_Chinese}```
骨架:
1.
2.
...
要点扩展后的答案:
1.
2.
...
"""
result_SoT_Chinese = get_completions(prompt_SoT_Chinese, llm)
print(f"SoT生成结果-中文:\n{result_SoT_Chinese}")Output
SoT生成结果-中文: 骨架: 1. 制定研究计划 2. 做好文献综述 3. 培养批判思维 4. 记录实验过程 5. 持续学习新知识 6. 合理时间管理 7. 主动沟通交流 8. 注重论文写作 9. 保持耐心细致 10. 培养团队合作 要点扩展后的答案: 1. 制定研究计划:人工智能专业的研究生应提前规划研究方向和目标,明确研究步骤和时间节点,确保科研工作有序推进。 2. 做好文献综述:系统查阅和整理相关领域的研究进展,有助于把握研究前沿,避免重复劳动,为研究提供理论支持。 3. 培养批判思维:在阅读和分析文献时,要保持独立思考,质疑已有结论,提出新的问题和假设,推动创新。 4. 记录实验过程:详细记录实验数据、操作步骤和结果,有助于复现研究、分析问题,也便于后续撰写论文和报告。 5. 持续学习新知识:人工智能发展迅速,研究生应不断学习新技术、新算法和新工具,保持专业竞争力。 6. 合理时间管理:科学安排学习、实验和写作时间,避免拖延和疲劳,提高科研效率和成果质量。 7. 主动沟通交流:与导师、同学和同行保持良好沟通,有助于获取反馈、解决问题,拓展研究思路。 8. 注重论文写作:规范撰写学术论文,注重逻辑性和表达清晰度,是科研成果传播和评价的重要方式。 9. 保持耐心细致:科研过程充满挑战,需要耐心面对失败,细致分析问题,逐步推进研究。 10. 培养团队合作:人工智能项目常需多人协作,研究生应具备良好的团队意识,积极参与讨论与分工。
llm = "Qwen/Qwen3-8B"
question_English = "What good research habits should graduate students in Artificial Intelligence Major?"
prompt_SoT_English = f"""You are tasked with answering the following question in a two-step process. \
First, create a concise skeleton of the answer in a list of points (numbered 1., 2., 3., etc.). \
Each skeleton point should be very short with only 2~6 words. \
Generally, the skeleton should have 3∼10 points. \
After providing the skeleton, expand on each point briefly in 2∼4 sentences.
Example Question:
What are the benefits of regular exercise?
Skeleton:
1. Weight management.
2. Improved mood.
3. Increased energy levels.
4. Better sleep quality.
5. Stronger immune system.
6. Reduced risk of chronic diseases.
7. Improved cognitive function.
8. Better overall physical health.
Expanded Answer:
1. Regular exercise helps with weight management by burning calories and increasing metabolism. It can also help build muscle mass, which in turn can help increase the body's ability to burn calories even at rest. Additionally, exercise can help regulate appetite and improve overall body composition.
2. Regular exercise has been shown to improve mood by releasing endorphins, which are known as "feel-good" hormones. This can help reduce feelings of anxiety, stress, and depression, leading to a more positive outlook on life. Additionally, exercise can provide a sense of accomplishment and boost self-esteem, further enhancing overall emotional well-being.
3. Regular exercise can lead to increased energy levels by improving cardiovascular health, increasing muscle strength, and enhancing overall endurance. This boost in energy can help individuals feel more alert and focused throughout the day, leading to increased productivity and a greater sense of well-being.
4. Regular exercise can lead to better sleep quality by helping to regulate sleep patterns and improve overall sleep efficiency. Physical activity can also reduce symptoms of insomnia and promote deeper, more restful sleep. Additionally, exercise has been shown to decrease the time it takes to fall asleep and increase the amount of time spent in the restorative stages of sleep.
5. Regular exercise helps to strengthen the immune system by promoting healthy circulation, which allows immune cells to move through the body more efficiently. This can help the body fight off infections and illnesses more effectively, reducing the frequency and severity of colds, flu, and other common ailments. Additionally, exercise can also help to reduce inflammation in the body, further supporting immune function.
6. Regular exercise can help reduce the risk of chronic diseases such as heart disease, diabetes, and certain types of cancer. It can also improve cardiovascular health, lower blood pressure, and decrease the likelihood of developing conditions like osteoporosis. Additionally, exercise can help manage and improve symptoms of existing chronic diseases, leading to a better quality of life.
7. Regular exercise has been shown to improve cognitive function by increasing blood flow to the brain, promoting the growth of new brain cells, and enhancing overall brain health. This can lead to better memory, sharper focus, and improved decision-making skills, ultimately contributing to a higher quality of life.
8. Regular exercise also helps to improve overall physical health by strengthening the cardiovascular system, increasing muscle strength and endurance, improving flexibility and balance, and enhancing overall physical performance. This can lead to a decreased risk of injury, improved posture, and a greater ability to perform daily tasks with ease. Additionally, exercise can help to maintain bone density and reduce the risk of osteoporosis as we age.
Your task is to answer: ```{question_English}```
Skeleton:
1.
2.
...
Expanded Answer:
1.
2.
...
"""
result_SoT_English = get_completions(prompt_SoT_English, llm)
print(f"SoT生成结果-英文:\n{result_SoT_English}")Output
SoT生成结果-英文: Skeleton: 1. Set clear research goals. 2. Maintain a structured schedule. 3. Engage in regular literature review. 4. Document all findings meticulously. 5. Collaborate with peers and mentors. 6. Seek feedback frequently. 7. Stay updated with AI advancements. 8. Practice reproducible methods. 9. Manage time effectively. 10. Present work clearly and concisely. Expanded Answer: 1. Set clear research goals to ensure focused and meaningful work. Having well-defined objectives helps in planning experiments and evaluating results. It also aids in staying motivated and aligned with academic or industry requirements. 2. Maintain a structured schedule to manage time efficiently and avoid procrastination. Allocating specific hours for research, reading, and writing helps in maintaining a consistent workflow. A schedule also allows for better planning of deadlines and milestones. 3. Engage in regular literature review to stay informed about the latest developments in AI. This helps in identifying research gaps and building a strong theoretical foundation for your work. It also ensures that your research is original and contributes to the field. 4. Document all findings meticulously to ensure clarity and traceability in your research process. Good documentation helps in organizing data, tracking progress, and facilitating collaboration. It also makes it easier to replicate experiments and share results. 5. Collaborate with peers and mentors to gain new perspectives and improve the quality of your research. Working with others can lead to more innovative ideas and better problem-solving. Collaboration also provides support and guidance during challenging phases of research. 6. Seek feedback frequently to refine your work and identify areas for improvement. Constructive criticism from advisors or colleagues can help you avoid mistakes and enhance the rigor of your research. Regular feedback also ensures that your work aligns with academic standards. 7. Stay updated with AI advancements by following journals, conferences, and online resources. Keeping up with new techniques and tools is essential for staying competitive and relevant in the field. It also helps in identifying new research opportunities and applications. 8. Practice reproducible methods to ensure the reliability and validity of your results. Using clear, documented, and repeatable procedures allows others to verify your findings and build upon your work. Reproducibility is a cornerstone of scientific research. 9. Manage time effectively by prioritizing tasks and avoiding burnout. Time management ensures that you can complete your research within deadlines and maintain a healthy work-life balance. It also helps in focusing on high-impact activities and avoiding unnecessary delays. 10. Present work clearly and concisely to communicate your findings effectively. Good presentation skills are essential for writing papers, giving talks, and defending your research. Clear communication ensures that your contributions are understood and appreciated by the academic community.
三、总结与讨论
要点总结:
-
SoT 的核心思想是先引导 LLMs 生成答案的骨架,然后并行地对每个骨架点进行扩展,从而实现并行解码,有效避免了顺序解码的高延迟。
-
SoT 是一种数据层面的优化技术,利用了 LLMs 的指令遵循和规划能力,展示了通过显式规划答案结构来促进获得高质量答案的潜力。
-
SoT 已在 12 个最新的 LLMs 上进行了测试,结果显示 SoT 不仅能显著提高生成速度(最高达 2.39 倍,有效降低 LLMs 的生成延迟),而且在某些情况下还能提高答案质量。
📚 主要参考资料:
-
ICLR 2024 - Skeleton-of-Thought: Large Language Models Can Do Parallel Decoding,https://openreview.net/forum?id=mqVgBbNCm9
-
大模型速度狂飙 2.39 倍!清华联手微软首提 SoT,让 LLM 思考更像人类,https://mp.weixin.qq.com/s/9t1opfhUYm3yJuEoKPvVuQ,
-
思维骨架 SoT 如何提升 LLM 的速度?丨论文解读,https://juejin.cn/post/7269607286195699727
