Paper: Talk like a Graph: Encoding Graphs for Large Language Models (ICLR-2024)

Reviewer comment (Writing):
It would be nice to have at least a one-sentence description of each graph task in section 3.1. In section 3.5, the *disconnected graph task* is mentioned but it is not introduced at the beginning of section 3.1.

Author response:
### Adding task descriptions

We added the task descriptions to the beginning of Section 3.1. We also added mode detail for the disconnected node task in Section 3.5.

Reviewer comment (Novelty):
I'm not sure about the uniqueness of some of the findings in this work. Experiments 1-4 in Section 3.1 basically prove two things: 1) LLMs are sensitive to variations in prompt, and 2) larger LMs are generally more capable. While these findings are well established in LLM research, the four experiments simply corroborate them in the graph reasoning domain. I wonder if the authors might have more interpretations of these results beyond those already established in general LLM research.

Author response:
### Uniqueness of some of the findings in this work

We agree that many of the findings are in-line with the existing work in the literature. We think that demonstrating the persistence of these (some established) results, in the context of graph reasoning is essential, especially given the widespread adoption of using LLMs for reasoning.

We also showed that linear scaling does not hold for some of the tasks studied here. We observed some non-linear scaling in cycle check (see Figure 3-cycle check) and also in the new results added for the path existence task (checking if a path exists from one node to the other) upon reviewer FDET’s suggestion :

|            | Palm 2 XXS | PaLM 2 XS | PaLM 2 S |
|------------|------------|-----------|----------|
| zero-shot  | **80.9**  | 57.5     | **83.7** |
| zero-cot   | 53.9       | 25.9      | 83.2     |
| few-shot   | 44.8       | 60.5      | 81.9     |
| cot        | 53.0       | **63.6**  | 82.4     |
| cot-bag    | 54.9       | 44.3      | 81.7     |

Another finding of this work was that incident encoding performed the best across all the tasks (discussed in Section A.3).

Reviewer comment (Experiments):
For section 4, I wonder if the authors conducted a control experiment, i.e. the only difference among problem subsets is the graph construction algorithm. What factors are specifically fixed in Section 4? It would also be great to provide hypotheses as to why LLMs are better/worse at handling certain graph types.

Author response:
### Section 4 experiment setup

The generated graphs for this section are sampled randomly from the generator using similar statistics as input. To be able to report results for this section, we encoded graphs from each graph generator using the nine graph encoding functions and aggregated the results over the graph generator. We believe this setup gives us a controlled experiment to measure the effect of the graph generator.
We reported some hypotheses in Section 4.2. Here’s a summary:

* For each of the tasks, LLMs have a prior bias about the problem. For instance, for the cycle check task, LLMs have a prior bias saying there is a cycle in the graph. For instance, for the cycle check task, LLMs have a prior bias that assumes there is a cycle in the graph. Therefore, the performance is better for graphs with cycles (e.g., complete graphs) compared to those with no cycles (e.g., star graphs) (Figure 4 visualizes how these graphs differ).

* For some of the tasks with counting (e.g., node degree, node count, and edge count), the fewer the number of edges in the graph, the easier it is for the LLM to reason. For instance, star graphs have the best performance, and complete graphs have the lowest (again, Figure 4 visualizes how these graphs differ).

Reviewer comment (Experiments):
The graph, node, and edge encoding functions are simple and inefficient. The paper could use more advanced and recent graph-to-text generation techniques (i.e. [1]). Evaluating only the defined encoding methods cannot support the general claims about the power of LLMs in graph reasoning.

Author response:
Wow, great suggestion!  In this paper, we specifically studied the class of fixed text encoding functions because we observed that many users of LLM systems are relying on these fixed transformations.  Our results show that your intuition is exactly right (fixed encodings have limitations), and investigating this area is very interesting follow up work!  

For this particular reference [1], we searched for an existing model to try to use it “out of the box”, but could not find any available.  Unfortunately we do not have time in the review cycle to appropriately train this as a baseline and collect its results (as running this experiment takes significant time already).

