如何使用OpenAI的gpt-3.5-turbo API防止幻觉?

zpqajqem  于 2023-06-30  发布在  其他
关注(0)|答案(1)|浏览(215)

我试图使个人招聘助理工具,以帮助我自动化的过程中回答问题的工作申请,如“你为什么想在这里工作?或者“写一封求职信,说明你的经历与这个职位的关系。”。
我使用我的简历和Q&A部分作为API调用的上下文,并将问题作为提示。总的来说,这个系统运行良好,但它经常让我产生幻觉。例如,它会说我有比我简历中实际概述的更多年的经验,或者它会说我是一个我从未使用过或在我的上下文中列出的技术Maven。
我尝试通过以下代码显式地提示模型,但没有成功:

def prepare_context(self):
        context = (
            "Your role in this instance is "
            "to act as a recruiting assistant and help answer interview questions. "
            "Your responses should be based on the information provided in the resume and "
            "previous Q&As without hallucinating additional information or experience.\n\n"
            "My Resume:\n\n"
            f"{self.resume}\n\n"
            "My Previously answered questions:\n"
        )

        for q, a in self.qa_list:
            context += f"Q: {q}\nA: {a}\n"

        context += (
            "\nWhen answering the following questions, remember to answer "
            "in the first person as if you were the job applicant. The responses "
            "should be concise, truthful, and based solely on the given information. "
            "Do not create or infer any additional experiences or skills that are "
            "not explicitly mentioned in the resume or previous Q&As. "
            "Do not generate any information that is not included in the resume or previous questions and answers. "
            "Remember, you are answering as me "
            "so answer all further questions from my perspective.\n"
        )

        return context
jvidinwx

jvidinwx1#

你不能

除非我错过了一个标题,否则目前没有办法用任何大型语言模型来防止幻觉。如果你要这样做,你要么需要接受随机错误,不管它们是什么,要么你需要每次都仔细检查AI的所有输出。你可以创建一个第二阶段的自动化错误检查器,但是无论你如何实现它,一些错误仍然会通过,让你选择接受错误或检查所有内容。
一般来说,我只会使用生成式AI来自动化低风险任务。我认为找工作不是一件低风险的事情,因为“幻觉”可能会对你的职业声誉和未来的就业能力产生严重后果。只是我的两分钱。

相关问题