## 3 Materials and Method
### Proposed Method
#### 3.2.2 Hash-Tree-Based Transformer Model
After a new node is inserted, the hash values of the relevant subtrees are updated sequentially, ultimately reflecting in the root node’s hash value. This process ensures data integrity, as any change to a node will be mirrored throughout the hash tree structure, thereby guaranteeing data security and verifiability. where \(H(P_{\text{left}})\) and \(H(P_{\text{right}})\) are the updated hash values of the left and right child nodes, respectively. 4. Recursively Updating Hash Values Along the Path: Starting from the parent node of the deleted node, recursively update the hash values along the path up to the root node to ensure the hash consistency of the entire tree. This deletion operation, by updating the hash values of the relevant nodes, ensures the security of the tree structure and the immutability of data, as any deletion operation will affect the hash path of the entire tree, thereby maintaining data integrity and enabling fast verification. The Transformer model excels in processing sequential data by capturing dependencies between different positions in a sequence through its self-attention mechanism. In the model described in this paper, the integration of hash trees with the Transformer structure creates an effective framework for data protection and processing. Specifically, each node in the hash tree corresponds to an input vector in the Transformer, and after hashing operations, it generates input features for subsequent layers. Suppose the input for the Transformer model is \(X=\{x_{1},x_{2},\ldots,x_{n}\}\); then, the hash tree generates a corresponding hash value for each input data point, forming the feature \(H(X)=\{H(x_{1}),H(x_{2}),\ldots,H(x_{n})\}\). This method uses the hash values of each data point as keys, queries, and values in the attention mechanism, significantly enhancing the security during the data processing phase. In programming evaluation tasks, every step of a program can be tracked through the hash tree. Each execution step of the program corresponds to a node state in the hash tree, and changes in state after execution are reflected in updates to the node's hash values. For example, the initial state of the program can be mapped to the root node of the hash tree, while each function call or variable update corresponds to a child node in the hash tree. The deep learning model based on the hash tree, by combining data integrity protection and efficient data processing capabilities, offers a powerful tool for the data security field. The hash tree provides a basis for data validation and dynamic updates, while the self-attention mechanism of the Transformer model enhances the model's understanding of complex data patterns. This integration not only optimizes system performance but also ensures the security and reliability of the data. Figure 6: Hash tree node-deletion structure diagram: This figure illustrates the node-deletion process within the hash tree structure. When a node is removed, the hash values of the associated subtrees are correspondingly updated up to the root node. This process ensures the consistency of hash values across the entire hash tree, preserving data integrity and verifiability after the deletion operation.