While we initially intended to explore fixed text encoding functions, our goal was to introduce diversity in node and edge encodings. This involved employing a range of node encodings (integers, alphabet letters, popular character names) and edge encodings (friendship, co-authorship, parentheses). By combining these, we achieved a diverse set of graph encoding functions (see Appendix A.1 for more details). The choice of the encoding functions was informed by the typical user practices associated with LLMs.

Reviewer comment (Experiments):
The proposed graph encoding approaches are similar, i.e., the Friendship, Politician, Social network, GOT, and SP all depict alternative ways of stating two nodes are “connected”. Therefore, evaluating them shows the power of LLMs in interpreting the names rather than exhibiting their ability to understand underlying relations and exploit neighborhoods within a graph. This could have been considered in increasing the diversity of encoding functions.

Author response:
While we initially intended to explore fixed text encoding functions, our goal was to introduce diversity in node and edge encodings. This involved employing a range of node encodings (integers, alphabet letters, popular character names) and edge encodings (friendship, co-authorship, parentheses). By combining these, we achieved a diverse set of graph encoding functions (see Appendix A.1 for more details). The choice of the encoding functions was informed by the typical user practices associated with LLMs.

Reviewer comment (Novelty):
It might be good to introduce previous random graph generation methods. Adding some detail of these methods (even in the appendix) can be helpful to understand how they are different.

Author response:
We added descriptions for the random graph generator functions in the appendix in Section A.2.2.

Reviewer comment (Experiments):
The proposed benchmark tasks (except for edge existence) do not involve reasoning. They can be inferred without reasoning (by counting, simple arithmetic operations, and memorizing the graph structure). More challenging tasks (e.g., node classification) can enrich the experiments.

Author response:
Thanks for the great suggestion! We have added a synthetic node classification task based on GraphWorld [2], and are currently waiting for the results of this experiment to complete.  (We will update here when this is done)

We would like to note that some of the diverse tasks in our benchmark do share elements of graph classification (especially w.r.t. to motif detection).  For example, The cycle check task needs to do multi-hop reasoning over the structure of the graph in order to determine the existence of a cycle. Also, note that the node degree counting could be viewed as the simplest node regression task.  (More complex versions of this task might try to compute advanced node-level graph properties.)  Similarly, the node and edge count and cycle check might be viewed as  graph classification tasks.
Upon your suggestion on adding more complex tasks, we conducted experiments on a new task for  path existence which requires multi-hop reasoning. Here are the results:

| Prompting| Palm 2 XXS | PaLM 2 XS | PaLM 2 S |
|------------|------------|-----------|----------|
| zero-shot  | **80.9**  | 57.5     | **83.7** |
| zero-cot   | 53.9      | 25.9     | 83.2     |
| few-shot   | 44.8      | 60.5     | 81.9     |
| cot        | 53.0      | **63.6** | 82.4     |
| cot-bag    | 54.9      | 44.3     | 81.7     |

Reviewer comment (Experiments):
In Experiment 2, authors compare question and application rephrasing methods, while the difference between these two is not clear. Authors can add a few examples of rephrasing a question with these methods in the main body or appendix of their paper.

Author response:
We added this to the paper. Please let us know if this is not clear. Here’s the examples for your references:

| Task              | Graph question encoder                                  | Application question encoder                       |
|-------------------|---------------------------------------------------------|-----------------------------------------------------|
| Edge existence    | Is node Christopher connected to node Michael?          | Are Christopher and Michael friends?                |
| Node degree       | What is the degree of node 14?                           | How many friends does Christopher have?              |
| Node count        | How many nodes are in this graph?                         | How many people are mentioned in this information?  |
| Edge count        | How many edges are in this graph?                         | How many friendships are given in this information?  |
| Connected nodes   | List all the nodes connected to node Christopher.         | List all the people who are friends with Christopher.|

Reviewer comment (Experiments):
In section 3.5 experiment 5, the task description is too brief for readers to understand the experimental settings. What is specifically the "disconnected nodes task" and how to generate this data is not clear.

Author response:
### 2. Section 3.5 experiment 5: disconnected nodes task
In this task, we provide a graph description to the LLM, specifying the nodes and edges, and ask about the nodes that are \emph{not} directly connected to a given node. We updated Section 3.5 to better explain this.

