首頁  >  文章  >  科技週邊  >  清華等開源「工具學習基準」ToolBench,微調模型ToolLLaMA效能超越ChatGPT

清華等開源「工具學習基準」ToolBench,微調模型ToolLLaMA效能超越ChatGPT

WBOY
WBOY轉載
2023-06-06 11:12:031257瀏覽

人類具有創造和利用工具的能力,使得我們可以突破身體的限制,探索更廣闊的世界。

人工智慧基礎模型也類似,如果僅靠訓練階段得到的權重,使用場景就會非常受限,而最近提出的工具學習(tool learning),將特定領域的專用工具與大規模基礎模型結合,可以實現更高的效率、效能。

不過目前工具學習的相關研究還不夠深入,也缺乏相關的開源資料和程式碼。

最近,清華大學自然語言處理實驗室等支援的開源社群OpenBMB (Open Lab for Big Model Base)發布了ToolBench項目,可以幫助開發者建立開源、大規模、高品質的指令調優數據,促進建構具有通用工具使用能力的大型語言模型。

清華等開源「工具學習基準」ToolBench,微調模型ToolLLaMA效能超越ChatGPT

庫連結:https://github.com/OpenBMB/ToolBench

ToolBench倉庫中提供了相關資料集、訓練和評估腳本,以及在ToolBench上微調的功能模型ToolLLaMA,具體特點為:

1. 支援單工具和多工具方案

其中單一工具設定遵循LangChain提示風格,多工具設定遵循AutoGPT的提示風格。

2. 模型回應不僅包含最終答案,還包含模型的思考鏈過程、工具執行與工具執行結果

#3. 支持真實世界層級的複雜性,支援多步驟工具呼叫

4. 豐富的API,可用於現實世界中的場景,如天氣資訊、搜尋、股票更新和PowerPoint自動化

5. 所有的資料都是由OpenAI API自動產生並由開發團隊進行過濾,資料的創建過程很容易擴展

不過需要注意的是,目前發布的數據還不是最終版本,研究人員仍在對數據進行後處理以提高數據質量,並增加真實世界工具的覆蓋範圍。

ToolBench

ToolBench的整體想法是基於BMTools,在監督資料中訓練大型語言模型。

清華等開源「工具學習基準」ToolBench,微調模型ToolLLaMA效能超越ChatGPT

#倉庫中包含31.2萬次真實API呼叫得到的9800條數據,涵蓋單工具場景和多工具場景,以下是單工具的統計資料。

清華等開源「工具學習基準」ToolBench,微調模型ToolLLaMA效能超越ChatGPT

#其中每行資料都是一個json dict,包含資料建立的提示範本、工具使用的人工指令(查詢)、中間思維/工具執行循環和最終答案。

Tool Descrition:BMTools Tool_name: translationTool action: get_translationaction_input: {"text": target texts, "tgt_lang": target language}Generated Data:{"prompt": "Answer the following questions as best you can. Specifically, you have access to the following APIs:\n\nget_translation: . Your input should be a json (args json schema): {{\"text\" : string, \"tgt_lang\" : string, }} The Action to trigger this API should be get_translation and the input parameters should be a json dict string. Pay attention to the type of parameters.\n\nUse the following format:\n\nQuestion: the input question you must answer\nThought: you should always think about what to do\nAction: the action to take, should be one of [get_translation]\nAction Input: the input to the action\nObservation: the result of the action\n... (this Thought/Action/Action Input/Observation can repeat N times, max 7 times)\nThought: I now know the final answer\nFinal Answer: the final answer to the original input question\n\nBegin! Remember: (1) Follow the format, i.e,\nThought:\nAction:\nAction Input:\nObservation:\nFinal Answer:\n (2) Provide as much as useful information in your Final Answer. (3) Do not make up anything, and if your Observation has no link, DO NOT hallucihate one. (4) If you have enough information and want to stop the process, please use \nThought: I have got enough information\nFinal Answer: **your response. \n The Action: MUST be one of the following:get_translation\nQuestion: {input}\n Agent scratchpad (history actions):\n {agent_scratchpad}","query": "My intention is to convert the data provided in ما هي الأقسام الثلاثة للقوات المسلحة؟ into Arabic(ara).\n","chains": [{"thought": "I need to use the get_translation API to convert the text into Arabic.","action": "get_translation","action_input": "{\"text\": \"What are the three branches of the military?\", \"tgt_lang\": \"ara\"}","observation": "\"ما هي الفروع الثلاثة للجيش ؟\""}],"answer": "The translation of \"What are the three branches of the military?\" into Arabic is \"ما هي الفروع الثلاثة للجيش ؟\"."}

模型實驗

#機器評估:研究人員對每個工具隨機抽取100個連結(chain steps)來建立機器評估測試平台,平均27個最終步驟和73個中間工具呼叫步驟,其中最終步驟的評估使用Rouge-L指標,中間步驟的評估使用ExactMatch指標進行評估。


清華等開源「工具學習基準」ToolBench,微調模型ToolLLaMA效能超越ChatGPT

# 人工評估:在天氣、地圖、在股票、翻譯、化學和WolframAlpha工具中隨機抽取10個query,然後評估工具調用過程的通過率、最終答案以及和ChatGPT最終答案的比較。

ChatGPT評估:透過ChatGPT對LLaMA和ChatGPT的答案和工具使用鏈進行自動評估。

評估結果如下(分數越高越好),可以看到ToolLLaMA在不同情境下與ChatGPT的表現相同或更好。

清華等開源「工具學習基準」ToolBench,微調模型ToolLLaMA效能超越ChatGPT

#工具學習

在清華大學、人民大學、北京郵電大學等個國內外知名高校和大學聯合發布的一篇論文中,對工具學習進行了系統的研究,介紹了工具學習的背景,包括認知起源、基礎模型的範式轉變,以及工具和模型的互補作用。

清華等開源「工具學習基準」ToolBench,微調模型ToolLLaMA效能超越ChatGPT

論文連結:https://arxiv.org/pdf/2304.08354.pdf

#

文中也回顧了現有的工具學習研究,包括工具增強型和工具導向型學習,並製定了一個通用的工具學習框架:從理解使用者指令開始,模型應該學會把一個複雜的任務分解成幾個子任務,透過推理動態地調整計劃,並透過選擇合適的工具有效地征服每個子任務。

文中也討論瞭如何訓練模型以提高工具使用能力並促進工具學習的普及。

考慮到先前的工作中缺乏系統性的工具學習評估,研究人員用17種有代表性的工具進行了實驗,並展示了當前基礎模型在熟練利用工具方面的潛力。

論文最後討論了幾個需要進一步研究的工具學習的開放性問題,例如確保安全和可信賴的工具使用、用基礎模型實現工具創建,以及解決個性化的難題。

參考資料:

https://github.com/OpenBMB/ToolBench

以上是清華等開源「工具學習基準」ToolBench,微調模型ToolLLaMA效能超越ChatGPT的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:51cto.com。如有侵權,請聯絡admin@php.cn刪除