PiVe: Prompting with Iterative Verification Improving Graph-based Generative Capability of LLMs (2024)

Abstract: Large language models (LLMs) have shown great abilities of solving various natural language tasks in different domains. Due to the training objective of LLMs and their pretraining data, LLMs are not very well equipped for tasks involving structured data generation. We propose a framework, Prompting with Iterative Verification (PiVe), to improve graphbased generative capability of LLMs. We show how a small language model could be trained to act as a verifier module for the output of an LLM (i.e., ChatGPT, GPT-4), and to iteratively improve its performance via fine-grained corrective instructions. We also show how the verifier module could apply iterative corrections offline for a more cost-effective solution to the text-to-graph generation task. Experiments on three graph-based datasets show consistent improvement gained via PiVe. Additionally, we create GenWiki-HIQ and highlight that the verifier module can be used as a data augmentation tool to help improve the quality of automatically generated parallel text-graph datasets.1

text: Findings of the Association for Computational Linguistics ACL 2024, pages 6702–6718 August 11-16, 2024 ©2024 Association for Computational Linguistics
Large language models (LLMs) have shown great abilities of solving various natural language tasks in different domains. Due to the training objective of LLMs and their pretraining data, LLMs are not very well equipped for tasks involving structured data generation. We propose a framework, Prompting with Iterative Verification (PiVe), to improve graphbased generative capability of LLMs. We show how a small language model could be trained to act as a verifier module for the output of an LLM (i.e., ChatGPT, GPT-4), and to iteratively improve its performance via fine-grained corrective instructions. We also show how the verifier module could apply iterative corrections offline for a more cost-effective solution to the text-to-graph generation task. Experiments on three graph-based datasets show consistent improvement gained via PiVe. Additionally, we create GenWiki-HIQ and highlight that the verifier module can be used as a data augmentation tool to help improve the quality of automatically generated parallel text-graph datasets.1

