Supplement S1
The Effect of Retrieval-Augmented Generation on Citation Accuracy in Question Answering over Classical Chinese Medical Texts
Dongfei Lin

Study unit and files
Each of the 120 cue IDs appears once in each of three generation conditions. The main article reports the 360 responses from the eight-slot Vulkan run. Earlier runtime checks are excluded. The study used two digital records, with no patient data. The source database, executable binaries and model weights are not redistributed here.

items.json contains the cue, stratum, exact source-supported triples, and top five windows. Each gold entry stores a witness w, volume v, eight-character continuation q, one-based physical line l in Python str.splitlines(), and zero-based Han-normalized offset j. Windows use t for the normalized text. Original record IDs and full SHA-256 hashes of both stored UTF-8 bodies are in manifest.json. A line in the digital file is not a printed folio or page.

none, metadata and full identify the three conditions. G and S are sigla for records 8669 and 8679. The volume code 0 means that the transcription supplies no explicit numbered volume. A question mark denotes an unknown response field. In audit.csv, locus requires the stated witness and volume to agree at an admissible occurrence. quote accepts the complete eight-character continuation in any admissible witness. joint requires all three fields at one and the same occurrence. prefix is the length of the longest correct initial sequence (0 through 8). abstain records any unknown field.

Reanalysis from the frozen outputs
Extract the entire archive into one writable directory. analyse.py, finite_frame.py and graphics use NumPy and SciPy or Matplotlib where imported. No external service is involved.
1. Run python analyse.py to recompute audit.csv and analysis.json from scores.json, key.json, items.json and manifest.json.
2. Run python finite_frame.py to recompute finite.json.
3. Run python support.py to repeat the deterministic first-hit extraction baseline.
4. Run python figures.py and python robust_figure.py to redraw all seven figures from the archived outputs.
5. Run python audit_check.py for a second tally of all scored fields, the primary matched table and corpus eligibility checks. SHA256SUMS.txt lists the archived files.

Independent masked rescoring
python verify.py "FULL_PATH_TO_中文古籍数据库.sqlite"
The scorer reads only the database, manifest.json, cues.json and masked.json. It checks both source hashes. It writes scores.json before any condition key is opened. key.json permits unmasking and is included to allow exact replication. Blinding is procedural and applies to scoring, not to the generator or to later analysts.

Rebuilding the benchmark and inference
python prepare.py "FULL_PATH_TO_中文古籍数据库.sqlite"
python stress.py "FULL_PATH_TO_中文古籍数据库.sqlite"
The first command deterministically constructs the items, cues and manifest. The second command repeats the 16 coupled masking permutations per cue and checks the intact-cue ranking against the archived top hit. Use a fresh directory or preserve the archive when rebuilding.

Model: Qwen/Qwen2.5-0.5B-Instruct-GGUF, qwen2.5-0.5b-instruct-q4_k_m.gguf.
Weights SHA-256: 74a4da8c9fdbcd15bd1f6d01d621410d31c6fc00986f5eb687824e7b93d7a9db
Revision: 9217f5db79a29953eb74d5343926648285ec7e67
Runtime: llama.cpp b8260 (96cfc4992), Windows x64 Vulkan build; NVIDIA GeForce MX450. The model and runtime are available at the sources cited in the article.
Start llama-server with this command (adapt model path, device identifier and executable location to the host).
llama-server -m model.gguf --port 18379 --host 127.0.0.1 -t 2 -tb 2 -ngl 99 --device Vulkan1 -fit off -c 4096 -np 8 --cache-ram 0 --no-warmup
In a fresh copy of the scripts and benchmark inputs, run:
python generate.py --url http://127.0.0.1:18379
python verify.py "FULL_PATH_TO_中文古籍数据库.sqlite"
python analyse.py
The generator resumes existing outputs. To repeat inference from scratch, use a new directory without responses_final.jsonl. The exact prompt template, grammar, seeds and token limit are given in generate.py. Raw strings, predicted token counts and prompt hashes are retained in responses_final.jsonl. Greedy generation can vary with backend, numerical precision and batch composition. Frozen-response analysis is exactly reproducible independently of the inference hardware.

Interpretation
This benchmark measures continuation and attribution of known literal fragments. Normalization removes characters outside the specified Han range before indexing and scoring. Reference alternatives are enumerated within eligible stored lines. A database witness label does not authenticate the physical exemplar. Results do not assess clinical recommendations.
