AI时代的学习指南

日常刷知乎, 然后看到了这样一个问题: 沃顿商学院教授要求学生必须用 ChatGPT 写作业,应该如何正确看待 AI 带来的利弊?

之前我也看到一些态度截然相反的高校. 说实在话, 反对历史必然的行为, 无异于杯水车薪, 想想 Luddite movement 也不会真正让我们重回原始社会, 闭关锁国的历史也不必再度经历; 至于使用工具是否会反噬自身, 只要在不侵害他人的利益下, 我想这个自由最好让步于个人, 想想你是怎么注册上了ChatGPT的账号. 最后, 这句话送给AI时代下学习一切的你和我:

拥抱变化要比拒绝变化简单的多.

前言

ChatGPT 对每个人来说不是同等的. 你要有使用能力. 所谓能力是提问的能力. 提问也是门学问, 但我们没有一个问问题的课程, 也没有那个分数.

本文介绍一些ChatGPT帮助辅助学习的Tips.

我也在摸索AI的使用方式, 有好的想法大家一起交流学习! :)

把 AI 当成你的 TA

对于自学的同学来说, 能有一个随叫即到, 同时能有效答疑的助教是多么的幸福.

AI 不会嫌你愚蠢, 就算多么 trivial 它也能给你一个详尽的解答. 对于很多社恐的同学, 害怕 ask stupid questions 可能这会是一个很好的选择.

比方说, 题解的代码看不懂, 那么可以让 AI 帮助你生成注释, 或者解释代码的核心内容, 分析算法的时间复杂度等.

假设 model 给不出什么建设性的答复, 那么还是好好利用大学里的office hour, 或者去找课程专门的 TA 解决问题吧.

Prompt 的艺术

Prompt 公式

prompt 其实有 formula. 如果想要得到一个比较高质量的回答, 可以抓住以下几点:

  • task 明确, 精准的陈述
  • instructions 指令, model 遵循的要求
  • role: 让 model 角色扮演

prompt = task + instructions + role

例如以下几种应用场景:

  • 作为一名计算机科学与技术专业的大一学生, 生成一篇关于人工智能技术发展的课程论文, 内容包括[...] 要求字数不少于 [...] 字.

CET 作文的 Direction 就可以作为 prompt 的标准, 事实上给出的答案也是相当高质量的:

  • Suppose your university is selecting some students to teach kids in remote rural areas during the coming vacation. You are now to write an application letter to the university to explain why you want to take part and what you can do for the kids. You should write at least 120 words but no more than 180 words.

为 prompt 提供例子

例如你可以自动生成一个函数的doctest.

  • Generate a product comparison of this new smartphone with one example (latest iPhone)"
  • 生成一段关于DFS算法的解释(用一个例子说明:走迷宫)
  • [code] 解释这段代码, 并模拟一个样例.
  • [code] 为函数添加注释, 并提供 3 个 doctest.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
def summation(n: int, term: callable) -> float:
"""
Compute the summation of the given term from 1 to n.
Args:
n: An integer representing the upper bound of the summation.
term: A callable that takes one argument and returns a float.
Returns:
A float representing the summation of the given term from 1 to n.
Examples:
>>> summation(5, lambda x: x**2)
55.0
>>> summation(10, lambda x: x)
55.0
>>> summation(3, lambda x: 2**x)
7.0
"""
total, k = 0, 1
while k <= n:
total, k = total + term(k), k + 1
return total

Self-Consistency Prompt

添加一条 "Please ensure the following text is self-consistent", 对于检查文章前后内容一致性, 数据核查或者应付英语作业有奇效.

  • 检查下面这段文字是前后一致的. 它先声明了城市人口有500万, 随后又说人口有700万: [text]
  • Complete the following sentence in a way that is consistent with the context provided: [sentence]

Let’s think about this: [topic]

当你brainstorm不出来东西的时候可以考虑这么提问. 这个在应对传统课堂上的group discussion有奇效:

  • Let's discuss the current state of artificial intelligence
  • Let's talk about the benefits and drawbacks of remote work

AI 通常会给出一些很发散的答案. 可以顺着给出的几点进行延伸.

数据分析/信息整合

  • Integrate the following information with the existing knowledge about [specific topic]: [insert new information]
  • Connect the following pieces of information in a way that is relevant and logical: [insert information 1] [insert information 2]
  • Please generate new and original information about customer behavior from this dataset

Multiple Choice prompts

让 AI 做选择题/填空题.

  • Complete the following sentence by selecting one of the following options: [insert sentence] [insert option 1] [insert option 2] [insert option 3]

可解释型/控制型 Prompts

给 model 一点灵活性(发挥). 打个比方你是作文命题人, 那么这里的 prompt 就更加开放, 回答最好能够出乎你意外的:

  • 以鲁迅的风格补写下面的句子: 人是会死的,

人之所以为人,不仅有生之谓人,更有死之谓人。生,有生的欢喜与苦痛,死,亦有死的悲哀与解脱。

  • 以莎士比亚的口吻补写下面的句子: people shall die

Mortal beings are we, frail creatures of dust, destined one day to return to the earth from whence we came. The wheel of life turns, and birth and death are its spokes.

控制型 prompt 要求 model 不能有多余的发挥, 要在已有的模板里完成任务.

  • Generate a story based on the following template: [insert template]

特殊 Prompts

  • "Use reinforcement learning to generate text that is consistent with the following style [insert style]"
  • "Use curriculum learning to generate text that is consistent with the following styles [insert styles] in the following order [insert order]"
  • Perform sentiment analysis on the following customer reviews [insert reviews] and classify them as positive, negative, or neutral.
  • Perform named entity recognition on the following news article [insert article] and identify and classify people, organizations, locations, and dates.
  • Perform text classification on the following customer reviews [insert reviews] and classify them into different categories such as electronics, clothing and furniture based on their content.

参考资料

[1]. Ibrahim John, The Art of Asking ChatGPT for High-Quality Answers, A Complete Guide to Prompt Engineering Techniques, ISBN-13: 9781234567890

[2]. Awesome ChatGPT Prompts: 里面有许多有意思的 Prompts