Improving Text2Cypher: Lessons from Schema Filtering and Hard Example Selection
summary
Neo4j builds a Text2Cypher pipeline that converts a graph schema to text and selects only relevant elements before calling an LLM, using dynamic schema filtering (regex, named‑entity masking, and similarity embeddings) to cut prompt size from ~2700 tokens to ~500 and raise exactness by ~10% (enhanced→base ≈+5%, dynamic→+5%). For training, hard example selection ranks queries by model failure on a foundation model and by Cypher complexity to keep the hard 40% and trim data, reducing training time and cost by ~60% while dropping a metric from ~75% to ~71%.
AI-written summary · about
chapters (6)
- 0:00Introduction to Text2Cypher
- 1:55Problem of translating natural language to Cypher
- 3:23Inference time optimizations with schema filtering
- 10:53Training time improvements with hard example selection
- 16:57Summary and future work
- 19:07Q&A session
related talks
14mBuilding a Text2cypher Model
43mDesigning Cypher - a Graph Query Language
22mBuilding Cypher Queries With Open-Source LLMs
28mMy Cypher Query Takes Too Long. What Can I Do ?
27mGraph-Powered Storyworlds: Using Neo4j To Keep 1M+ Word LitRPG Epics Coherent w/ AI
35mComplex Querying of Cyber Knowledge Graph for Robust Cyber Defense
46mGraph Database
24mDataEngBytes 2023 - MEL-T2-03 - Joshua Yu