heading: 1 Introduction
text: Large language models (LLMs) like ChatGPT and GPT-4 (OpenAI, 2023) have been quite successful in solving different generative and reasoning tasks. The combination of their abilities in leveraging in-context learning as well as instruction following have unlocked new state-of-the-art results across the natural language processing (NLP) field. The existing LLMs are mostly pre-trained on a huge volume of unstructured data from the internet including books, articles, webtexts, repositories, Wikipedia, etc. Training on unstructured data naturally leads to relatively poor performance when dealing with tasks that demand organizing text into structured machine-readable format.
1Our code and data are available at https://github. com/Jiuzhouh/PiVe.
A semantic graph, as a form of graph-structured data, stores information in a machine-accessible way (van Harmelen et al., 2008). Generating a semantic graph from text is known as text-tograph (T2G) generation and is previously attempted mostly by fine-tuning small language models (Xu et al., 2022; Guo et al., 2020). However, generating graph-structured data remains a challenge for LLMs even in the presence of reasonable number of few-shot examples. In fact, regardless of the number of few-shot examples or prompting style the outputs from LLMs (e.g., GPT-3.5) still contain errors and require correction (§4.4).
In this paper, we focus on how to improve the graph-based generative capability of LLMs. To this end, we propose the Prompting through Iterative Verification (PiVe) framework shown in Figure 1. Specially, PiVe involves leveraging an external verifier module (i.e., a much smaller LM) and incorporating the feedback from verifier module into the prompt. PiVe iteratively utilises the verifier module and refines the prompts, via corrective instructions, before sending them back into the LLM, leading to substantially improved quality of the generated semantic graphs.
In particular, to train the verifier modules, we start from a seed dataset of text and graph (T,G) pairs, and construct an arbitrarily large graphperturbation dataset via a simple procedure which takes any graph G from the seed set and perturbs it arbitrarily on its entities (E), relations (R), or
6702
triples (Tr). The text and perturbed graph (Ḡ), along with a corrective description to invert the applied perturbation (IP) form a verification dataset of (T,Ḡ,IP) triples which serve as the training data for self-supervised learning of our verifier module. The verification dataset could be as large as desired (i.e., for any seed dataset D, containing graphs of |E| entities, |R| relations, |Tr| triples, it could produce O(|D|×|E|× |R|×|Tr|) perturbations only by deleting.2 We then devise fine-tuning and instruction-tuning to train domain-specific and unified verifiers, respectively.
During the T2G generation via the LLM (e.g., in the zero-shot setting "Transform the text into a semantic graph: Text: ... Graph:"), the verifier takes the text T, the output graph from the LLM, and sends a corrective signal to the LLM (e.g., "Transform the text into a semantic graph and add the given triples to the generated semantic graph: Text: ... Triples: ... Graph:"). This process continues till the verifier module verifies the output as correct and terminates. We refer to this as Iterative Prompting. Additionally, there is another (more cost effective) mode to the verifier module, which starts by calling the LLM once at the start to get an initial graph, and then the rest of the corrective steps are all applied step-by-step and iteratively through the verifier offline. We refer to this as Iterative Offline Correction.
Our extensive experiment results on three graphbased datasets demonstrate the effectiveness of the proposed PiVe framework in consistently improving the quality of the LLM output via providing iterative corrective guidance by an average of 26% across 3 datasets. We also create GenWiki-HIQ, a high-quality text-graph dataset and show how verifier module could be leveraged as a data augmentation technique to improve the quality of automatically constructed text-graph datasets.

heading: 2 Basic Definitions
text: A semantic graph is a network that represents semantic relations between entities. Each semantic graph has its corresponding verbalisation, and can have different textual representations. A set of triples (i.e., [subject, predicate, object]) represents a semantic graph. Given a text, the task of text-to-graph generation is to query an LLM to generate a semantic graph of the text. The semantic
2We also try other perturbation methods and show the results in Appendix C.
graph should cover the information in the text as much as possible.
To prompt the LLM, we use few-shot by showing an example of T2G in the prompt to specify the expected format of the semantic graph (i.e., set of triples). We report experiments under various number of shots (§4.6). The basic form of instruction we use in the prompt is "Transform the text into a semantic graph." followed by a text and a semantic graph pair as a demonstration. We also show results under different prompting strategies (§4.7). Different demonstrations are used for different datasets to adapt to the style of different datasets. We show the used demonstrations in Appendix G.

heading: 3 The PiVe Framework
text: We first explain our training protocol for the verifier module (§3.1), and then present our framework of iterative verification prompting (§3.2).

heading: 3.1 Verifier Module
text: The quality of the generated semantic graph from LLM prompting could be quite poor. For instance the LLM often misses triples in the generated graph. In other words, some semantic relations between entities in the text are difficult to be captured for LLMs when they are generating a semantic graph. To detect the missing or incorrect parts of the generated semantic graph, we design a verifier module.
The verifier module is trained on a small pretrained LM (§4.2). A typical graph-based dataset contains parallel text and semantic graph (T,G) pairs. For different graph-based datasets, we use their corresponding training data for the seed dataset to create data for the verifier module. In particular, for each text-graph pair in the original dataset, we create one correct instance and one perturbed instance. We concatenate the text with graph using a separator token <S> and the target is to generate a specific output, denoted as IP, during training. For correct instances, the IP is simply the word "Correct". For perturbed instances, we have two methods to create them:
• Random method: if the graph contains more than one triple, we randomly omit one triple from it and concatenate the text with perturbed graph using a separated token <S>. The target is to generate the missing part (e.g., triple Tr).
• Heuristic method: Based on the observation that LLMs tend to miss the triples whose subject and object are not in the text, in addition
to randomly omitting one triple from the graph we also omit the triple from the graph if subject and object of it are not in the text.
The output to generate for perturbed examples is the missing triple, Tr. By utilising these two methods, we can create an arbitrarily large verification dataset to train a verifier module which will be used at inference time during prompting the LLM.

heading: 3.2 Iterative Prompting
text: During the LLM prompting, the generated semantic graphs from LLMs is fed into the verifier module and the outputs from the verifier module is collected. If verifier generated "Correct" in its output, it means we do not need to make changes to the generated graph. Otherwise, the generated output from the verifier is added to the original prompt to create a new prompt. The new prompt is then used to query the LLM again. We repeat the whole process iteratively. The iteration process will stop when no missing triple is predicted or a maximum number of iterations is reached.
New Prompt Design As with the prompt used in the first iteration, we still provide an example in the new prompt for the subsequent iterations. The new prompt is "Transform the text into a semantic graph and also add the given triples to the generated semantic graph." In addition to the text, we also include some triples predicted by the verifier module which LLMs are likely to miss. This explicitly instructs the LLM to generate semantic graph and include the given triples. The given triple set contains the predicted missing triples from each iteration, which prevents the LLM from making the same mistakes as in previous iterations. See Appendix G for the used demonstrations.

heading: 3.3 Iterative Offline Correction
text: Similar to Iterative Prompting, the Offline Correction starts from the online LLM, but then continues with the step-by-step verification and correction steps offline. This approach is more cost effective as it relies only on one API call per instance (as opposed to several API calls of iterative prompting), however it is potentially weaker as it relies on the capability of the small verifier LM to both verify and apply the needed corrections. The offline correction stop under the same stopping criterion to Iterative Prompting.

heading: 4 Experiments
text: We describe the datasets and pre-processing method (§4.1), introduce the models and implementation details (§4.2) and the evaluation metrics (§4.3). In Subsection 4.4, we describe the main result from PiVe, and compare the two modes of verifier: Iterative Prompting vs. Iterative Offline Correction (§4.5). We then conduct various configurations of shots (§4.6), and prompting (§4.7). In Subsection 5, we show how PiVe could be used for data augmentation of automatically generated graph-text datasets (e.g., GenWiki).

heading: 4.1 Datasets and Preprocessing
text: We evaluate PiVe on three graph-based datasets, KELM (Agarwal et al., 2021), WebNLG+2020 (Gardent et al., 2017), GenWiki (Jin et al., 2020).
KELM is a large-scale synthetic corpus that consists of the English Wikidata KG and the corresponding natural text. It has ∼15M sentences synthetically generated using a fine-tuned T5 model. Each graph in KELM is a linearised KG containing a list of triples of the form [subject, relation, object]. If a triple has a sub-property, then it is quadruplet instead. We use a subset (∼60K) of KELM which is named as KELM-sub. The creation of KELM-sub follows two criteria. We found that most graphs in KELM contain no more than six triples and only around 2,500 graphs contain more than six triples. Therefore, 1) we only consider the graphs with no more than six triples, and 2) we do not consider the graphs containing any triple with a sub-property. Based on these two criteria, for each size of graph (from one triple to six triples), we sampled equal number of (T,G) pairs. In total, the created KELM-sub contains 60,000/1,800/1,800 samples as train/validation/test set.
WebNLG+2020 contains a set of triples extracted from DBpedia (Auer et al., 2007) in 16 distinct DBpedia categories and text description generated using diverse lexicalisation patterns. It contains ∼38K graphs and each graph has at most three different descriptions.
GenWiki is a large-scale, general-domain dataset collected from general Wikipedia which contains 1.3 million non-parallel text and graphs with shared content. It has two versions: GenWikiFULL (∼1.3M), and a fine version, GenWikiFINE (∼750K), which adds constraints on the text and
graphs to force them to contain highly overlapped entity sets. Both datasets are collected in a scalable and automatic way. GenWiki also has a humanannotated test set of 1,000 parallel text-graph pairs with high quality. Since both GenWikiFULL and GenWikiFINE are non-parallel text and graphs datasets, we cannot use it to train the verifier module. However, the relation types in GenWiki and WebNLG have some overlaps, so we use the verifier module trained on WebNLG+2020 and test it on GenWiki test set.
We use the method described in Section 3.1 to create the data for training the verifier module. Table 1 shows the statistics of the created training data on these three seed datasets.

