Optimizing Text-to-Cypher Fine-Tuning for Neo4j

Краткое содержание

This Neo4j community thread explores strategies for improving Text-to-Cypher model performance. Members discuss fine-tuning the Qwen3-4B model using Unsloth, analyzing error patterns in complex queries, and optimizing schema representation. The discussion provides technical insights into dataset preparation and iterative model training to overcome common pitfalls in natural language to graph query translation.

magiccactus-56 OP

Hi I’m looking for some guidance on fine-tuning a model for Text-to-Cypher.

I’ve been fine-tuning Qwen3-4B using Unsloth and currently getting around a 41% success rate. For evaluation, I’m using the Neo4j Text2Cypher dataset, where the model receives the graph schema + natural-language question and predicts a Cypher query. I then execute the predicted query against Neo4j, and if it produces the correct result, it’s counted as a success.

I’ve experimented with different volumes/versions of my synthetic training dataset, but I’m struggling to get the performance beyond this point.

Would really appreciate any guidance on dataset preparation, fine-tuning strategy, or common pitfalls for this kind of task. Thanks!

@magiccactus-56 Hi I’m looking for some guidance on fine-tuning a model for Text-to-Cypher. I’ve been fine-tuning Q…
happybeacon-37

oh just saw this threads

happybeacon-37

let me take a look

@happybeacon-37 oh just saw this threads
magiccactus-56 OP

Lemme know your thoughts or need more details on this. Thanks 🙏

@magiccactus-56 Lemme know your thoughts or need more details on this. Thanks 🙏
happybeacon-37

probably knows the best in terms of the specific members on the team that has expert opinions...

happybeacon-37

but.. have u taken a look at the error case.. for example, whats the reason for the error

happybeacon-37

one technique that's very practical for optimization is to look at the error case. and then figure out a solution (not a hard coded, but a general categorization) and then fix for specific reason, and u keep iterating until u can sort out of most of them

@happybeacon-37 one technique that's very practical for optimization is to look at the error case. and then figure…
magiccactus-56 OP

aah... i was doing the same thing obseve the patterns on what cases was it failing? most of them were failing on complex query where multiple joins/relationships where there! so added those examples in dataset and retrained but still the success rate is 41%.

@magiccactus-56 aah... i was doing the same thing obseve the patterns on what cases was it failing? most of them we…
happybeacon-37

do you know in general at which step did the model go wrong, for example, right relationship but wrong direction, vs right structure but missing a hop, or the right tranversal but wrong aggregation int he end

@magiccactus-56 aah... i was doing the same thing obseve the patterns on what cases was it failing? most of them we…
happybeacon-37

also how are u currently feedding the schema to the AI

@happybeacon-37 do you know in general at which step did the model go wrong, for example, right relationship but wr…
magiccactus-56 OP

I have consolidated all the info to this repo iwth the training code + synthetic dataset: https://github.com/BeastxD7/Text2Cypher

my next plan is to train wit neo4j dataset itself.

goldenquartz-17
  • I was told by the team you reached out on LinkedIn and I believe your receive a reply there. Once you have a solution there, will you share with the community too?
@goldenquartz-17 - I was told by the team you reached out on LinkedIn and I believe your receive a reply there. Once…
magiccactus-56 OP

Yeah sure! I am experimenting now with the neo4j dataset. For fine-tuning.

@goldenquartz-17 - I was told by the team you reached out on LinkedIn and I believe your receive a reply there. Once…
magiccactus-56 OP

Hi , isthere any publically available benchmarking code for text2cypher to evaluate my model? i see that you have released dataset for it! but there is no specific code on evals like there is 2 approachs right? real graph db execution math and semantic. I would love to understand how neo4j evaluates a text2cypher model.

@magiccactus-56 Hi , isthere any publically available benchmarking code for text2cypher to evaluate my model? i see…
magiccactus-56 OP

👀

Последнее от Neo4j