首页 > 其他分享 >openAI cookbook - debug

openAI cookbook - debug

时间:2023-04-27 14:57:48浏览次数:31  
标签:shot problems few step openAI debug prompt model cookbook

 

当用GPT失败的时候应该怎么办?

更好的prompt

finetune

模型不行,let it be

When GPT-3 fails on a task, what should you do?

  • Search for a better prompt that elicits more reliable answers?
  • Invest in thousands of examples to fine-tune a custom model?
  • Assume the model is incapable of the task, and move on?

There is no simple answer - it depends. However, if your task involves logical reasoning or complexity, consider trying the techniques in this article to build more reliable, high-performing prompts.

 

人无法直接给出两位乘的结果,但是通过列过程验算就可以,对于模型也是一样

所以不要过于简单的认为模型不具备能力

If you were asked to multiply 13 by 17, would the answer pop immediately into your mind? For most of us, probably not. Yet, that doesn't mean humans are incapable of two-digit multiplication. With a few seconds, and some pen and paper, it's not too taxing to work out that 13 x 17 = 130 + 70 + 21 = 221.

简单的魔法,Let's think step by step.

试验证明,这个方法非常有效果

On a benchmark of word math problems, the Let's think step by step trick raised GPT-3's solve rate massively, from a worthless 18% to a decent 79%!

更多的魔法

The rest of this article shares techniques for improving reliability of large language models on complex tasks. Although some of the techniques are specific to certain types of problems, many of them are built upon general principles that can be applied to a wide range of tasks, e.g.:

  • Give clearer instructions
  • Split complex tasks into simpler subtasks
  • Structure the instruction to keep the model on task
  • Prompt the model to explain before answering
  • Ask for justifications of many possible answers, and then synthesize
  • Generate many outputs, and then use the model to pick the best one
  • Fine-tune custom models to maximize performance

再给个例子,模型需要你更有耐心的teach

在gpt3.5下试,会选b

做法是分步骤,分而治之,对于人或模型都是万能药

分三步,就能对

实际在3.5中试,答案是错的,第一步能找出3, 5相关,但第二步推论仍然是错的

 

Zero-shot,直接问,没有范例

这种方法也不是对所有问题都有效,直觉上看,对于人而言,更多的过程无用的场景,那么对模型也无效

The authors found that it was most helpful for multi-step arithmetic problems, symbolic reasoning problems, strategy problems, and other reasoning problems.
It didn't help with simple math problems or common sense questions, and presumably wouldn't help with many other non-reasoning tasks either.

 

Few-shot 少量的范例

框出来的部分就是范例,这种称为 in-context learning

CoT就是给出步骤,思路有点像上面

但是CoT的好处是,可以teach的更具体,帮助更大

One advantage of the few-shot example-based approach relative to the Let's think step by step technique is that you can more easily specify the format, length, and style of reasoning that you want the model to perform before landing on its final answer. This can be particularly helpful in cases where the model isn't initially reasoning in the right way or depth.

Few-shot的方式可以用于让大模型生成训练集, 很直觉

In 2022, Eric Zelikman and Yuhuai Wu et al. published a clever procedure for using a few-shot prompt to generate a dataset of explanations that could be used to fine-tune a model.
The idea is to use a few-shot prompt to generate candidate explanations, and only keep the explanations that produce the correct answer.
Then, to get additional explanations for some of the incorrect answers, retry the few-shot prompt but with correct answers given as part of the question.
The authors called their procedure STaR (Self-taught Reasoner):

few-shot prompt用于生成fine-tuning dataset可以扩展开

Using a few-shot prompt to extend or modify a fine-tuning dataset is an idea that can be generalized beyond explanation writing.
For example, if you have large quantities of unstructured text that you want to train on, you may find opportunities to use a prompt to extract a structured dataset from your unstructured text, and then fine-tune a custom model on that structured dataset.

 

后面列出很多COT的扩展,和很多的最新的Prompt技术,先略过 

 

 

 

 

 

 

 

 

 

 

 

 

 

标签:shot,problems,few,step,openAI,debug,prompt,model,cookbook
From: https://www.cnblogs.com/fxjwind/p/17358827.html