heading: 4.2 The LLM and Verifier Modules
text: ChatGPT (gpt-3.5-turbo) is used as our default LLM to perform the T2G task.3 We also experiment with GPT-4 in Subsection 4.7. For verifier module, we use T5-Large (Raffel et al., 2020), and Flan-T5-XXL (Chung et al., 2022) as the backbone models for dataset-specific verifier module, and unified verifier module, respectively. T5 models follow the encoder-decoder architecture and treat all NLP tasks as unified text-to-text transduction tasks. Flan-T5 is instruction-fine-tuned version of T5 which was trained on 1,836 NLP tasks initialized from fine-tuned T5 checkpoint. For T5-large, we fine-tune all parameters for separate verifier modules per each dataset. While for Flan-T5-XXL, we use LoRA (Hu et al., 2022) as a parameterefficient fine-tuning method, to train a unified verifier module which can follow the instruction. When using the unified verifier, we specify the dataset name in the instructions as datasets have different naming convention for relations.
The verifier is implemented using Pytorch (Paszke et al., 2019) and Transformers (Wolf et al., 2020). For the training, we use Adam optimizer (Kingma and Ba, 2015). Details about hyperparameter setting is provided in Appendix A. For
3We also compare the graph-based generative capability between ChatGPT and GPT-3 in Appendix D and report the fine-tuned results on small language model in Appendix E.
the implementation of parameter efficient training method used in Flan-T5-XXL, we use PEFT (Mangrulkar et al., 2022) and 8-bit quantization technique (Dettmers et al., 2022). All training was done using a single A40 GPU with 48GB of RAM.

