Abstract
Background. A correctly attributed work can still be cited with the wrong volume or with words drawn from another version. This study tested whether passage retrieval improves all three elements of a citation in a controlled classical Chinese quotation task.
Methods. A paired experiment sampled 120 twelve-character cues from two digital transcriptions in the cold-damage tradition. Forty cues occurred only in the Guilin text, 40 only in the Song-labelled text, and 40 in both. Qwen2.5-0.5B-Instruct generated a witness, a juan (volume) designation, and the next eight characters under three conditions. An automated scorer masked to condition accepted any complete citation attested at one occurrence.
Results. The correct witness and volume designation were supplied for 79/120 questions (65.8%) without retrieval and 117/120 (97.5%) under each retrieval condition. The paired gain with full retrieval was 31.7 percentage points (95% stratified bootstrap CI 29.2–33.3). All three conditions scored 0/120 on complete citations. The observed joint difference was 0.0 points (conservative finite-frame 95% CI −11.9 to 11.9). Although 117 first-ranked windows contained a valid continuation, 64 full-retrieval answers repeated eight characters from the cue itself.
Conclusions. In this small model, retrieval improved source localization without producing a single exact continuation. For known-fragment questions, copying the verified span directly from the retrieved record yielded 117 supported citations and three abstentions. Bibliographic accuracy and positional quotation accuracy warrant separate reporting.
Keywords. retrieval-augmented generation, textual criticism, classical Chinese medicine, quotation verification, Shanghan lun, digital humanities
1 Introduction
A reader following a citation to the Shanghan lun needs to know which text to consult. Qian’s examination of surviving Ming printings illustrates the bibliographic complexity behind the familiar designation “Song edition.”1 A database title bearing that designation identifies a digital record. Establishing its relation to a particular printed copy requires additional evidence.
Retrieval-augmented generation (RAG) supplies a language model with material selected from an external collection.2 Citation benchmarks such as ALCE evaluate how well cited documents support generated claims.3 TCM-3CEval evaluates knowledge of classical medical literature alongside foundational knowledge and clinical decision-making.4 An edition-sensitive quotation poses a different question. Can a reader find these very characters at the location the answer specifies? A continuation attested in both transcriptions may permit either citation. A reading unique to one must travel with the correct locator.
Holding the query and generator fixed, this study varied access to a retrieved passage. A metadata-only condition isolated what the witness and volume fields contributed before the model saw any source wording. The outcome was deliberately narrow enough for exhaustive verification against the two digital texts.
2 Materials and methods
2.1 Source records and sampling
Two explicitly labelled records in the local Chinese Classics SQLite database were selected because they represent related cold-damage texts with substantial verbal overlap. G denotes the Guilin-labelled Shanghan zabing lun and S the Song-labelled Shanghan lun. The unit called a witness below is a digital transcription identified by a database record and content hash. Neither identification establishes a physical exemplar, publication date, or line of descent. No clinical records were used.
Table 1. Source records and evaluable material.
Digital witness | Book / text ID | Stored characters¹ | Eligible lines | Juan evidence |
|---|---|---|---|---|
G 伤寒杂病论桂林古本 | 8669 / 173542 | 96,905 | 1,371 | 16 explicit headings |
S 伤寒论宋版 | 8679 / 173548 | 47,462 | 648 | No explicit heading for a numbered juan |
¹ Unicode code points in the complete stored text, including punctuation, whitespace and prefatory material. Eligible line counts apply after the boundaries and length rules described below.
Figure 1. Paired sampling and masked verification. Each sampled cue entered all three conditions once. Stratification refers to the witnesses that support a full eight-character continuation.
2.2 From source lines to quotation questions
The corpus began at the first numbered juan heading in G and at Bian mai fa (辨脉法, “method of distinguishing pulses”) in S. A G line inherited the most recent numbered heading. The S record retained section headings but supplied no explicit numbered juan, so its volume field was recorded as 0, meaning “unrecorded in this transcription.” All spans stayed within a stored line. Characters outside Unicode U+3400–U+9FFF were removed, including punctuation, spaces and Arabic numerals. Graphic variants within that range were preserved. The endpoint therefore measures a normalized character sequence.
Lines retaining at least 20 characters contributed their first 12 characters as a candidate cue. Identical cues were collapsed. Every occurrence with eight available following characters in any eligible line was then enumerated, including internal occurrences. Of 1,413 distinct cues, 812 had support only in G, 212 only in S, and 389 in both. A seeded random sample without replacement selected 40 per stratum. This allocation gave equal weight to the two exclusive strata and to shared wording. The sample size was a design choice for a local benchmark.
2.3 Retrieval and generation
Each line was indexed in windows of up to 64 characters at a stride of 48. Windows shorter than eight characters were discarded. The 2,423 windows were ranked by BM25 over character bigrams with k₁ = 1.2 and b = 0.75.5 Each distinct query bigram contributed once. Ties followed corpus order (G before S, then line and offset). The generator received at most the first-ranked window. Ranks two through five were retained for a coverage analysis.
Qwen2.5-0.5B-Instruct, quantized in Q4_K_M, ran locally with llama.cpp build b8260.6,7 All conditions used the same Chinese instructions, model weights, greedy decoding, seed 42, and a 48-token limit. An output grammar constrained the three fields and admitted a question mark for an unknown value. Generation order was shuffled across all 360 calls. Each request carried a fresh prompt with no previous answer. A user question supplied the 12-character cue, asked for one supported witness and juan, and requested the next eight characters.
Table 2. Experimental contrast and information available to the generator.
Condition | Evidence added to the cue | Interpretive purpose |
|---|---|---|
No retrieval | No record or passage. Both sigla defined. | Measures performance from prompt and model weights. |
Metadata only | Witness and juan of the first-ranked window. | Tests the value of access to the retrieved locator. |
Full retrieval | Same locator plus the normalized text of that window. | Tests the additional value of source wording. |
2.4 Masking and reference standard
Before scoring, each answer received a random identifier. The scorer received the item number, identifier and generated string. The condition key was held in a separate file. A second implementation read the two source records, checked their hashes, counted the G headings in order, and reconstructed all admissible triples for each cue. The condition key was joined only after the scores had been written. Masking applied to the automated scorer. No human expert adjudicated these records.
2.5 Outcomes and statistical analysis
A complete citation required the witness, volume designation and all eight characters to agree at one occurrence of the cue. Three diagnostic outcomes assessed witness alone, witness with volume, and the exact continuation in any eligible witness. For shared cues, separately correct fields could still form an unsupported combination. An unknown or malformed field failed the corresponding test. Every generated answer contributed to the denominator.
The primary comparison was the within-cue difference in complete-citation accuracy between full and no retrieval. A two-sided exact McNemar test compared gains with losses among discordant pairs.8 Percentile 95% confidence intervals (CIs) resampled paired cues within strata, 20,000 times, preserving 40 cues per stratum. Intervals describe item variability conditional on these sources and this model. Field and stratum analyses are descriptive. No multiplicity adjustment was applied. A sensitivity analysis weighted stratum estimates by 812, 212 and 389 eligible cues respectively.
To separate retrieval failure from generation failure, a retrieved window counted as supportive only if it contained the cue immediately followed by a valid continuation in its own witness and volume. An auxiliary stress test randomly hid 0, 2, 4, 6 or 8 cue positions. Bigrams touching a hidden position were omitted, with no new adjacency created. Sixteen seeded permutations per cue supplied nested masks at the five levels. The original, unmasked reference remained the target. No generation was run for the masked cues.
3 Results
3.1 Paired citation accuracy
All 120 questions failed the joint endpoint under both full and no retrieval. There were no discordant pairs, so the exact McNemar comparison had no information about the direction of change (P = 1 by convention). The paired difference was 0.0 percentage points. The bootstrap collapsed to zero because every sampled difference was zero. A conservative finite-population 95% interval for the balanced estimand extended from −11.9 to 11.9 points. Equal observed counts do not establish equivalence. Table 3 gives the outcomes and Figure 2 the paired contrasts.
Table 3. Citation accuracy and use of the unknown marker. Cells show correct answers / 120 and percentage, except for the last row, which counts any field marked unknown.
Outcome | No retrieval | Metadata only | Full retrieval |
|---|---|---|---|
Witness | 80/120 (66.7%) | 119/120 (99.2%) | 119/120 (99.2%) |
Witness and volume | 79/120 (65.8%) | 117/120 (97.5%) | 117/120 (97.5%) |
Exact eight characters | 0/120 (0.0%) | 0/120 (0.0%) | 0/120 (0.0%) |
Complete citation | 0/120 (0.0%) | 0/120 (0.0%) | 0/120 (0.0%) |
Any unknown field | 0/120 (0.0%) | 0/120 (0.0%) | 0/120 (0.0%) |
3.2 What the retrieved locator and passage each contributed
Without retrieval, the model named S on every question. That default earned witness credit on all 40 S-only and all 40 shared cues. Full retrieval increased witness accuracy from 80 to 119 and joint witness–volume accuracy from 79 to 117. The latter contrast comprised 39 gains and one loss. Metadata alone produced the same aggregate locator score. Adding the passage left exact continuation accuracy at zero.
Figure 2. Paired changes in the accuracy of citation fields. Points show full retrieval minus no retrieval. Intervals are conservative, endpoint-specific 95% finite-frame bounds obtained by hypergeometric inversion within the three sampling strata. Numeric labels give the estimate and bounds in percentage points.
3.3 Numbered volumes and shared readings
For G-only cues, full retrieval identified the correct witness and numbered juan for 39/40, with 0/40 complete citations. For S-only cues, the corresponding values were 39/40 and 0/40. In S, credit means the response named S and correctly indicated the absence of an explicit number. These two locator outcomes test different abilities. The shared group permitted either text when all fields agreed with one occurrence.
Figure 3. Locator accuracy and cue repetition by stratum. Cells count events among 40 cues per row. Panel A scores the locator against the source. Panel B counts answers that copied eight characters from the cue itself, a positional error in this sample. Shading spans 0–100%.
Eleven shared cues admitted more than one continuation. Reweighting the three strata to the 812, 212 and 389 eligible cues gave an estimated complete-citation difference of 0.0 points (conservative finite-frame 95% CI −12.2 to 12.2). The bounds account for unsampled cues by inverting hypergeometric tails for gains and losses in each stratum with Bonferroni coverage across the six counts.
3.4 Quotation fidelity after a source was found
The first-ranked passage contained a complete eligible span for 117/120 cues (97.5%). Searching the first five raised coverage to 120/120. Among the first-rank hits, 0/117 led to a correct complete citation. Figure 4 distinguishes failure on the first character from divergence later in the continuation. A single changed character is enough to invalidate an exact quotation.
Figure 4. Length of the correct opening sequence. Each point counts answers whose initial characters match an admissible continuation for at least the indicated length. There were 120 attempts per arm. Only two full-retrieval answers matched even the first character. Curves overlap at zero.
Figure 5. First failed verification step by condition. Each answer occupies one category. Verification proceeds in the order witness, volume within witness, then wording at that location. Later errors can coexist with an earlier failure. Labels within bars are counts.
Of 120 full-retrieval answers, one failed first on the witness and two on the volume. The other 117 supplied a supported locator and failed on the wording. Figure 5 assigns each response to its first failed check.
Of the 120 full-retrieval answers with an incorrect continuation, 84 reproduced an eight-character sequence elsewhere in the retrieved window, 0 marked the wording unknown, and 36 supplied a sequence absent from that window. Even a verbatim substring check can therefore differ from verification of the requested position.
3.5 Repetition of the cue and retrieval from incomplete wording
Figure 6. Which part of the prompt the model repeated. Each ring represents 120 responses. The centre counts any generated quotation found inside the 12-character cue. The coloured segments distinguish repetition of the opening eight characters from a different eight-character substring of the cue.
Providing source text increased reuse of the cue. Of 64 full-retrieval answers that repeated part of the cue, 52 returned its first eight characters. The comparable counts were 11 of 26 echoing answers without retrieval and 20 of 46 with metadata only. This post hoc string comparison describes a positional error observable directly in the outputs.
Each stratum had a supporting first hit for 39 of 40 intact cues. Once cue positions were hidden, the top-ranked window less often contained the full target. With four hidden characters, 1,676/1,920 trials (87.3%) retrieved the target. With eight hidden, 589/1,920 (30.7%) did. The denominator counts 16 masks applied to each of 120 cues. Replications within a cue share a reference passage.
Figure 7. Retrieval under progressive loss of cue characters. Points show mean top-hit support over 16 masks per cue. Bands are pointwise 95% percentile intervals from 10,000 within-stratum resamples of 40 cues. All query variants of an item remain together. The unmasked point is repeated across masks.
For the most heavily masked cues, top-hit support was 210/640 in the G-only group, 167/640 in the S-only group, and 212/640 in the shared group. The experiment isolates dependence on surviving adjacent characters. Historical variant substitutions, paraphrases, and questions in translation introduce other difficulties that this deletion model does not estimate.
4 Discussion
4.1 What a reader can verify
The retrieval system exposed a supported answer in 117 windows, yet the model failed every exact continuation. In 84 cases its eight characters occurred somewhere in the retrieved window. A verifier that checks only whether the passage contains the answer would therefore accept 84 misplaced quotations. For editorial use, the boundary between the question’s cue and its continuation is part of the claim being verified.
Table 4 illustrates three ways the reference standard changes across witnesses. G supplies a positive numbered heading, S requires explicit acknowledgment of missing volume information, and a shared cue can admit two distinct readings.
Table 4. Auditable examples from the full-retrieval condition. Reference entries show witness, volume code, exact continuation, and one-based line in the stored text. The model column reproduces the generated fields with added spacing.
Item and query cue | Attested citation(s), up to two | Generated citation |
|---|---|---|
007 · G-only | G | 2 | 子病失精女子病赤 (l. 199) | G | 2 | 寸口脉弱而涩尺中 |
013 · S-only | S | 0 | 所以然者以内外俱 (l. 475) | S | 0 | 下之后复发汗必振 |
034 · Shared | G | 11 | 厥厥者手足逆冷是 (l. 2973) | G | 11 | 逆冷是也字典号无 |
Item 034 concerns jue, here described through coldness of the hands and feet. The eight-character spans agree through 逆冷 (“counterflow cold”). Their final characters differ. G reads 是 and S reads 者. Either complete reading can earn credit. Transferring the last character from one record to the other creates a citation the named text does not support.
4.2 Implications for editions and search interfaces
As an engineering check, a deterministic routine copied the eight characters following the first exact cue match in the top window and attached its stored locator. It emitted 117 citations, all 117 supported, and abstained on three queries. This result depends on knowing the literal incipit. It identifies a part of this task that an interface can execute directly while reserving model generation for interpretation.
A citation interface can expose the retrieved line and the inherited juan heading together. Retaining a stable witness identifier, a content hash, and offsets allows another reader to recover the same sequence even if a title is later standardized. The distinction between a witness identifier and a bibliographic description is consistent with the TEI critical-apparatus guidelines.9 In this corpus, “volume unrecorded” should appear as readable text. The numeric 0 is an internal scoring code.
For a known-fragment question, the database can supply the quotation directly from the selected span. A rendering layer can restore the surrounding punctuation from the original stored line, and a validator can require the witness, heading and quoted span to refer to the same occurrence. If two witnesses yield different continuations, displaying both readings with separate locators preserves evidence that a single preferred answer would conceal.
4.3 Threats to inference
This experiment measures reference recovery from a known incipit. Questions in ordinary scholarly use may instead name a concept, cite a modern paraphrase, or ask how a commentator changed an earlier reading. An intact twelve-character cue gives a lexical retriever unusually strong evidence. The masking experiment perturbs that evidence but cannot substitute for independently written questions. Evaluation on historical glosses and cross-language paraphrases would test a materially different retrieval problem.
Two related transcriptions and one small quantized model provide a controlled comparison with limited external validity. One greedy answer per condition measures the deployed configuration. A larger model, different quantization, other prompts or unconstrained prose could change the result. The output grammar limits formatting errors and allows only G, S or unknown as the witness. Witness accuracy on a shared cue is therefore easy to achieve. Raw field accuracy should always be read beside the strict joint outcome.
The same normalized records supplied retrieval material and the reference standard. This is appropriate for testing whether an answer can be traced to a specified corpus. It also allows inherited transcription errors to pass verification. Deleting punctuation and non-Han characters can conceal meaningful differences. An eight-character match provides no guarantee about a longer quotation. The study did not inspect page images, textual authenticity, attribution of commentary, or historical priority. Shared passages also limit independence beyond the sampled cues. Confidence intervals do not quantify these sources of uncertainty.
A stronger external validation would sample edition-specific and shared questions from independent scholars, retain facsimile identifiers and page coordinates, and ask two readers masked to model condition to judge witness identity, locator and wording separately. Adjudicated disagreements could distinguish a transcription defect from a generator error. Questions with genuinely unrecoverable locators should be included to measure unsupported specificity alongside answer coverage.
5 Conclusion
In two digital cold-damage texts, retrieval improved the tested model’s ability to name a supported witness and volume designation. It yielded no correct eight-character continuations. Direct extraction recovered 117 of 120 complete citations. For systems that answer known-fragment questions, the strongest operational result is the benefit of returning the recorded span together with its locator and preserving alternative readings where the witnesses diverge.
Data, code and research scope
The accompanying reproducibility archive contains the frozen cues and reference spans, ranked evidence windows, raw outputs, masking key, scores, analysis scripts and source checksums. Reconstructing the corpus requires the two specified local database records. Reanalysis of the paired outcomes uses the archived scores. The study used documentary texts and generated responses and involved no human-participant recruitment or patient records.
Use of AI tools
OpenAI Codex assisted with program design, local execution, statistical analysis, figure preparation and drafting. The Qwen model named in the Methods was the system under evaluation. All reported outcomes are derived from saved model responses and the rule-based source audit.
References
1. Qian CC. The activity of searching for books of Shang Han Lun (Treatise on Cold Pathogenic Diseases) of the Song edition. Zhonghua Yi Shi Za Zhi. 2010;40(1):38–41. Chinese. PMID: 20403262. Source record
2. Lewis P, Perez E, Piktus A, Petroni F, Karpukhin V, Goyal N, et al. Retrieval-augmented generation for knowledge-intensive NLP tasks. Adv Neural Inf Process Syst. 2020;33:9459–9474. Source record
3. Gao T, Yen H, Yu J, Chen D. Enabling large language models to generate text with citations. In: Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing. Singapore: Association for Computational Linguistics; 2023. p. 6465–6488. doi: 10.18653/v1/2023.emnlp-main.398
4. Huang T, Lu L, Chen J, Liu L, He J, Zhao Y, et al. A triaxial benchmark for assessing responses from large language models in traditional Chinese medicine. Commun Med. 2026;6:404. doi: 10.1038/s43856-026-01631-5
5. Robertson S, Zaragoza H. The probabilistic relevance framework: BM25 and beyond. Found Trends Inf Retr. 2009. doi: 10.1561/1500000019
6. Qwen Team. Qwen2.5-0.5B-Instruct-GGUF [model weights and model card]. Hugging Face; 2024. Revision 9217f5db79a29953eb74d5343926648285ec7e67. Source record
7. ggml-org. llama.cpp [software]. Build b8260, commit 96cfc49. GitHub; 2026. Source record
8. McNemar Q. Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika. 1947;12(2):153–157. doi: 10.1007/BF02295996
9. TEI Consortium. Critical apparatus. In: TEI P5: Guidelines for Electronic Text Encoding and Interchange. Chapter 13. Source record
Supplementary material
Supplement S1. Computational audit and replication files. Each item identifier links the question, admissible source spans, retrieved windows and three generated responses. The README gives the execution order, the masking procedure and instructions for repeating the statistical analysis.






