gpt4 book ai didi

openai-api - OpenAI 微调 API : Why would I use LlamaIndex or LangChain instead of fine-tuning a model?

转载 作者:行者123 更新时间:2023-12-02 05:48:30 28 4
gpt4 key购买 nike

我刚刚开始使用法学硕士,特别是 OpenAI 和其他 OSS 模型。有很多关于使用 LlamaIndex 创建所有文档的存储然后查询它们的指南。我用一些示例文档进行了尝试,但发现每个查询很快就会变得非常昂贵。我想我使用了 50 页的 PDF 文档,摘要查询每次查询花费了大约 1.5 美元。我看到有很多 token 被发送,所以我假设它为每个查询发送整个文档。鉴于有人可能想要使用数以千万计的记录,我看不出像 LlamaIndex 这样的东西如何能够以经济高效的方式真正发挥作用。

另一方面,我看到 OpenAI 允许您训练 ChatGPT 模型。或者使用其他经过定制培训的法学硕士来查询您自己的数据不是更便宜、更有效吗?我为什么要设置 LlamaIndex?

最佳答案

TLD;DR:使用 LlamaIndex 或 LangChain 从现有数据源获取特定问题的准确答案(即事实)。

为什么选择LlamaIndexLangChain过度微调模型?

答案很简单,但你自己无法回答,因为你只考虑成本。还有其他方面,不仅仅是成本。看一下问题的可用性方面。

微调模型将为模型提供额外的常识,但微调后的模型不会(必然)为您提供特定问题的准确答案(即事实)。

人们用一些数据训练 OpenAI 模型,但是当他们询问一些与微调数据相关的问题时,他们会惊讶地发现该模型没有用通过微调获得的知识来回答。参见官方上的示例解释OpenAI forum by @juan_olano :

I fine-tuned a 70K-word book. My initial expectation was to have thedesired QA, and at that point I didn’t know any better. But thisfine-tuning showed me the limits of this approach. It just learned thestyle and stayed more or less within the corpus, but hallucinated alot.

Then I split the book into sentences and worked my way throughembeddings, and now I have a very decent QA system for the book, butfor narrow questions. It is not as good for questions that need thecontext of the entire book.

另外,参见官方OpenAI documentation :

Some common use cases where fine-tuning can improve results:

  • Setting the style, tone, format, or other qualitative aspects
  • Improving reliability at producing a desired output
  • Correcting failures to follow complex prompts
  • Handling many edge cases in specific ways
  • Performing a new skill or task that’s hard to articulate in a prompt

LlamaIndex 或 LangChain 使您能够将 OpenAI 模型与现有数据源连接起来。例如,一家公司有一堆内部文档,其中包含各种说明、指南、规则等。可以使用 LlamaIndex 或 LangChain 查询所有这些文档,并向需要答案的员工提供准确的答案。

OpenAI 模型无法查询其知识。查询需要计算嵌入向量和余弦相似度,而 OpenAI 模型无法做到这一点。 OpenAI 模型根据哪个词应该跟在前一个词之后的统计概率给出答案。

我强烈建议您阅读我的previous answer关于语义搜索。您会更好地理解这个答案。

关于openai-api - OpenAI 微调 API : Why would I use LlamaIndex or LangChain instead of fine-tuning a model?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76546004/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com