heading: 4.3 Evaluation Metrics
text: To evaluate the quality of the generated graphs given the ground-truth graphs, we use four automatic evaluation metrics:
Triple Match F1 (T-F1) calculates F1 score based on the precision and recall between the triples in the generated graph and the ground-truth. We calculate the F1 scores for all test samples and compute the average F1 score as the final triple Match F1 score.
Graph Match F1 (G-F1) focuses on the entirety of the graph and evaluates how many graphs are exactly produced the same. For all test samples, we calculate the F1 score based on the precision and recall between all predicted graphs and all groundtruth graphs. This F1 score is the final Graph Match F1 score. Since graphs are represented in a linearised way, we could not simply use the string match method to check whether two graphs are the same. Instead, we first build directed graphs from linearised graphs using NetworkX (Laboratory et al., 2008), then we consider the two graphs to be the same when all node and edge attributes match.
G-BERTScore (G-BS) is a semantic-level metric proposed by (Saha et al., 2021), which extends the BERTScore (Zhang et al., 2020) for graphmatching. It takes graphs as a set of edges and solve a matching problem which finds the best alignment between the edges in predicted graph and those in ground-truth graph. Each edge is considered as a sentence and BERTScore is used to calculate the score between a pair of predicted and ground-truth edges. Based on the best alignment and the overall matching score, the computed F1 score is used as the final G-BERTScore.
Graph Edit Distance (GED) (Abu-Aisheh et al., 2015) computes the distance between the predicted graph and the ground-truth graph. It measures how many edit operations (addition, deletion, and replacement of nodes and edges) are required for transforming the predicted graph to a graph isomorphic to the ground-truth graph. Lower GED between two graphs indicates the two graphs are more similar. In practice, the cost of each operation
is set to be 1. For each sample, GED is normalized by a normalizing constant which is the upper bound of GED to make sure it is between 0 and 1. For demonstration, we multiply GED by 100 to show more decimals.

heading: 4.4 Results
text: We report the evaluation results of using PiVe with ChatGPT on the test set of three datasets in Table 2. All results presented under Base mean the direct output of the LLM without any verification. By utilising PiVe, on each dataset, we can see the consistent improvement of the quality of the generated graphs. For instance, in GenWiki which uses the same verifier module that was trained on the training data of WebNLG, the improvement of the scores over all metrics indicates the effectiveness of PiVe. Since the graphs are generated by the LLM through one-shot learning, G-F1 as the most strict metric, it is hard to get high G-F1 score (basically aiming for exact match without any minor deviation in wording, spelling, entities, or relations).
On WebNLG and GenWiki datasets, single verifier module performs slightly better than unified verifier module. While on KELM-sub dataset, unified module performs far better. We speculate this is due to the size of training data for KELM-sub verifier module being larger than that for WebNLG and GenWiki (as shown in Table 1). Since unified verifier module combines the training data of different datasets, more training data leads to better performance for instruction-tuning. We conducted human evaluation which we include in Appendix F due to page limit.

heading: 4.5 Iterative Prompting vs. Iterative Offline Correction
text: Instead of iteratively prompting the LLM, another way to utilise the results from verifier module is to append the predicted missing triples to the previously generated graph. The results of the comparison between iterative prompting and iterative offline correction using single verifier module and unified verifier module on KELM dataset is shown in Table 3. Iterative offline correction performs worse than iteratively prompting. This might be because iteratively prompting has the chance of doing self-correction. In each iteration, when we prompt the LLM, the generated graphs can probably correct the mistakes that were made in previous iteration. For example, in Figure 4, in Base the predicted relation regarding birth date is “birth year”, while the reference is “date of birth”. As the PiVe iteration continues, in Iteration 2, the relation “birth year” is regenerated as “date of birth” even though we didn’t mention this in the prompt. Due to the page limit, we report the comparison results on WebNLG and GenWiki datasets in Appendix B. Similarly, iterative prompting can achieve better results than iterative offline correction over all using different verifier modules.

heading: 4.6 Impact of More Shots
text: While in our main experiments, for cost reason, we used only one-shot demonstrations for the LLM prompting (i.e., GPT-3.5), we show that PiVe is effective in improving the results regardless of the underlying number of shots. Here we report the results of k-shot (k=6, 8, 10) with the iterative
offline correction (i.e., only using the LLM once to get the initial graph, while the correction steps are all applied step-by-step and offline). Figure 2 demonstrates the results on KELM-sub using unified verifier with iterative offline correction. The results show, as expected, that PiVe still provides consistent improvement even with the increase in the number of shots. Additionally, as the shots grow the improvement from PiVe also increases.

