提示工程(Prompt Engineering)是一门较新的学科,关注提示词开发和优化,帮助用户将大语言模型(Large Language Model, LLM)用于各场景和研究领域。 掌握了提示工程相关技能将有助于用户更好地了解大型语言模型的能力和局限性。
研究人员可利用提示工程来提升大语言模型处理复杂任务场景的能力,如问答和算术推理能力。开发人员可通过提示工程设计、研发强大的工程技术,实现和大语言模型或其他生态工具的高效接轨。
提示工程不仅仅是关于设计和研发提示词。它包含了与大语言模型交互和研发的各种技能和技术。提示工程在实现和大语言模型交互、对接,以及理解大语言模型能力方面都起着重要作用。用户可以通过提示工程来提高大语言模型的安全性,也可以赋能大语言模型,比如借助专业领域知识和外部工具来增强大语言模型能力。
基于对大语言模型的浓厚兴趣,我们编写了这份全新的提示工程指南,介绍了大语言模型相关的论文研究、学习指南、模型、讲座、参考资料、大语言模型能力以及与其他与提示工程相关的工具。
在日常应用中非常普遍,积累了几个常用的场景,举个例子:
文章润色
def academic_proofreader(
research_field: str = "Molecular Representation Learning",
document_type: str = "Abstract", # or "Introduction", "Conclusion", "Paper", "Thesis", "Grant Proposal", etc.
paragraph_to_proofread: str = "Paste your text here.",
explanation: bool = False
) -> str:
prompt = (
f"Please act as an academic proofreader and enhancer specializing in the field of [{research_field}]. "
f"Your task is to proofread and refine the [{document_type}] provided below, "
f"ensuring that the text is suitable for academic writing. "
f"Focus on aspects such as grammar, punctuation, sentence structure, coherence, and clarity.\n\n"
f"The text to be proofread is:\n"
f"<{paragraph_to_proofread}>\n\n"
f"Improve the text to adhere to a scholarly, formal, and literary style appropriate "
f"for academic writing in the research field of [{research_field}], "
f"using terminology commonly accepted in the [{research_field}] community. "
f"Also, revise the text to make it sound more like a native speaker, "
f"enhancing the natural flow and readability. "
f"Finally, minimize any traces of chatGPT in the output, "
f"ensuring that the revised text does not resemble a typical chatbot response. "
f"Please provide only the corrected and improved text without any additional explanations. "
)
if explanation:
prompt += (
f"Please explicitly point out where you did the modification and why."
)
return prompt
给自己的文章提修改意见
def article_reviewer(
research_field: str = "Molecular Representation Learning",
article_title: str = "Uni-Mol: A Universal 3D Molecular Representation Learning Framework",
) -> str:
prompt = (
f"As a peer reviewer for an academic journal specializing in [{research_field}], "
f"your task is to review a paper titled '{article_title}'. "
f"Please carefully read the paper and provide your comments and suggestions. "
f"Consider aspects such as the structure and content of the paper, research methods, and results. "
f"Evaluate the validity, originality, and contribution of the research to the existing knowledge in the field. "
f"Ensure that your feedback helps the authors improve the quality of the paper. "
f"Note that you don't need to make full-text revisions, but instead, "
f"you should point out areas that need improvement and provide recommendations for revision."
)
return prompt