Reviewer comment (Experiments):
The motivation for each experiment setting is not clear enough, I encourage authors to give their motivation in each experiment to help readers understand the necessity for the experiment.

Author response:
### 3. Adding motivations for each experiment.
Thanks! We highlighted the motivation for our experiments in the paper.

Reviewer comment (Novelty):
I believe the motivation of this work is not strong enough. Yes, there are graphs everywhere, and reasoning on graphs is essential, but why do we need LLMs to do reasoning on graphs? The LLMs are trained on unstructured textual data, making it hard to generalize to graph data. Moreover, we also have reliable and fast algorithms to solve these basic graph problems, so I believe LLMs might not be a good tool for these basic graph problems.

Author response:
### 4 and 5. Motivation for using LLMs for graph tasks.

Great question!  Our motivation is not to suggest that LLMs replace the reliable and efficient graph algorithms we all grew up with -- instead it's quite the opposite.  We believe that graph tasks are an ideal lens for understanding multi-step reasoning with LLMs.  By quantifying LLMs (poor) performance on these tasks, we highlight a significant gap with current technologies and open the door for future research in the area.

This is especially interesting, because many tasks that people ask of LLMs today reduce to graph algorithms (or have graph algorithms as essential components of their solution).  For instance, when using LLMs in problems requiring deductive logical reasoning, the LLM should be able to perform edge existence, and reason about connected/disconnected nodes.  However, there is not much work actually evaluating these capabilities.  This is especially important for cases when the question is textual (and therefore common sense knowledge is needed) and it is not obvious what out-of-the-box graph algorithm might even apply.

Reviewer comment (Novelty):
Another concern is about the novelty. The proposed graph encoder function g() in this paper is a mapping from graph space to textual space. Several previous paper [1-3] explores describing graph neighbors in natural language, and it would be better to tell the difference of this work. 

[1] Guo, Jiayan, Lun Du, and Hengyu Liu. "GPT4Graph: Can Large Language Models Understand Graph Structured Data? An Empirical Evaluation and Benchmarking." arXiv preprint arXiv:2305.15066 (2023).

[2] Chen, Zhikai, et al. "Exploring the potential of large language models (llms) in learning on graphs." arXiv preprint arXiv:2307.03393 (2023).

[3] Ye, Ruosong, et al. "Natural language is all a graph needs." arXiv preprint arXiv:2308.07134 (2023).

Author response:
Thanks for the great question. Our work uniquely investigates how properties of the graph structure (via synthetic generation) influence the choice of graph encoding function. This is completely novel, as no other related work examines these interactions. This novel approach enables us to systematically study these interactions, which have not been explored in previous research. Additionally, we conducted extensive scaling experiments with LLMs of varying parameter sizes which no other work has done. Finally, we have significant differences from each work individually, for example:  unlike [1], we study a diversity of LLMs (and have added more models in the rebuttal), unlike [2] we vary prompting and graph tasks, and unlike [3], we use a black box model without model weights.. Furthermore, we conducted experiments on varying question encoder functions to evaluate their impact on performance.

In order to clearly state the novelty of our work, we have added this following comparison table to the paper:

|                               | Guo et al.[1] | Chen et al. [2] | ye et al. [3] | Ours         |
|-------------------------------|-------------------|--------------------------|-----------------------|--------------|
| Synthetic generation          | &#10005;          | &#10005;                 | &#10005;              | &#10004;   |
| Black-box model               | &#10004;        | &#10004;               | &#10005;              | &#10004;   |
| Scaling experiments           | &#10005;          | &#10005;                 | &#10005;              | &#10004;   |
| Varying question encoding function | &#10005;     | &#10005;                | &#10005;              | &#10004;   |
| Varying edge encoding function | &#10005;          | &#10005;                 | &#10005;              | &#10004;   |
| Varying graph structure        | &#10005;          | &#10005;                 | &#10005;              | &#10004;   |
| Varying graph encoding function | &#10004;        | &#10005;                 | &#10005;              | &#10004;   |