Daejeon, July 27–31
Ancient texts undergo alterations during transmission, giving rise to textual variants. These variants are vital for restoring original texts, tracing academic shifts, and reflecting historical reception. Consequently, researchers value them highly, and they are frequently presented as key elements in scholarly collations of ancient classics.
This paper addresses the fundamental level of textual variant analysis: examining relationships between texts based on variant readings. This analysis reveals the origins and context of these variants, serving as a necessary foundation for advanced textual criticism and broader discussions in literature, history, and philosophy.
Regarding the issue of textual variants and the textual relationships they imply, western academia has conducted extensive research from the perspective of stemmatology, as seen in works such as Robinson (1996) and Wachtel (2011). More comprehensive reviews can be found in Bordalejo (2015) and Roelli (2020). These studies are based on the analysis of numerous textual variants found in the Bible and other classical texts, typically employing phylogenetic algorithms to construct visualized tree-like stemmas that depict textual evolution from a presumed archetype.
However, the direct application of such tree-based stemmatological methods to ancient Chinese texts presents distinctive challenges which motivate a different computational approach. Compared to Western classics, the number of extant editions of ancient Chinese classics is quite limited. Furthermore, there are often significant differences between early excavated manuscripts and received editions, frequently separated by long chronological gaps, making it difficult to directly represent their relationships using a phylogenetic tree (Kern, 2019). Consequently, the common approach is to analyze possible connections among editions by examining variants (including formal and semantic relationships), which has strong explanatory power for individual cases but is difficult to scale into a systematic, holistic account covering an entire textual tradition.
In the context of variants in Chinese classics, while some scholars have conducted research on variant discovery (Jiang Yanting, 2025), discussions regarding computational methods for variant analysis remain limited. Therefore, it is particularly important to consider a method for computing textual relationships in ancient Chinese books (especially those from early China) through the analysis of variants.
For analytical convenience, we use the Laozi text corpus for our analysis, encompassing editions such as the Guodian edition (GD), the Mawangdui Silk Manuscripts A (BA) and B (BB), the Peking University Bamboo Slips edition (HJ), the Yan Zun edition (YZ), the Heshanggong edition (HS), the Xiang Er edition (XR), the Wang Bi edition (WB), and the Fu Yi edition (FY). Details of these texts can be found in Han (2014). These will be processed into sentence-by-sentence aligned data for computational analysis. The advantage of using the Laozi text lies in its rich variety of editions, making it an excellent case study for evaluating algorithm effectiveness. The data table is shown in Fig. 1. In this table, all sentences across editions are aligned, chapter divisions follow the Wang Bi edition, and phenomena such as sentence-order discrepancies and textual lacunae are explicitly marked with dedicated markers.
Fig. 1 Raw data table
Fig. 2 Overall pipeline. The Chinese characters following “Deepseek” serve as a simplified example prompt, instructing Deepseek to identify patterns between a variant pair (alternative characters here).
The overall pipeline is illustrated in Fig. 2. Here are the details:
1. File Reading and Graph Construction
The method involves two main stages: first, preprocessing the text by cleaning irrelevant characters, standardizing synonyms, and expanding duplicate markers. Second, a networkx graph is constructed linking editions, chapters, and lines hierarchically (“inclusion”), with additional edges connecting corresponding lines across different editions to facilitate analysis (“similarity”).
2. Adjusting the Graph Based on Modified Edit Distance
We calculate normalized edit distances to determine sentence similarity across editions, mapping these values to graph edges.
In this step, since different variant patterns impact text similarity differently and the original edit distance fails to account for such differences, we propose leveraging the capabilities of the Deepseek LLM to perform refined judgments on textual variant relationships.
3. Learning Node Vector Representations Using Graph Neural Networks
To represent node relationships in a text variant graph, we propose using a graph autoencoder. This method employs a graph convolutional neural network to aggregate neighbor information and reconstruct connectivity. Through gradient descent optimization, the system learns node vectors that accurately reflect the graph's structural information.
The structure of this graph is illustrated in Fig. 3.
4. Hierarchical Community Detection Based on Node Vector Representations
After obtaining vector representations for each node, the similarity between any two nodes can be computed via vector inner product. This similarity not only reflects the similarity information derived from the edit distance between two nodes but also encodes complex, comprehensive relationships obtained through the graph neural network, including text-to-chapter and text-to-edition relationships.
Fig. 3 Graph structure
First, we calculated the heatmap data, which was complex and visually less intuitive with less-than-ideal results. This outcome was anticipated, as the heatmap only reflects the relationship between two editions in isolation, without considering their connections to other editions.
Subsequently, using hierarchical automatic discovery, we obtained the following edition hierarchy diagram (Fig. 4):
Fig. 4 Hierarchy diagram
This diagram better reflects the relationships among the texts. First, GD and HJ - both dating from the Warring States and early Han periods - are separated. Next, FY is isolated - a finding worthy of attention - as some of its textual features have been discovered to be ancient (Hu, 2014). Also note the separation of BA, XR, and WB. BA is an excavated silk text from Han Dynasty, while XR is a Dunhuang manuscript (also newly recovered); both differ significantly from received editions. Finally, WB, HS, and YZ form two branches subordinate to WB in the hierarchy, reflecting the close connection between WB and these two texts.
A notable surprise in this diagram concerns the relationships among GD1, GD2, GD3, and BB. Clearly, these three excavated manuscripts should not cluster in the same position as other received editions. We attribute this issue to the substantial textual gaps present in these manuscripts. We will address this in subsequent algorithmic refinements.
Moreover, this algorithm can also analyze individual chapters. Fig. 5 is the hierarchical clustering result for Chapter 1 ("The Tao That Can Be Spoken"). Please disregard YZ and XR, which lack text in this chapter. This result precisely divides the chapter's text into two groups: received texts and excavated texts.
Fig. 5 Hierarchy diagram (Chapter 1)
Beyond confirming previously held views, the computational results also yield fresh insights. FY's clustering with excavated witnesses at the textual level, coupled with its closer affinity to received editions in certain chapters, provides quantitative support for and refines the view that FY preserves archaic features (Hu, 2014). The clear separation of XR from WB, HS, and YZ corroborates the view that XR underwent significant editorial intervention. Meanwhile, the close relationship of HS and YZ, as they relate to WB, calls for a systematic re-examination of their connection. Finally, HJ's distinct position from BA and BB (despite all three being Han-era witnesses) aligns with previous observations of differences in important features such as avoidance of taboo characters and orthographic conventions.