Files
smartguide/docs/thesis/plan-b-nlp.md
T
arzani 552fa2daaf
LocationBasedServices/smartguide/pipeline/head There was a failure building this commit
Added fakordb tests
2026-11-03 13:50:10 +01:00

7.4 KiB

Plan B (NLP): Learning when not to answer

Working title: Learning when not to answer: reliability-aware reinforcement fine-tuning of small language models for text-to-Cypher in German and English

Target venues: ACL, EMNLP or NAACL Findings; workshops TrustNLP, UncertaiNLP, KnowledgeNLP, GenAIK; LREC-COLING for the dataset.

The problem in one paragraph

A local model that translates questions into Cypher fails in ways the user cannot see. In this project, an 8B model without the schema invented a property, received nulls, and reported that the information "is not available"; a server-side result cap silently truncated a count; and a question about a researcher named Thomas Kaiser can only be answered over 92 name-matched companies. Accuracy on answerable questions, which is what text-to-Cypher papers report, does not capture any of this. A deployable model must do one of three things: answer, answer with a qualification, or decline. This thesis builds the benchmark for that behaviour and tests whether reinforcement fine-tuning with execution-verified, penalty-aware rewards can teach it to a small model, in two languages.

  • Text-to-Cypher fine-tuning is established, including RL: Text2Cypher (GenAIK 2025), GRPO refinement for small models (Applied Sciences 15(15):8206, 2025), multi-agent text-to-Cypher (arXiv 2511.08274), automatic dataset generation (CypherBench, ACL 2025; arXiv 2606.08481, 2606.27742, 2606.14325). All evaluate answerable questions only.
  • Reliability with infeasible questions exists for SQL (TrustSQL, arXiv 2403.15879, penalty-based scoring) and for Freebase KBQA (GrailQAbility, ACL 2023; RetinaQA, ACL 2024). Not for property graphs, not for LLM-era text-to-Cypher.
  • Abstention-aware RL exists for open-domain QA (TruthRL, arXiv 2509.25760, ternary reward; KARL, arXiv 2604.22779; TIAR, arXiv 2605.25850; search agents, arXiv 2607.10738). There the reward needs a judge or a gold string. Text-to-Cypher has a verifiable reward by execution, and a third outcome these papers do not have: the correct answer exists but rests on uncertain evidence.
  • Multilingual text-to-Cypher covers Spanish and Turkish (arXiv 2506.21445, 2601.16097). German is missing, and German compounds plus English entity names make it a real test, not a translation exercise.

Research questions

  • RQ1. Benchmark. What kinds of questions should a text-to-Cypher model not answer plainly over a real graph? Proposed categories: schema element missing, value missing, beyond Cypher, ambiguous entity (common names), outside the covered time span, aggregation over inferred links, and unsafe aggregation (result cap or timeout would truncate).
  • RQ2. Training. Does GRPO with an execution-verified, penalty-aware reward beat supervised fine-tuning on reliability, and how does the reward shape (binary, ternary, penalty-weighted, with a "qualified answer" outcome) trade accuracy against over-abstention?
  • RQ3. Language. How large is the German to English gap before and after training; does training in one language transfer; does translated training data suffice?
  • RQ4. Generalisation. Held-out schema regions (patents and companies unseen in training), compositional depth, paraphrases, and transfer to public graphs (a CypherBench graph extended with infeasible questions) so that the main results are reproducible without INSE data.
  • RQ5. What changed? Error taxonomy before and after RL; calibration of the decision to abstain.

Method

  1. Dataset. Templates filled from the graph, paraphrased by a larger model, in German and English, about 6,000 training and 1,200 test items, half answerable. Test entities and templates never occur in training. The open subgraph (OpenAlex, CORDIS, patents) is the release version; the full graph adds company and news questions for internal results.
  2. Human validation (80 hours). Two annotators validate about 400 test items for correctness of the label, category and German naturalness (kappa reported), and later classify about 300 model errors into the taxonomy.
  3. Public counterpart. The same infeasibility categories constructed on one CypherBench graph, which carries no real identity uncertainty; "aggregation over inferred links" is simulated there.
  4. Models. Qwen3-4B and 8B, Llama-3.1-8B, one Gemma model. Baselines: zero-shot and few-shot, a hosted large model, the public Neo4j text2cypher fine-tune, RL without abstention.
  5. Training. Unsloth QLoRA supervised fine-tuning, then GRPO. Reward from execution: result-set equivalence for answers, category match for abstentions, a graded reward for qualified answers (correct result plus correct flag), and a penalty c for wrong answers. Sweep c. Three seeds each.

Evaluation

Aspect Measures
Answerable questions Execution accuracy by result-set equivalence, by question type and hop count
Reliability TrustSQL-style score RS(c) for c in {0, 1, 10}; abstention precision, recall and F1 per category; over-abstention rate; risk-coverage curves
Qualification Share of uncertain-evidence questions answered with the correct flag; human usefulness rating on a sample
Calibration ECE of the answer-or-abstain decision; selective accuracy
Language German minus English gap per model and training regime; transfer matrix
Generalisation Held-out schema, depth, paraphrase; transfer to the CypherBench variant
Cost Tokens, latency, GPU hours per point of RS gained; data-efficiency curves

Statistics: bootstrap intervals, McNemar between systems, three seeds, all prompts and decoding settings released.

What gets released

Benchmark on the open subgraph in two languages, the CypherBench extension, LoRA adapters, reward and evaluation code.

Schedule

Weeks Work
1 to 4 Common start; literature; category definitions
5 to 9 Dataset generation, German versions, human validation
10 to 11 Public counterpart on CypherBench
12 to 14 Baselines and supervised fine-tuning
15 to 19 GRPO, reward ablations, seeds
20 to 22 Language and generalisation experiments
23 to 24 Error taxonomy, calibration analysis
25 to 26 Writing, paper draft

Cut order if late: drop the third and fourth base model, then the qualified-answer outcome (keep answer versus abstain). Never cut the public counterpart; without it the NLP community cannot reproduce the main table.

Risks

  • A close paper appears. The space moves fast. Mitigation: the combination of uncertain-evidence questions, a real multi-source graph and German is hard to replicate; submit a dataset paper early.
  • RL collapses into always abstaining or never abstaining. Known from TruthRL-style training. Mitigation: balanced batches, penalty sweep, KL control, report the failure honestly if it persists.
  • Template artefacts. Models learn templates rather than semantics. Mitigation: paraphrase diversity, template-held-out test split, human-written subset of 150 questions.

Reading list to start from

arXiv 2403.15879, 2212.10189, 2403.10849, 2509.25760, 2604.22779, 2605.25850, 2607.10738, 2506.21445, 2601.16097, 2412.18702, 2511.08274, 2606.08481, 2606.27742, 2606.14325; Applied Sciences 15(15):8206; "Why Uncertainty Estimation Methods Fall Short in RAG" (Findings of ACL 2025). All identifiers come from a literature search on 2026-09-17 and must be verified.