自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Llama3實(shí)操增強(qiáng)的三種方式:RAG/Agent/Function Calling?。?! 原創(chuàng)

發(fā)布于 2024-5-22 10:17
瀏覽
0收藏

1、Llama 3 的 RAG 增強(qiáng)

以下 Github 鏈接展示了從頭開始使用 LangGraph 和 Llama3-8B 構(gòu)建可靠的智能體。它將3種先進(jìn) RAG 技術(shù)(自適應(yīng) RAG、糾正性 RAG和自我 RAG)的思想結(jié)合起來(lái),形成 LangGraph 中的單一控制流程。

https://github.com/langchain-ai/langgraph/blob/main/examples/rag/langgraph_rag_agent_llama3_local.ipynb

Llama3實(shí)操增強(qiáng)的三種方式:RAG/Agent/Function Calling?。?! -AI.x社區(qū)

方式一:自適應(yīng) RAG 路由,將問(wèn)題路由到不同的檢索方法。

方式二:糾正性 RAG 后備方案,如果文檔與查詢不相關(guān),則回退到網(wǎng)頁(yè)搜索 Web Browser。

方式三:自我 RAG 進(jìn)行自我糾錯(cuò),修正包含幻覺(jué)或未回答問(wèn)題的答案。

2、Llama 3 的微調(diào)增強(qiáng)

眾所周知,LLaMA-Factory 微調(diào),已經(jīng)支持 Llama 3,如下所示:

Llama3實(shí)操增強(qiáng)的三種方式:RAG/Agent/Function Calling!?。?-AI.x社區(qū)

Github 地址:https://github.com/hiyouga/LLaMA-Factory

另外 Colab 筆記本中將 Llama-3 微調(diào)速度提高 2倍以上,鏈接如下所示:

https://colab.research.google.com/drive/135ced7oHytdxu3N2DNe1Z0kqjyYIkDXp?usp=sharing

3、Llama 3 的 Function Calling 增強(qiáng)

目前官方的答復(fù)是 Llama 3 暫時(shí)不支持 Function Calling 的功能,也就表面看起來(lái)不支持 Agent 智能體功能,如下圖所示:

Llama3實(shí)操增強(qiáng)的三種方式:RAG/Agent/Function Calling!??! -AI.x社區(qū)

不過(guò),經(jīng)過(guò)我們實(shí)踐摸索,變形支持 Function Calling 函數(shù)調(diào)用的方法,也就是采用 Function Calling 數(shù)據(jù)微調(diào)后的 Llama 3,Prompt 提示詞模板如下圖所示:

<|begin_of_text|><|start_header_id|>function_metadata<|end_header_id|>


You have access to the following functions. Use them if required:
[
    {
        "type": "function",
        "function": {
            "name": "get_stock_price",
            "description": "Get the stock price of an array of stocks",
            "parameters": {
                "type": "object",
                "properties": {
                    "names": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "description": "An array of stocks"
                    }
                },
                "required": [
                    "names"
                ]
            }
        }
    },
    {
        "type": "function",
        "function": {
            "name": "get_big_stocks",
            "description": "Get the names of the largest N stocks by market cap",
            "parameters": {
                "type": "object",
                "properties": {
                    "number": {
                        "type": "integer",
                        "description": "The number of largest stocks to get the names of, e.g. 25"
                    },
                    "region": {
                        "type": "string",
                        "description": "The region to consider, can be \"US\" or \"World\"."
                    }
                },
                "required": [
                    "number"
                ]
            }
        }
    }
]<|eot_id|><|start_header_id|>user<|end_header_id|>


Get the names of the five largest stocks by market cap<|eot_id|><|start_header_id|>assistant<|end_header_id|>


Generated Response:
{
    "name": "get_big_stocks",
    "arguments": {
        "number": 5,
        "region": "US"
    }
}<|eot_id|>

4、Llama 3 實(shí)操技術(shù)選型

AI 大模型參數(shù)大小的技術(shù)選型可以參考如下實(shí)踐原則:

第一、歸納分類任務(wù),大模型參數(shù)推薦 3B;

第二、翻譯任務(wù),大模型參數(shù)推薦 7B;

第三、意圖識(shí)別任務(wù),大模型參數(shù)推薦 13B;

第四、Function Calling Action 任務(wù),大模型參數(shù)推薦 70B。

以上這些推薦都是針對(duì)頂尖的通用大模型而言,沒(méi)有經(jīng)過(guò) Fine-tuning 等微調(diào),微調(diào)后的或者 RAG  后的 大模型 AGI 能力會(huì)增強(qiáng),相應(yīng)參數(shù)會(huì)變化。

Llama3實(shí)操增強(qiáng)的三種方式:RAG/Agent/Function Calling?。。?-AI.x社區(qū)



本文轉(zhuǎn)載自公眾號(hào)玄姐聊AGI  作者:玄姐

原文鏈接:??https://mp.weixin.qq.com/s/HQZXuGNJ5d2oNHjBOhI3Iw??

?著作權(quán)歸作者所有,如需轉(zhuǎn)載,請(qǐng)注明出處,否則將追究法律責(zé)任
標(biāo)簽
收藏
回復(fù)
舉報(bào)
回復(fù)
相關(guān)推薦