相关文章

  • openAI cookbook - embedding
    https://github.com/openai/openai-cookbook Embedding是什么意思就不说了基于大模型的Embedding本身是包含比文本更多的内涵的,因为包含了大量的相关性但Embedding怎么用,基本逻辑是文本相似性所以Semanticsearch是最简单的,把Embedding存到向量数据库里面,search就行推荐也......
  • openAI cookbook - UT
    和原例子不一样,我没有用API,直接用的chatgpt3.5如何形成比较好的UTprompt,要分步骤,这里分成三步,我是把每一步copy到chatgpt,然后把结果贴回来Complextasks,suchaswritingunittests,canbenefitfrommulti-stepprompts.Incontrasttoasingleprompt,amulti-steppro......
  • Teamcenter用本地胖客户端启动时,可以看到定制包的插件菜单项,但是用DEBUG启动时,看不到
    1、用本地胖客户端启动时,可以看到定制包的插件菜单项,但是用DEBUG启动时,看不到?原因:是因为DEBUG模式下,是采用JAVA1.8来运行的。但是本机的胖客户端是采用JAVA11来运行的解决办法:换成JAVA11就可以了 ......
  • ChatGPT:宝塔面板中nginx配置代理访问openai
    反向代理配置代码点击查看代码#PROXY-START/location/{proxy_passhttps://api.openai.com;proxy_set_headerHost$proxy_host;proxy_set_headerX-Real-IP$remote_addr;proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;proxy_se......
  • python 调试 debugger
    调试(Debugging)利用好调试,能大大提高你捕捉代码Bug的。大部分新人忽略了Pythondebugger(pdb)的重要性。在这个章节我只会告诉你一些重要的命令,你可以从官方文档中学习到更多。译者注,参考:https://docs.python.org/2/library/pdb.htmlOrhttps://docs.python.org/3/library/pd......
  • GDB debug
    HowdoIprintthefullvalueofalongstringingdb?setprintelements0FromtheGDBmanual:setprintelementsnumber-of-elementsSetalimitonhowmanyelementsofanarrayGDBwillprint.IfGDBisprintingalargearray,itstopsprintinga......
  • OpenAI的离线音频转文本模型 Whisper 的.NET封装项目
    whisper介绍OpenAI在2022年9月21日开源了号称其英文语音辨识能力已达到人类水准的Whisper神经网络,且它亦支持其它98种语言的自动语音辨识。Whisper系统所提供的自动语音辨识(AutomaticSpeechRecognition,ASR)模型是被训练来运行语音辨识与翻译任务的,它们能将各种语言的语音变成文......
  • OpenAI的子词标记化神器--tiktoken 以及 .NET 支持库SharpToken
    经过Tokenize之后,一串文本就变成了一串整数组成的向量。OpenAI的 Tiktoken 是更高级的Tokenizer,编码效率更高、支持更大的词汇表、计算性能也更高。OpenAI在其官方GitHub上公开了一个开源Python库:tiktoken,这个库主要是用力做字节编码对的。字节编码对(BytePairEncoder......
  • 冰橙GPT提供开放接口 。提供与OPENAI官方一致的体验效果(同步返回数据,同时支持流式及非
    冰橙GPTchatGPT开放接口使用说明 【接入了腾讯云内容安全检测】冰橙GPT稳定提供API接口服务定时有人进行问题排查处理1小时内问题响应接入了腾讯云的内容安全检测有任何疑问请加入QQ交流群:310872519           1.请求地址:https://gpt.bcwhkj.cn/a......
  • x64逆向——MT、MT在release和debug下的四种模式寻找main入口
    vs代码生成四种模式:MT选项:链接LIB版的C和C++运行库。在链接时就会在将C和C++运行时库(LIBCMT.LIB、LIBC.LIB)集成到程序中,程序体积会变大。MTd选项:LIB的调试版。MD选项:使用DLL版的C和C++运行库,这样在程序运行时会动态的加载对应的DLL,程序体积会减小,缺点是在系统没有对应DLL时程序无......