This website stores cookies on your computer. These cookies are used to collect information about how you interact with our website and allow us to remember your browser. We use this information to improve and customize your browsing experience, for analytics and metrics about our visitors both on this website and other media, and for marketing purposes. By using this website, you accept and agree to be bound by UVic’s Terms of Use for web and social media privacy.  If you do not agree to the above, you can configure your browser’s setting to “do not track.”

Skip to main content

Cyrus Parsons

  • BSc (University of Victoria, 2024)

Notice of the Final Oral Examination for the Degree of Master of Science

Topic

Does Chain-of-Thought Distillation Help Text-to-Cypher? A Matched-Baseline Study of How It Fails and What Helps Instead

Department of Computer Science

Date & location

  • Monday, December 7, 2026

  • 1:00 P.M.

  • Virtual Defence

Reviewers

Supervisory Committee

  • Dr. Alex Thomo, Department of Computer Science, University of Victoria (Supervisor)

  • Dr. Ekaterina Kochmar, Department of Computer Science, UVic (Member) 

External Examiner

  • Dr. Ardeshir Shojaeinasab, Department of Electrical and Computer Engineering, University of Victoria 

Chair of Oral Examination

  • Dr. Issa Traore, Department of Electrical and Computer Engineering, UVic 

Abstract

Graph databases such as Neo4j store entities and the relationships between them, and are queried in Cypher, a language whose central construct is a connected path through the data. Translating a question asked in plain language into a Cypher query (Text-to-Cypher) would make such databases usable by people who know neither the language nor the layout of the data, and small open-weight language models of 8 to 9 billion parameters are an attractive way to do it, since they can be run cheaply and on premises. A prominent technique for improving such models on the related Text-to-SQL task is chain-of-thought (CoT) distillation, in which a large “teacher” model writes step-by-step reasoning for each training example and the small model is fine-tuned to produce the reasoning before the query. 

This thesis asks whether CoT distillation helps Text-to-Cypher, how it fails when it does not, and what helps instead. The thesis answers these questions with matched comparisons. Each experiment trains two models from the same base model, on the same examples, with the same settings, differing only in whether the training target is the query alone or the teacher’s reasoning followed by the query. Measured this way, CoT distillation does not help. It lowers accuracy on the Neo4j Text2Cypher benchmark for two base models (Gemma-2-9B and Llama-3.1-8B), on ZOGRASCOPE’s in-distribution, com positional and length-generalization tests, and on CypherBench, whose test graphs never appear in training. It also lowers accuracy on SQL, by about ten points of execution accuracy on Spider, and lowers GLEU on SPARQL. Training only on reasoning verified by execution does not rescue it, and a weaker training recipe shrinks the penalty without reversing it. 

An analysis of the failures on ZOGRASCOPE shows that the CoT model usually finds the right relationship types and then assembles them wrong, dropping hops, misshaping the pattern, or copying filter values that were corrupted in the reasoning. The thesis proposes that a Cypher pattern is a single connected object that must be produced whole, and confirms a prediction of this hypothesis. Reasoning that states the whole path at once recovers 21 to 46 percent of the lost accuracy, though no reasoning format reaches the direct model. What helps instead is a careful training recipe. Computing the training loss on the query alone, rather than on the long schema-filled prompt as well, raises execution accuracy by 4.6 points on the Neo4j benchmark and 10.1 on Spider, and voting among sampled queries by their execution results beats voting by their text. Finally, measured against the benchmark’s published model instead of a matched baseline, CoT appears to add 0.12 GLEU, a gain that comes entirely from differences in training, so a published model cannot serve as a control.