# Using Large Language Models for Goal-Oriented Dialogue Systems
## 3 Materials and Methods
The standard version assumed the use of a graph whose edges represented a group [step number; cluster]. 2. With the global heuristic approach, not only were edges formed by groups [step number; cluster], but also edges that indicated a global step were used. Such a heuristic allowed one to create more scenarios and avoid abrupt endings of dialogues. Global steps in the graph were created if there was no local transition for a given intent. 3. With the tree heuristic approach, the dialogue graph was formed as a tree. Tree heuristics assumed continuation of separate development after the first disconnection. Such a heuristic allowed one to improve the accuracy of the answers given by increasing the probable scenarios without an answer. Twenty dialogs were selected in a random manner from MultiWOZ 2.2 dataset, and the dialogue graph was visualized for each of the three abovementioned approaches. The visualization of the three approaches is shown in Figure 2. The vertices characterize the intent of each utterance, and the edges characterize the transitions between them. The column number characterizes the dialogue turn. The number of vertices in each column corresponds to the number of intents at each turn of the dialogue. The results of the BLUE and BERTScore metrics on the LlaMA model showed that the dialogue graph with global heuristics showed the best result. The tree heuristics showed the worst result. Based on these results, we could conclude that the lack of response in a dialogue was crucial. A large number of vertices at the last step of the global heuristic method was used to handle the cases when there is no transition from the \(i\)-th step to the \(i+1\) step in the graph. Visualization of some dialogue graphs is presented in Section 4.2. The results of the comparison of the two methods are presented in Section 4.4. Figure 2: (**a**) Visualization of a standard dialogue graph with BLUE = 0.21483 and BERTScore = 0.82314 metric values. (**b**) Visualization of a dialogue graph with a global heuristic represented by the last column with BLUE = 0.22152 and BERTScore = 0.85113 metric values. (**c**) Visualization of a dialogue graph with a tree-based heuristic with BLUE = 0.19863 and BERTScore = 0.76367 metric values. Generation of a Scenario Graph for a Goal-Oriented Dialogue System with Preservation of the Dialogue Context Based on an LLM Without Additional Training on Labeled Dialogues  
The basic idea of an LMM-based dialogue agent is shown in Figure 3. RAG technology [55] is used to add relevant information to the context to build a model response to the user. Using RAG is a process of optimizing the output of a large language model to improve its quality. The proposed prompt-based approach is summarized in Algorithm 2. Figure 3: The basic idea of an LMM-based dialogue agent iterative operation. The general algorithm of an LMM-based dialogue agent is as follows:  
1. The first step is to initialize the dialogue agent in the form of an assistant for user service. The dialogue agent initialization prompt \(P^{\mathit{init}}\) in Russian/English is presented in Figure 4.
2. Having received a user utterance \(U_{t}\), it is necessary to extract the intent using prompt \(P^{\mathit{intent}}\) from Figure 1a. 3. The next step is to check for the successful dialogue completion. Prompt \(P^{\mathit{end}}\) in Russian/English is presented in Figure 5a. If the dialogue completion is successful, the dialogue state becomes \(S_{t}\) = \"_end_\". Otherwise, the following is necessary: 3.1. The next step is to generate an output \(R_{t}\) based on the intent \(I_{t}\) and the current context of dialogue \(Context\). 3.2. After generating the LLM output \(R_{t}\), it is necessary to validate this output. Prompt \(P^{\mathit{end}}\) in Russian/English is presented in Figure 5b. 3. After validation, \(Context\) is updated, and the validated response \(R^{{}^{\prime}}_{t}\) is sent back to the user. 3.4. The iteration number \(t\) is increased by one. All steps are repeated until the dialogue end intent is reached in step 3.