This QLoRA adapter translates English or Indonesian questions, together with a fixed Movies schema, into read-only Cypher. It adapts Qwen/Qwen3-4B; the base weights are downloaded separately. Neo4j executes the generated query to retrieve facts.
The selected adapter is trial 2, epoch 1, step 150. Its historical test results are 52/82 correct in English and 49/82 in Indonesian, compared with 15/82 and 11/82 for the prepared base model. The target of 62/82 per language was not reached. The model remains a research and portfolio prototype for one schema and graph.
Ringkasan Indonesia: model ini menghasilkan Cypher dari pertanyaan dan schema. Bobot yang dilatih adalah adapter. Hasil evaluasi, kegagalan, data kurasi, dan cara menjalankannya tersedia agar prosesnya dapat diperiksa.
Download try_model.ipynb and open it in Google Colab with File → Upload notebook. Select a T4 GPU. Install dependencies, restart the kernel, and continue from the loading cell.
For a Linux CUDA environment:
python -m pip install huggingface_hub==1.5.0
hf download Ridopandi/qwen3-4b-text2cypher-en-id-qlora --local-dir text2cypher-model
cd text2cypher-model
python -m pip uninstall -y torchvision torchaudio
python -m pip install torch==2.11.0+cu128 --index-url https://download.pytorch.org/whl/cu128
python -m pip install -r requirements.txt
from huggingface_hub import snapshot_download
from pathlib import Path
import sys
# Pin a Hub commit SHA with revision=... for repeatable downloads.
bundle = Path(snapshot_download("Ridopandi/qwen3-4b-text2cypher-en-id-qlora", local_dir="text2cypher-model", token=False))
sys.path.insert(0, str(bundle))
from infer import Generator
generator = Generator(bundle)
result = generator.generate("Berapa jumlah film dalam graph? Tampilkan jumlahnya.")
print(result["cypher"])
print("Finished with EOS:", result["stopped_by_eos"])
infer.py retains the previously tested inference computation. One path change loads the adapter from the Hub repository root; the saved tokenizer remains in tokenizer/. It verifies the package, pins the base revision, uses prepared NF4 with FP32 floating base parameters and FP16 compute/autocast, disables thinking, and decodes greedily with a 256-token limit. A generic loader using other precision or decoding settings may produce different outputs.
Use local_dir as shown: verification expects materialized files inside the downloaded folder rather than cache symlinks pointing outside it.
The code outputs Cypher. Review its meaning and execute through read-only controls in Neo4j. The graph fixture and Neo4j server are not redistributed in this model repository. The dataset card links the exact upstream fixture. Full historical execution evidence and the local end-to-end workflow are described in the project repository, whose visibility is controlled separately.
The test contained 82 bilingual question pairs, or 164 model inputs per variant. Paired translations are correlated observations. These are project-specific curated results, not an official score on the full source dataset or a cross-schema benchmark.
| Variant | English correct | Indonesian correct |
|---|---|---|
| Prepared NF4 base | 15/82 (18.3%) | 11/82 (13.4%) |
| Selected adapter | 52/82 (63.4%) | 49/82 (59.8%) |
A completion is correct only when all six checks pass: read-only admission, syntax, execution, schema, meaning, and result. Failed or truncated outputs remain in the denominator. Semantic review was performed with an AI assistant; there is no independent human review. Query execution and matching rows alone do not establish correct meaning.
See evaluation.json for aggregate source bindings. The recorded validation explorer is included as static files; run a local HTTP server from this folder and open /demo/. It contains all 74 validation examples for both variants, with original queries, Neo4j rows, six flags, and review reasons. It does not run the model in the browser.
1cfa9a7208912126459214e8b04321603b3df60c.| Constant LR | Epoch | English /37 | Indonesian /37 | Validation NLL |
|---|---|---|---|---|
| 0.0002 | 1 selected | 21 | 21 | 0.291827 |
| 0.0002 | 2 | 15 | 18 | 0.355199 |
| 0.0002 | 3 | 18 | 14 | 0.356251 |
| 0.0002 | 4 | 20 | 18 | 0.495397 |
| 0.0001 | 1 | 22 | 19 | 0.294355 |
| 0.0001 | 2 | 17 | 16 | 0.354366 |
| 0.0001 | 3 | 19 | 17 | 0.370541 |
| 0.0001 | 4 | 17 | 20 | 0.438990 |
The 21/21 checkpoint ranks above 22/19 under that selection rule. Epoch continuation and the lower-LR experiment did not replace it. No new final test was performed for those phases or this publication. The results do not establish a globally optimal LR or epoch count.
The graph contains 38 Movie nodes, 133 Person nodes, and 253 relationships. Evaluation covers one seed and one fixed schema. Validation was reused during development. Generalization to other graphs, schemas, or production traffic has not been established.
Repeated mistakes include FOLLOWS direction and participants, extreme values and all ties, and result contracts involving null, duplicates, or false. A bounded audit covers 17 of 32 incorrect selected-checkpoint validation outputs. A separate proposed experiment would change training composition at fixed data size and update budget; it has not been run.
Data curation, translation, code, experiments, documentation, and semantic review were assisted by AI. The source dataset, authored additions, revisions, and review limits are documented in the dataset card.
The adapter SHA-256 is f0cbec87d22566192afd4546edb9700b051abc80e944e7c858ca9b3d734de530.
The recorded 8 October 2026 T4 smoke check generated the same count query for two English/Indonesian demo prompts. One Neo4j execution returned 38 movies with the graph unchanged. Generation took approximately 3.47 and 2.61 seconds; peak PyTorch allocation was approximately 4,245 MiB. These two simple demonstrations are not an accuracy or latency benchmark. Recorded evidence.
Run python verify.py to check file hashes and replay scores without a GPU. Publication checks and remote-download verification are recorded separately from the historical GPU evidence.
Adapter and publication code: Apache-2.0. Base model/tokenizer: Qwen/Qwen3-4B, Apache-2.0. Source question dataset: neo4j/text2cypher-2025v1, Apache-2.0 as declared by its dataset card. See NOTICE.md and LICENSE for attribution and scope.
Qwen/Qwen3-4B