heading: 4.7 Baselines on LLMs
text: To probe other prompting techniques as baselines of generating graphs from the LLM, we compare three diverse prompts. The first one we use is the default prompt used across our main experiments. This prompt is fairly direct and simple. Prompt 1: Transform the text into a semantic graph. In the second prompt, we aim to instruct the LLM to generate larger graph with more triples. This is to increase the chance of LLM recovering more triples during the generation. Prompt 2: Transform the text into a semantic graph consisting of a set of triples. Generate as many triples as possible. For the third prompt, inspired by Chain-of-thought (Wei et al., 2022; Kojima et al., 2022) approach, we also ask the LLM to generate the semantic graph in two steps. Prompt 3: Transform the text into a semantic graph consisting of a set of triples. First produce all relations
possible, then produce the graph.
We conduct experiments on ChatGPT (gpt-3.5-turbo) and GPT-4 (gpt-4) in 6-shot learning on KELM-sub, using unified verifier with iterative offline correction. The results are shown in Figure 3 (for detailed numbers see Table 14 and Table 15 in Appendix). In general, as expected, GPT-4 performs far better than ChatGPT on the T2G task, but the effect of different prompts varies across these two models. Specifically, on ChatGPT, Prompt 2 achieves the best results while on GPT-4, Prompt 1 is outperforming the rest on most metrics. PiVe can consistently improve the results across all different settings, with the biggest jump in performance emerging in the first iteration, with slight improvements also observed between the second and third iterations of correction.
We also compare PiVe with the recent SelfRefine (Madaan et al., 2023) method, which leverages LLM itself to provide feedbacks for selfrefinement. Table 4 shows the self-refine results on KELM-sub dataset. The results show that selfrefine could not provide effective feedback, thus leading to the performance drop as the iteration goes. The performance gap is obvious comparing with our PiVe result. Since LLMs are not trained as rigorously on structured data compared to text, expecting them to provide meaningful feedbacks on their outputs is expected to fail.
ChatGPT GPT4
1 2 3 1 2 3
35
40
45
Prompt
T _F
1
Iteration
1
2
3
4
ChatGPT GPT4
1 2 3 1 2 3
10
15
20
25
30
35
Prompt
G _F
1
Iteration
1
2
3
4
ChatGPT GPT4
1 2 3 1 2 3
84
86
88
90
Prompt
G _B
S
Iteration
1
2
3
4
ChatGPT GPT4
1 2 3 1 2 3 7
8
9
10
Prompt
G E
D
Iteration
1
2
3
4
ChatGPT GPT4
1 2 3 1 2 3
Prompt
Iteration
1
2
3
4
ChatGPT GPT4
1 2 3 1 2 3
10
15
20
25
30
35
Prompt
G _F
1
Iteration
1
2
3
4
ChatGPT GPT4
1 2 3 1 2 3
Prompt
Iteration
1
2
3
4
ChatGPT GPT4
1 2 3 1 2 3 7
8
9
10
Prompt
G E
D Iteration 1
2
3
4

heading: 4.8 Computational Cost and Trade-off
text: Training and Inference The training and inference of both single verifiers and unified verifier are on a single A40 GPU. Each single verifier takes around 6 hours and the unified verifier takes around 40 hours to train. The computation cost for training of verifiers is a feasible one-off cost. Once the training is finished, the inference of the verification of each instance takes 0.15s for single verifier, and 3.5s for unified verifier. See the Time column in Table 3. Different verifiers present performancespeed trade-offs and are significantly effective in augmenting the LLMs.
Stopping Criterion In theory, the verification module could run till no missing triple is predicted or a maximum number of iterations is reached. However, running more iterations increases the associated cost (i.e., OpenAI API charges). We set a maximum of 3 iterations.

heading: 4.9 PiVe Examples
text: In Figure 4, we demonstrate an example from KELM-sub test set using unified verifier. In Base, based on the prediction from the LLM, the verifier module predicts the missing triple [“Francisco Uranga”, “occupation”, “swimmer”]. By suggesting this missing triple in the next iteration of prompt, the prediction from LLM includes it. Then, the verifier predicts the missing triple [“Francisco Uranga”, “sex or gender”, “male”]. In Iteration 2, both of these two missing
triples are included in the prediction from LLM, and at this time, the verifier predicts “Correct”. The prediction from Iteration 2 contains all information correctly in the reference. See another example in Appendix H.

