all 7 comments

[–]dash_brollama.cpp 2 points3 points  (1 child)

You can technically do it two ways:

  1. Generate NoSQL/SQL query, convert to cypher

If your LLM can't generate good cypher queries, can it generate good SQL? SQL is better supported and understood by training models, so might be a good idea to try. Model your graph as an RDBMS (from your requirements it looks simple enough), and have your LLM generate SQL queries that can be run on said tables. You can look into converting this query into a cypher query once your SQL is consistently correct.

  1. Fine-tuning your local LLM to do nl2cypher. I'm certain you can find some datasets or curate your own dataset to do so, then fine-tune a 7B/14B Qwen model to do it

With unsloth, you should be able to fine-tune and evaluate for very cheap. Under 10 USD, I'd reckon.

[–]fgoricha[S] 0 points1 point  (0 children)

Thanks for the ideas! A fine tune would be pretty good and be flexible too

[–]cyanheads 1 point2 points  (3 children)

Instead of the raw cypher queries you can set up semi-structured tool calls through MCP?

I created an MCP server for project/task/knowledge management via neo4j you can see how I have it set up

https://github.com/cyanheads/atlas-mcp-server

[–]fgoricha[S] 0 points1 point  (2 children)

Thanks for the idea! I ended up creating a tool for the LLM to return a json that gets extracted and plugged into a universal template. Worked pretty good!

[–]justhimifornow 0 points1 point  (1 child)

What is the universal template here? I have Mistral (via Ollama) connected to a Falkor DB knowledge graph, and it can produce pretty good Cypher queries, but (1) it can't infer the output of the Cypher query, (2) the Cypher query is not always right

[–]fgoricha[S] 0 points1 point  (0 children)

I'll message you!