langchain icon indicating copy to clipboard operation
langchain copied to clipboard

ReAct vs MRKL

Open clayoneil opened this issue 1 year ago • 2 comments

Sorry if this is a dumb question:

Why is the ZeroShotAgent called "zero-shot-react-description" instead of "zero-shot-mrkl-description" or something like that? It is implemented to follow the MRKL design, not the reAct design. I am misunderstanding something?

Here is the code:

AGENT_TO_CLASS = {
    "zero-shot-react-description": ZeroShotAgent,
    "react-docstore": ReActDocstoreAgent,
    "self-ask-with-search": SelfAskWithSearchAgent,
    "conversational-react-description": ConversationalAgent,
    "chat-zero-shot-react-description": ChatAgent,
    "chat-conversational-react-description": ConversationalChatAgent,
}

permalink: https://github.com/hwchase17/langchain/blob/acfda4d1d8b3cd98de381ff58ba7fd6b91c6c204/langchain/agents/loading.py#L21

clayoneil avatar Apr 01 '23 22:04 clayoneil

I'm not an expert on this, but isn't ReAct a kind of MRKL system that is able to reason? ZeroShotAgent looks quite ReAct-y to me, with thoughts, observations, etc. Is there something there that indicates otherwise?

yousefamar avatar Apr 04 '23 16:04 yousefamar

check this out: **Agent Types Agents use an LLM to determine which actions to take and in what order. An action can either be using a tool and observing its output, or returning a response to the user. Here are the agents available in LangChain.

zero-shot-react-description This agent uses the ReAct framework to determine which tool to use based solely on the tool’s description. Any number of tools can be provided. This agent requires that a description is provided for each tool.

react-docstore This agent uses the ReAct framework to interact with a docstore. Two tools must be provided: a Search tool and a Lookup tool (they must be named exactly as so). The Search tool should search for a document, while the Lookup tool should lookup a term in the most recently found document. This agent is equivalent to the original ReAct paper, specifically the Wikipedia example.**

According to my understanding, MRKL is implemented by using ReAct framework in langchain ,which is called zero-shot-react-description. The original ReAct is been implemented in react-docstore agent type. ps. MRKL is published at 1 May 2022, earlier than ReAct, which is published at 6 Oct 2022.

zuojie avatar Apr 28 '23 02:04 zuojie

I suspect that the gap between LangChain's MRKL implementation (zero-shot-react-description) and what is outlined in the original MRKL paper is causing some confusion. To elaborate, the original MRKL paper is quite abstract and does not provide detailed implementation information. As such, the "MRKL system” is open to a wide range of interpretations, and ReAct could be associated as one instance of MRKL.

In my understanding, MRKL itself is not a zero-shot version of ReAct but is rather "implemented by using ReAct framework in langchain," as mentioned by @zuojie in a previous comment.

If those points are correct, I think it would be beneficial to specify them somewhere under langchain.agents.mrkl or in other documentation. It appears that some people are confused about the relationship between MRKL and ReAct.

g-votte avatar Jun 12 '23 07:06 g-votte

I am also confused about the relationship between MRKL and ReAct.

LangDaoAI avatar Jun 20 '23 12:06 LangDaoAI

Hi, @clayoneil. I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, the issue is about the naming of the ZeroShotAgent in the repository. You questioned why it is named "zero-shot-react-description" instead of "zero-shot-mrkl-description" since it follows the MRKL design. In the comments, there is some discussion about the relationship between MRKL and ReAct, with one user suggesting that MRKL is implemented using the ReAct framework in LangChain. However, there seems to be confusion among users about the exact relationship between MRKL and ReAct.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you for your understanding.

dosubot[bot] avatar Sep 22 '23 16:09 dosubot[bot]