heading: 5 GenWiki-HIQ
text: Training a good G2T or T2G model requires a large amount of high-quality parallel text and graph pairs or pre-training protocols to accommodate for lack of data (Han and Shareghi, 2022). However, creating the parallel data by human is a labour-intensive and time-consuming work. Jin et al. (2020) proposed GenWiki, an automatically constructed large dataset containing non-parallel text and graphs with shared content. Although the text and graphs contain shared content, it can still only be used for unsupervised training due to the low entity and relation overlap between text and graph. Our verifier module can naturally serve as a data augmentation tool to improve the overlap between the text and graph of automatically constructed datasets.
Iterative Augmentation. Based on GenWikiFINE (∼750K), first we filter out the text that has little overlap with the graph. After filtering, we got around 110K text-graph pairs called GenWikiFINE-f. Then following the process described in Section 3.1, we use the WebNLG verifier module and the iterative offline correction to improve the coverage and quality of GenWikiFINE-f and formed GenWikiHIQ. The maximum number of iterations is four.
To evaluate the effectiveness of the verifier module as data augmentation tool, as well the quality of the generated graph, first we use Flan-T5-XL model to generate a description of each graph in zero-shot setting by using the prompt "Transform the semantic graph into a description." for each iteration. Then we leverage automatic quality evaluation metrics to calculate the score between the generated description and the corresponding text. Ideally, the higher the similarity between the graph and the corresponding text, the higher the score of the generated description and corresponding text. We use four commonly used quality evaluation metrics which are BLEU (Papineni et al., 2002), METEOR (Banerjee and Lavie, 2005), TER (Snover et al., 2006), BERTScore.
Result. We used the dataset-specific verifier module to do the data augmentation. We conducted four iterations and the evaluation results are shown in Ta-
ble 5. The results in Base represent the scores over non-parallel graph-text pairs from GenWikiFINE, which have low overlap between graph and text. By using verifier module iteratively, we add more missing triples to the original graph, thus leading the higher quality scores. As the iteration progresses, fewer missing triples are added and we take the augmented graph-text pairs from the last iteration as the final created GenWiki-HIQ dataset. We also conducted G2T experiments in Appendix 5.1 to further demonstrate the quality of GenWikiHIQ. The G2T model trained on GenWiki-HIQ performs far better than the G2T model trained on GenWikiFINE-f on the human annotated GenWiki test set. This indicates that GenWiki-HIQ contains parallel text-graph pairs with high overlap.
Qualitative Example. In Figure 5, we demonstrate an example from the created GenWiki-HIQ
dataset and the original graph in GenWikiFINE. After the data augmentation process, the graph in GenWiki-HIQ contains more information in text.

heading: 5.1 G2T Results on GenWiki-HIQ
text: To further verify the quality of GenWiki-HIQ dataset, we use T5-large as the backbone model to train a G2T model, which generates the corresponding text based on the graph. Then we test it on the original GenWiki test set containing a 1,000 high-quality human annotated parallel text-graph pairs. As comparison, we also train another G2T
model on GenWikiFINE-f which is the seed dataset of GenWiki-HIQ.
The result is demonstrated in Table 6. On original Genwiki test set, the model trained on GenWiki-HIQ performs far better than the model trained on GenWikiFINE-f across all metrics. This indicates that GenWiki-HIQ contains parallel textgraph pairs with high overlap.

heading: 6 Background and Related Work

heading: 6.1 In-Context Learning
text: With the scaling of model size and training corpus size (Brown et al., 2020; Chowdhery et al., 2022), LLMs demonstrate new abilities of learning from a few demonstrations which contain some training examples (Dong et al., 2023). As a new paradigm, In-Context Learning does not require parameter updates and directly performs predictions on the pre-trained language models. The provided demonstration examples in the prompt follow the same format, which are usually written in natural language templates. By concatenating a query question with the demonstrations in the prompt, LLMs can learn from the given examples and make a prediction of the query question. Previous research (Liu et al., 2022; Lu et al., 2022) has shown that the number and order of the demonstrations can influence the In-Context Learning performance. These are further points of future investigation, which could potentially improve the initial graph produced by the LLM, which could further be corrected with the PiVe framework.

heading: 6.2 Instruction-Tuning
text: Instruction-Tuning (Mishra et al., 2022; Wang et al., 2022; Longpre et al., 2023) is a framework of doing multi-task learning, which enables the use of human-readable instructions to guide the prediction of LLMs. This novel training paradigm can improve the performance of the downstream tasks and also shows great generalisation ability on unseen tasks (Chung et al., 2022; Sanh et al.,
2022). Wang et al. (2023) proposed a unified information extraction framework based on multitask instruction-tuning. Zhou et al. (2023) utilised instruction-tuning to perform controlled text generation following certain constraints. In our work, we use instruction-tuning to train a unified verifier module, which can follow the instruction to perform predictions on different datasets.

