Research on advanced prompting techniques for language models has extended chain of thought and tree of thought prompting to graph-structured reasoning processes. But, did you know that there are two versions of “graph of thought” prompting that have been proposed already?
Some background. Advanced prompting techniques like chain of thought and tree of thought prompting have drastically improved the ability of large language models to solve complex, reasoning-based tasks. Forcing the LLM to construct a step-by-step response to a problem drastically improves its problem-solving capabilities, but all of these techniques assume that the reasoning process is linear.
“Human thinking is often characterized by its ability to make sudden leaps and connections between seemingly unrelated ideas, which can lead to novel insights and solutions. This non-linear, jumping thought process is a hallmark of human creativity, reasoning, and problem-solving abilities.” - from [1]
Graph-based reasoning. Humans do not seem to perform reasoning based on individual chains of thought. Rather, we make leaps and connections between ideas that lead to novel insights. Inspired by this idea, researchers have recently extended chain and tree of thoughts prompting to a graph-structured approach. We will take a look here at two (independent) papers that have already been written on this topic.
Graph of thought reasoning (GOTR). In [1], authors proposed a two-stage technique that:
1. Outputs a problem solving rationale given text (and potentially images) as input.
2. Outputs a final answer given the original input concatenated with a rationale.
This approach uses an encoder-decoder structure and is fine-tuned end-to-end. Several encoders ingest data from each of the different modalities that are considered. The output of these encoders is combined in a fusion layer, then passed to a decoder to generate output.
Where does the graph come in? So far, it seems like GOTR does not use any graphs within its reasoning process. However, the model creates a named entity graph based on the input text and generated rationale. Then, this graph is ingested by a graph attention network encoder and combined with all image/text features. As such, the decoder receives information from text, image, and graph-based inputs!
GoT prompting. In [2], authors follow a more traditional prompting approach, called graph of thought (GoT) prompting, that uses a system of causal LLMs and prompts to perform reasoning according to a graph structure. The reasoning process is modeled as a graph, where each node represents a thought or (partial) solution and connections indicate that a certain thought was generated from some other thought.
A system of LLMs. GoT prompting has several “modules” that control the reasoning process, including a top-level controller (controls the reasoning process), a parser (verifies and extracts LLM output), a scorer (judges the quality of solutions), and a prompter (writes prompts for each different module). Together, these modules can transform the underlying graph structure and work towards solving a reasoning problem.
TL;DR: Modeling an LLM’s reasoning process as a graph structure can be beneficial for certain problems and is (arguably) more comparable to the human reasoning process. But, these techniques tend to be more costly than basic CoT prompting and only provide a tangible benefit on select problems. For more details, check out the overview of these techniques that I just wrote for my newsletter.
--------
[1] Yao, Yao, Zuchao Li, and Hai Zhao. "Beyond Chain-of-Thought, Effective Graph-of-Thought Reasoning in Large Language Models." arXiv preprint arXiv:2305.16582 (2023).
[2] Besta, Maciej, et al. "Graph of Thoughts: Solving Elaborate Problems with Large Language Models." arXiv preprint arXiv:2308.09687 (2023).
https://twitter.com/cwolferesearch/status/1696282034145006006?s=20