Competition for Optimizing Cypher-based RAG

LLMs occasionally mess up the relationship direction in Cypher statements, but we can fix that

Tomaz Bratanic
2 min readAug 14, 2023
Created by Midjourney

In the time of LLMs, it is becoming increasingly popular to implement Retrieval-Augmented Generation (RAG) applications, where you feed additional information to an LLM at query time to increase its ability to generate valid, accurate, and up-to-date answers. This new RAG paradigm is bringing in the revolution in data accessibility, as it means that anybody, even non-technical users, can now ask questions about information stored in the database without requiring them to learn a database query language.

For example, when you want the users to be able to ask questions about the information stored in Neo4j, a graph database, you need to implement a so-called text2cypher module that takes natural language as input and produces Cypher statements as output. State-of-the-art LLMs are pretty good at generating Cypher statements. However, most of them share a common flaw: they can sometimes mess up the direction of the relationship in the generated Cypher statement, which can cause significant dissatisfaction among users.

I believe that the direction of the relationship can be deterministically after the LLM generates a Cypher statement based on the provided schema. Therefore, I am hosting this competition to help us find the best implementation of validating and fixing relationship directions in Cypher statements as accurately and fast as possible.

The competition has a prize pool of 2500€, and we are accepting applications until Friday, 17th September 2023, 23.59 CEST.

The idea is to use the winner’s code and add it to LLM libraries like LangChain, LlamaIndex, and others. By applying to this competition, you are allowing me, or others, to re-use the provided code in any commercial or non-commercial application with appropriate attribution.

Looking forward to your applications!



Tomaz Bratanic

Data explorer. Turn everything into a graph. Author of Graph algorithms for Data Science at Manning publication.