heading: 6.3 Verifiers
text: Leveraging small models could further improve the performance of LLMs. Cobbe et al. (2021) proposed to solve math word problem by utilising verifier. The verifier is used to judge the correctness of model-generated solutions. During test time, based on multiple candidate solutions generated, verifier calculates the correctness probability and the final answer will be selected by the verifier from the ranked list. Welleck et al. (2023) proposed selfcorrection, an approach that trains a small model to iteratively apply self-correction. The idea of self-correction looks similar to our PiVe. While Welleck et al. (2023) focuses on the design of a selfcorrecting language model, PiVe presents a very simple verifier module design and a simple data perturbation strategy to train such model. The ideas presented in our work are developed concurrently and independently.

heading: 7 Conclusion
text: We proposed PiVe, an iterative verification framework, to improve the graph-based generative capability of LLMs. We illustrated how a simple perturbation technique could be used to build data for training a verifier module which both verifies and corrects outputs from an LLM. We used different training strategies to build both dataset-specific verifiers with fine-tuning, and a unified verifier with instruction-tuning. Our verifier module could act both as an iterative prompting guide to improve outputs of an LLM, as well as an iterative offline correction system that starts from an LLM outputs but continuously improves it offline. The experimental results on three graph-based datasets demonstrates the effectiveness of PiVe. Furthermore, PiVe can also be used as a data augmentation technique to help improve the quality of automatically generated parallel text-graph datasets. By using verifier module, we created GenWiki-HIQ, a dataset containing 110K parallel text and graphs with high overlap for future research in text-graph domain.
Limitations
Although the proposed framework is a straightforward and effective method of improving the generative capabilities of black box LLMs in graph generation, it still has some limitations. Firstly, PiVe is only designed for few-shot prompting setting on LLMs, using an external verifier module to enhance their generative capabilities. The improvement is less significant when utilising PiVe on LMs that have been fine-tuned on the task data. Secondly, PiVe is not designed for free-form text generation tasks. Due to the unique aspect of graph, which has a specific structure, it allows for a much more fine-grained detection of errors and enables a richer corrective feedback. Translation between text and other similar modalities of data (e.g., table, SQL) can also effectively leverage our verification mechanism. Thirdly, in this work, we only focus on the triple missing mistake made by LLMs, so that the verifier module is not sensitive to the order of the head entity and tail entity. This means when the order of the head entity and tail entity in a triple of a generated graph from LLMs is incorrect, verifier module is not able to detect this type of mistake. It would be more effective if other error-detection heuristic methods are developed for creating the training dataset of the verifier.
Ethics Statement
Our work is built on top of existing pre-trained language models. Our goal was not to attend to alleviate the well-documented issues (e.g., privacy, undesired biases, etc) that such models embody. For this reason, we share the similar potential risks and concerns posed by these models.

heading: A Hyperparameter Setting

heading: B Additional Experiment Result
text: Table 9 and Table 10 show the results of the comparison between iteratively prompt and iterative offline correction on WebNLG and GenWiki datasets.

heading: C Effect of Perturbation Method
text: As described in Section 3.1, we perturb the graph by omitting one triple when building the verifier module of PiVe. In addition, we also investigated other perturbation methods to train a verifier module, such as perturbing the head entity, relation and tail entity. To be specific, for head entity perturbation, if the graph contains more than one triple, we randomly choose one triple and replace the head entity with a different head entity from other triples of the same graph. Likewise, we replace the relation and tail entity for relation perturbation and tail entity perturbation, respectively. The target is
to predict the original triple. Then we train different verifier modules using these three perturbation methods on KELM-sub. The results of doing different perturbations using Iterative Offline Correction is shown in Table 11.
Comparing with the result of omitting triple perturbation method shown in Table 3 using Single Verifier with Iterative Offline Correction, these three perturbation methods have varying effects. While the relational perturbation works in terms of T-F1, with more iterations, the G-BS score generally goes down for all these perturbations. This indicates the verifier module could potentially inject wrong corrections if not trained with the proper perturbation mechanism. We speculate the reason is because LLMs are less likely to make mistakes at entity level, so these perturbation methods are not useful for training a verifier module. This also indicates when building a verifier module, choosing reasonable perturbation methods is significant and necessary.

