Conversational Artificial Intelligence with Neo4j and the Unreal Engine — Part 3


In the previous part, we considered an example of describing how to handle logical conflicts on the basis of linguistic theories. We also sketched how we can introduce intentionality in AI by using Behavior Trees (BT). Let’s suppose, now that our graph is not incoherent and let’s talk about intentional moves, that is, behavior that the system exhibits while trying to reach a desirable graph configuration. This is an important difference with conversational systems based on machine learning only as they simply just react to input but without any real goal.

Taking Decisions

If the graph is not incoherent, then the system can perform intentional dialog moves and attempt to direct the graph configuration toward the desired one.

First of all, the system commits changes to the Belief Graph so that new decisions can be made on their basis. Then, it checks if open issues, like unanswered questions, are present. In this case, the graph is defined as unstable, so closing these issues takes priority. When the graph is not unstable, but it does not exhibit the goal pattern, it is undesirable. To solve undesirability, in ANGMAR, we use Bayesian Networks (BNs) to manage the decision-making process and select the strategy that will most likely take the graph to a configuration that is closer to the desired one.

FANTASIA integrates with Unreal the functionalities provided by the aGRuM library and, together with Neo4j, allows it to dynamically assemble BNs on the basis of the information collected in the graph. Briefly, BNs model causal influence between random variables so that evidence collected about one variable propagates to the rest of the network to improve the estimate of the true value of each node in the network. In the case of the movies domain, a simple example consists in building networks that consider actors, movies, and genres. The performance of the actors influences the rating of the movies they participate in, and the rating of the movies influences the rating of the genres they belong to. We assume that the rating of movies and genres is estimated as the median of their parents.

In the beginning, since we do not know anything, variables in the network have random distributions: the estimated appreciation of actors is represented by the uniform distribution over ratings, indicating that anything may be true. Depending distributions are computed accordingly. Next, we estimate the rating of movies as a Gaussian distribution over the possible ratings fitted to the Movielens ratings using Kernel Density Estimation: this constitutes soft evidence about the movies, and distributions can be updated consequently, as shown in the following Figure.

A Bayesian network with and without soft evidence applied. The probability distribution over ratings in all nodes changes accordingly to the provided information.

Asking questions

Asking questions, in this framework, corresponds to collecting hard evidence about the variables in the network. By computing the nodes’ entropy, which represents the uncertainty of the information contained in the node, and considering the general goals of the system, dialogue management strategies can evaluate the next move.

It is not possible, however, to create BNs that are as large as the entire database, as this would crash the application. BNs, however, are also graphs! This means that we can use Cypher queries to extract interesting subgraphs, graphs that are coherent with the collected beliefs about the user, from the general domain and dynamically assemble BNs, inside Unreal, on the basis of the Neo4j data structure.

In the graph, we use ontological part_of relationships to guide this part of the process. Extracting sub-graphs on which to reason with BNs may be done with graph patterns or with node embeddings, simulating what may resemble something like Artificial Instinct. Also, Graph Data Science techniques like link prediction can support reasoning, establishing how likely it is for a desirable connection to form given the available dialogue moves. The following Figure shows how this mechanism is implemented using BTs.

The Behaviour Tree uses Neo4j to extract a subgraph of interest for the user and dynamically assemble a Bayesian Network to make decisions.

Argumenting Recommendations

When producing dialog moves, it may be necessary to present inferential statements, obtained by extracting paths over nodes in the graph, to support the positions expressed by the system. Depending on the illocutionary force of the statements, and the motivations behind their expression, they may represent argumentations, if they are meant to persuade the interlocutor into accepting an unsettled claim, or they may represent explanations, if they are meant to let the interlocutor understand a point.

In terms of a BT, the illocutionary force of a statement is represented by the position (in the BT) of the task that generates the statement. In the current version of ANGMAR, inferential statements supporting the main one are explanations if they are produced to support an answer to a question. If they are generated during exploitation, the actual recommendation phase, or during the exploration phase, where more information about the user is collected, they are considered argumentations, as shown in the following Figure.

The last part of the Behaviour Tree uses the assembled Bayesian Network to decide whether to recommend an item or improve the user model by asking more questions.

This distinction is still under development as, in some cases, argumentation supports explanations and vice-versa. Through LORIEN, we are analyzing dialogues to better understand argumentation from the point of view of linguistics theory. For the purposes of this article, it is sufficient to show that, in ANGMAR, the structure of the BT and the way decisions are made concerning dialog moves represent a computational interpretation of linguistic theories. As such, ANGMAR can be used to test such theories by deploying them in specific domains, like the movie recommendation task.

Problems observed in ANGMAR, on the other hand, provide information about potential loopholes in the theoretical background, and the corresponding fixes may suggest ways to better understand the linguistic and cognitive mechanisms underlying dialog management, an advantage that was also present in old-school approaches to AI. Consistently with the general framework, argumentation moves and their relationships are being modeled in graph form to introduce a further dimension to dialog management.

For the case of recommender systems, being able to select and adequately present supporting arguments to ask for commitment from an interlocutor (accepting a movie) is a powerful ability to provide these systems with. This problem involves the capability to identify arguments that amplify the system’s claims and to present them in natural language using the correct forms. This goes beyond the well-known motivation for recommendations that sounds like “People who got this also bought that” and supports both personalization and transparency, improving quality of service and interaction. Studies concerning argumentation-based dialogues are conducted by Martina Di Bratto, one of the Ph.D. students from our lab.

Final Remarks

There are many ways in which linguistics research conducted using graph structures can inform the development of explainable-by-design technological systems.

Developing LORIEN and ANGMAR in parallel represents a formalization effort to build a two-way bridge between researchers in linguistics and computer science. The goal is to use theoretically motivated computational models to iteratively develop and test hypotheses about dialog management. This way, linguistic theories can be tested with modern instruments through simulation and interaction with real users while, on the other hand, explainable and computationally manageable AIs can be developed.

Our work, therefore, is less focused on producing final applications and is, instead, devoted to the exploration of theoretical mechanisms that, if unraveled, can lower the technological cost of developing intelligent systems using natural language as an interface.


Conversational Artificial Intelligence with Neo4j and the Unreal Engine — Part 3 was originally published in Neo4j Developer Blog on Medium, where people are continuing the conversation by highlighting and responding to this story.