heading: D ChatGPT vs GPT-3
text: To further highlight the generalisation ability of PiVe, in addition to ChatGPT, we also experiment with GPT-3 (text-davinci-003) as the backbone LLM to perform the T2G task. We perform experiments on KELM-sub dataset using iterative prompting and iterative offline correction with different verifiers. The results are shown in Table 13. Compared with the results of using ChatGPT (shown in Table 3), GPT-3 has a better graph-based generative capability. Nonetheless, PiVe can still consistently further improve its results over all settings. Using iterative prompting with the unified verifier can achieve the best result on KELM-sub.

heading: E Comparison with Fine-tuned Baselines
text: While our work focuses on the fundamental question of "How can we improve the generative capabilities of black box LLMs in graph generation?", for completeness we also provide results of finetuned T5 (Raffel et al., 2020) in Table 12. As expected, fine-tuning on large amount of data surpasses few-shot prompting. This underscores the struggle LLMs face in transduction problems, and the need for additional mechanisms (like PiVe) to help LLM improvement.

heading: F Human Evaluation
text: We conducted a human evaluation on 105 randomly sampled instances from three datasets (KELM-sub, WebNLG, GenWiki). Specifically, for each dataset, first we took the test set outputs from the first iteration and the last iteration, then we randomly sampled 35 instances from those with different outputs. The output from the first iteration is the original ChatGPT output without using PiVe, and the output from the last iteration is the result after using PiVe. For the evaluation process we recruited three annotators (1 PhD graduate and 2 PhD students in Computer Science and NLP) to select, for a given
text and two graph outputs, which graph matches the text better. Each annotator should only choose one graph per each instance and evaluate all 105 instances.
After annotation, we took majority voting over the result of each instance, then calculated the number of wins for ChatGPT with or without PiVe. The results are shown in Table 16. From the results, we can see ChatGPT with PiVe wins on 85 out of 105 samples and the total winning rate is over 80%. This indicates the PiVe can effectively improve the graph-based generative capability of LLMs.
For the cases that PiVe failed to improve, we did error analysis and found that there were mainly two types of mistakes that PiVe made: redundancy and inaccuracy. In Figure 6, we demonstrate two examples containing these two types of mistakes shown in red text. In the first example, the triple [“Train song Mermaid”, “instrument”,“Singing”] predicted by PiVe is redundant. In the second example, the relation
“date Of Retirement” in the triple [“Alan Shepard”,“date Of Retirement",“1963”] is inaccurate. We speculate these behaviours were caused due to the presence of many similar texts with similar graphs in the training data. During training, PiVe learned the potential connections between these similar graphs, thus leading to redundant and inaccurate triples at prediction.

heading: G Demonstrations in Prompt
text: Figure 7 shows the demonstrations used for KELMsub and Figure 8 shows the demonstrations used for WebNLG and GenWiki. In Iteration 1, we use the demonstration that does not contain the missing triples. For subsequent iterations, we include the missing triples in the demonstration.

heading: H PiVe Examples
text: Figure 9 illustrates another example of PiVe from WebNLG test set using single verification module. In Base, the verification module predict the missing triple [“Agremiação Sportiva Arapiraquense”, “ground”, “Estádio Municipal Coaracy da Mata Fonseca”], even
though there is a similar triple but containing mistakes in the prediction from the LLM. In Iteration 1, the LLM corrects the mistakes in the previous iteration, and also includes the predicted missing triple. Based on the prediction from the LLM, the verification module predict the missing triple [“Campeonato Brasileiro Série C”, “country”, “Brazil”]. In Iteration 2, the verification module predict “Correct” to the final prediction from the LLM. After three iterations using PiVe, the predicted graph contains all information in the reference.

heading: Future Work
text: By using verifier module, we created GenWiki-HIQ, a dataset containing 110K parallel text and graphs with high overlap for future research in text-graph domain. Limitations
Although the proposed framework is a straightforward and effective method of improving the generative capabilities of black box LLMs in graph generation, it still has some limitations. Firstly, PiVe is only designed for few-shot prompting setting on LLMs, using an external verifier module to enhance their generative capabilities. The improvement is less significant when utilising PiVe on LMs that have been fine-tuned on the task data. Secondly, PiVe is not designed for free-form text generation tasks. Due to the unique aspect of graph, which has a specific structure, it allows for a much more fine-grained detection of errors and enables a richer corrective feedback. Translation between text and other similar modalities of data (e. g. , table, SQL) can also effectively leverage our verification mechanism. Thirdly, in this work, we only focus on the triple missing mistake made by LLMs, so that the verifier module is not sensitive to the order of the head entity and tail entity. This means when the order of the head entity and tail entity in a triple of a generated graph from LLMs is incorrect, verifier module is not able to detect this type of mistake. It would be more effective if other error-detection heuristic methods are developed for creating the training dataset of the verifier