Method for determining drug codes

By combining topological homology and generative neural networks with causal models, the inefficiency of existing drug coding methods is solved, and efficient, accurate, and adaptive generation of drug codes is achieved, adapting to new molecular structures and combination formulations.

CN120998445APending Publication Date: 2025-11-21CHONGQING GUOYANG PHARMACEUTICAL CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511129579.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-13
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

Existing drug coding methods rely on manual retrieval and simple fingerprint comparison, which are difficult to handle new molecular structures and combination formulations. They also lack unified metrics, resulting in low efficiency and high maintenance costs. Furthermore, they cannot effectively handle the differences between molecular three-dimensional topology and text syntactic structure.

Method used

A topologically homology barcode is used to capture the molecular geometry and text syntax-stable structure, generating sparse hypervectors and unifying their representation through binding transformation. Generative neural networks are used to generate preliminary codes, which are then corrected by a causal model and the confidence level is quantized using Monte Carlo variance. Reinforcement learning algorithms are then used to optimize the model's self-evolution.

Benefits of technology

It achieves structural homogenization of cross-modal information, lossless fusion of molecular topology and semantic topology in sparse supervector space, end-to-end sequence generation and knowledge correction, adaptive confidence assessment and empirical iteration, thus improving the accuracy and efficiency of drug coding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120998445A_ABST
    Figure CN120998445A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of medical informatics, in particular to a method for determining a drug code, which comprises the following steps of: acquiring a specification text, a chemical structure, an active component and target information, and integrating into task input; respectively extracting a molecular topological vector and a semantic topological vector based on topological coherence, injecting the molecular topological vector and the semantic topological vector into a sparse high-dimensional super-vector, and mapping the sparse high-dimensional super-vector into a continuous vector through binding transformation; generating a preliminary code by using a generative neural network combining diffusion denoising and a converter, and calculating a super-dimensional residual error; constructing a causal model in the pharmacological knowledge graph, and outputting a correction code after residual error calibration; the joint probability variance is evaluated through Monte Carlo discarding, and automatic confirmation, manual recheck or anti-fact search are realized through two-stage threshold values; and writing the combined super vector, the final code and the variance into an experience library, and optimizing the generation network and the causal model at the same time by using a hierarchical Bayesian near-end strategy. According to the invention, the extrapolation capability and interpretability of new drugs are considered, the coding accuracy is obviously improved, and the labor cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of pharmaceutical informatics technology, and in particular to a method for determining drug codes. Background Technology

[0002] As an internationally recognized five-level classification system, the chemical coding of drug anatomy and therapeutics serves as a unified semantic hub for drug regulation, medical insurance payment, hospital informatization, and cross-border circulation. Faced with the rapid growth of new molecular structures, semantic differences in product instructions, and diversified targets, traditional coding processes still primarily rely on manual pharmacopoeia searches, rule matching, or simple fingerprint comparisons. This approach has three main drawbacks: character matching or inverted indexes ignore the three-dimensional topology of molecules and the syntactic structure of text, making it difficult to handle new active components or combination formulations; the chemical fingerprint and product instruction semantics are evaluated separately, lacking a unified metric, leading to multiple rounds of manual comparison when conflicts arise; and the experience gained from revising results is difficult to feed back into the model, relying heavily on expert consultation, resulting in limited efficiency and high maintenance costs. Summary of the Invention

[0003] To address the numerous problems existing in the prior art, this invention provides a method for determining drug codes. This invention uses topological homology barcodes to capture the stable structure of molecular geometry and text syntax, hashes it into sparse supervectors, and then uses binding transformation to uniformly represent it. Orthogonal mapping generates continuous vectors which are input into a diffusion-transformer network to generate preliminary codes. Residuals drive causal model correction and confidence is quantified using Monte Carlo variance. Empirical samples are optimized using a hierarchical Bayesian proximal strategy to achieve model self-evolution.

[0004] A method for determining a drug code includes:

[0005] Collect drug instruction manual text data, drug chemical structure data, and active ingredient and target data, generate a set of structured text data, molecular structure data, and target data, and integrate them as task input objects with a unique task identifier;

[0006] Based on the topological homology method, molecular topological vectors and semantic topological vectors are extracted from the syntactic dependency relations of molecular structure data and structured text data respectively and merged into the task input object. The task input object is hashed to obtain sparse high-dimensional hypervectors. After injecting the molecular topological vectors and semantic topological vectors, a combined hypervector is formed through binding transformation and mapped to a continuous vector. Generative neural networks are used to generate preliminary anatomical treatment chemical codes and calculate hyperdimensional residuals.

[0007] A causal model is constructed on a pharmacological knowledge graph. The corrected anatomical treatment chemical code is obtained by using a combined hypervector as the initial state and calibrating with a hyperdimensional residual. The joint probability variance is calculated based on Monte Carlo Dropout inference, and the final anatomical treatment chemical code is determined by performing counterfactual search or manual verification according to the threshold. The combined hypervector, the final anatomical treatment chemical code, and the joint probability variance are written into the experience base, and the generative neural network and causal model are updated using a reinforcement learning algorithm.

[0008] Preferably, the topological coherence method compares the generation time and the disappearance time of the barcode and selects persistent coherent barcodes with a generation-to-death ratio higher than a preset threshold to generate molecular topological vectors and semantic topological vectors.

[0009] Preferably, when performing hash mapping on the task input object, each identifier is mapped to a sparse high-dimensional hypervector of a preset dimension.

[0010] Preferably, after injecting the molecular topological vector and the semantic topological vector, the binding transformation is completed by sequentially performing a bitwise XOR operation and a fixed-number cyclic shift operation to form a combined hypervector.

[0011] Preferably, when mapping the combined hypervector to a continuous vector, noise scheduling parameters are generated based on the norm of the molecular topological vector, and the diffusion process is controlled accordingly.

[0012] Preferably, the generative neural network is configured with a diffusion denoising layer and a transformer layer in sequence, wherein the diffusion denoising layer is used to reconstruct the multi-scale features of continuous vectors, and the transformer layer is used to recursively generate preliminary anatomical treatment chemical codes.

[0013] Preferably, when performing Monte Carlo Dropout inference on the corrected anatomical treatment chemical code, a preset number of random samples are used to obtain the joint probability variance.

[0014] Preferably, the threshold corresponding to the joint probability variance is divided into a first threshold and a second threshold. When the joint probability variance is lower than the first threshold, the final anatomical treatment chemical code is directly confirmed. When it is higher than the second threshold, a counterfactual search is triggered. When it is between the first threshold and the second threshold, manual review is performed.

[0015] Preferably, the combined hypervector, final anatomical treatment chemical code, and joint probability variance, along with task identifiers and time information, are written into an experience base to form experience samples, and the experience samples are used as input data for reinforcement learning algorithms.

[0016] Preferably, the reinforcement learning algorithm employs a hierarchical Bayesian proximal policy optimization algorithm to simultaneously update the parameters of the generative neural network and the causal model.

[0017] Compared with the prior art, the advantages and beneficial effects of the present invention are as follows:

[0018] By extracting stable features of molecules and text through topological homology, structural homogenization of cross-modal information was achieved;

[0019] Lossless fusion of molecular topology and semantic topology in sparse hypervector space was achieved through high-dimensional hash binding and orthogonal mapping;

[0020] By using generative neural networks and causal models for collaborative reasoning, a dual guarantee of end-to-end sequence generation and knowledge correction is achieved.

[0021] By using Monte Carlo variance thresholding and reinforcement learning closed loop, adaptive confidence assessment and continuous experience iteration were achieved. Attached Figure Description

[0022] Figure 1 This is a schematic flowchart of the method of the present invention;

[0023] Figure 2 This is a schematic diagram of sparse high-dimensional supervector fusion in this invention. Detailed Implementation

[0024] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.

[0025] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0026] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0027] like Figure 1 As shown, a method for determining a drug code includes:

[0028] Collect drug instruction manual text data, drug chemical structure data, and active ingredient and target data, generate a set of structured text data, molecular structure data, and target data, and integrate them as task input objects with a unique task identifier;

[0029] Before determining the chemical code for drug anatomy and therapeutic applications, this invention first uniformly collects, structures, and integrates the multimodal raw information of the drug. This step converts three types of heterogeneous data—instruction manual text, chemical structure, and the correspondence between active ingredients and targets—into homogeneous representations, laying a consistent and traceable input foundation for subsequent topological homology extraction and generative neural network inference. The instruction manual text contains key information such as ingredients, indications, safety, and interactions. After optical character recognition or direct parsing, a syntactic analyzer is used to obtain the dependency tree structure, and a pharmaceutical-oriented named entity recognition model is used to extract semantic fragments such as chemical names, routes of administration, and contraindications. The output consists of structured text data with fields such as paragraph index, dependency relations, and entity annotations, facilitating the generation of semantic topological vectors in the subsequent topological homology stage.

[0030] Chemical structure data follows the linear symbolic representation of public databases and is transformed into molecular graphs after molecular force field optimization. Graph vertices record element type, protonation state, and three-dimensional coordinates, while graph edges record bond order and aromaticity information. Graph normalization yields molecular structure data used to generate molecular topology vectors. The target dataset consists of human target records of active ingredients in protein databases, retaining entries with significant inhibitory or activating effects. The final output is a ternary set of relationships between ingredient, target protein, and action type. Before being written to the cache, the above three types of structured results are bound to unique task identifiers to ensure traceability and concurrency consistency in a distributed environment. Identifier generation uses consistent hashing, defined as follows:

[0031] UID=H(SMILES||TEXTHASH||TARGETHASH)

[0032] Where H(·) is a one-way hash function, and || is the concatenation symbol; SMILES, TEXTHASH, and TARGETHASH represent linear symbolic hashes of chemical structures, full-text hashes of instruction manuals, and hashes of ingredient target lists, respectively. This design ensures that the order of different batches remains unchanged and the key values ​​are unique, while also serving as a sharding key in multi-node parallel scenarios.

[0033] The data integration of this invention brings three technical benefits: 1) It eliminates the heterogeneity of data sources, and downstream algorithms all call the same task input object, so there is no need to care about the differences in collection; 2) The unique task identifier forms a cross-module traceability link, and intermediate results can be quickly located in key-value storage, reducing the overhead of multi-threaded synchronization; 3) The text subgraph and chemical subgraph are explicitly separated, which not only facilitates the independent processing of topological coherence, but also avoids cross-contamination of information.

[0034] Example: When processing a compound anti-inflammatory tablet, the entire instruction manual was syntactically analyzed to generate a dependency tree of approximately 3000 nodes, extracting 7 types of pharmacological entities. Linear chemical structure transformation yielded 62 atomic vertices and 64 chemical bonds. Target retrieval yielded 4 human target records. After serializing and writing the three types of data into key-value storage, a fixed-length hexadecimal string was output as a unique task identifier using a hash function. Subsequent modules used this identifier to batch load inputs, with the total time to data acquisition and storage being less than 50 milliseconds. This example demonstrates that the data integration process of this invention can maintain stable throughput and ensure repeatable results under high-concurrency scenarios.

[0035] Based on the topological homology method, molecular topological vectors and semantic topological vectors are extracted from the syntactic dependency relations of molecular structure data and structured text data respectively and merged into the task input object. The task input object is hashed to obtain sparse high-dimensional hypervectors. After injecting the molecular topological vectors and semantic topological vectors, a combined hypervector is formed through binding transformation and mapped to a continuous vector. Generative neural networks are used to generate preliminary anatomical treatment chemical codes and calculate hyperdimensional residuals.

[0036] After unifying the multimodal inputs, this invention maps molecular structure information and instruction manual semantic information to the same vector space using topological cohomology and hyperdimensional computation, and uses a generative neural network to perform preliminary inference of the drug's anatomical and therapeutic chemical codes. First, persistent cohomology analysis is performed on the molecular structure data. Specifically, a series of scale filters are calculated based on the molecular structure diagram, constructing a Vietoris-Rips complex at each scale, and forming a barcode set by tracking the simplex generation and disappearance process. Let the molecular barcode set be B. m ={b m1 ,b m2 ,…}, where barcode b mi The birth-death ratio is ρ mi =l mi / d mi , l mi Indicates the barcode length, d mi This indicates the death scale. This invention only retains barcodes with a birth-to-death ratio greater than a preset threshold, sequentially encoding their length, dimension, and other attributes into molecular topological vectors. Similarly, for the syntactic dependency relations of the instruction manual text, a text semantic graph is constructed using words within a sentence as vertices and dependency arcs as edges. Then, the same persistent cohomology process is executed to obtain a semantic barcode set B. s Semantic topological vectors are extracted. The construction of topological vectors does not involve any language model parameters, so that the semantic structure of the text is expressed in a differentiable numerical form at the same scale as the molecular geometric topology, providing a general metric for subsequent fusion.

[0037] Subsequently, this invention performs hash mapping on the task input objects, mapping chemical names, target identifiers, and key semantic phrases to a sparse supervector of dimension D. Let the hash function be h, then the position of the k-th identifier in the supervector is h(k), with a value of 1, and unmapped positions are 0. Molecular topological vectors and semantic topological vectors are injected into this sparse supervector through bit-weighted injection. After injection, a binding transformation is performed: first, a bitwise XOR operation is performed between the sparse supervector and the molecular topological vector to obtain the result vector; then, a fixed-bit cyclic shift is performed on the result vector to introduce order information; finally, a bitwise XOR operation is performed again with the semantic topological vector to obtain the combined supervector H. To facilitate subsequent deep model processing, this invention uses a random orthogonal matrix W to map the combined supervector to a continuous vector z, the calculation formula of which is:

[0038] z = WH

[0039] The column vectors of W are normalized to ensure that angle information is preserved during the mapping process.

[0040] A continuous vector z is input into a generative neural network. The first half of the network is a diffusion denoising layer, which uses Gaussian noise to gradually and randomly perturb z and reconstructs its high-frequency details through learning the inverse process. The noise scheduling parameter is dynamically set according to the L2 norm of the molecular topological vector, ensuring that structures with complex loops or long branches retain sufficient diffusion steps. The second half of the network is a multi-layer transformer structure that uses a self-attention mechanism to recursively output a five-level character sequence of drug anatomy and therapeutic chemical codes. The generation strategy uses beam search, retaining several character paths with the highest probability at each level, which are finally combined to form the initial code. Unlike traditional layer-by-layer screening, this invention directly generates a complete encoding sequence in the character-level space, avoiding reliance on external reference tables and improving the extrapolation capability for new drugs.

[0041] To measure the deviation between the generated result and the input semantics, this invention calculates the hyperdimensional residual r, which is defined as follows:

[0042]

[0043] in This means that the initial encoding is rehashed and mapped to a hypervector of the same dimension and then binarized. The residual vector is used as a gradient adjustment term during subsequent causal model calibration, which can automatically amplify character levels in the generated sequence that are inconsistent with the pharmacological mechanism, thereby guiding the model to locally regenerate suspicious levels.

[0044] Through the above process, this invention achieves the binding of structural topology, textual semantics, and high-dimensional hypervectors. Following continuous vector mapping and generative neural network inference, it ultimately outputs the chemical code for drug anatomy and treatment. Compared to traditional systems based on string matching or inverted index retrieval, this invention offers the following advantages: First, molecular topological vectors directly encode the geometric skeleton, maintaining the distinguishability of isotopes in the encoding space; second, semantic topological vectors inherit syntactic structure, enabling sensitive perception of textual context such as dosage form and indications; third, binding transformation maintains the equal weighting of different modal features in the hypervector space, reducing information loss; and fourth, the generative neural network learns the hierarchical rules of the encoding system through end-to-end training, eliminating the need for a manually maintained rule base.

[0045] For example, consider encoding an oral hypertension medication. The drug's instruction manual text is parsed to obtain a dependency tree. Persistent homology is used to extract verb object subgraphs with high birth-death ratios as barcodes. The molecular structure is a chlorinated benzodiazepine heterocyclic compound; topological analysis yields barcodes related to multiple ring cycles and bridge numbers. Two types of topological vectors are injected into a sparse hypervector, then bound to obtain a combined vector, which is mapped to a continuous representation. The generative neural network output is encoded as C09AA02 (hypothetical value). After hashing C09AA02 back to the hypervector, it is XORed with the input hypervector to obtain a residual vector. Its non-zero bits are mainly concentrated in the second-layer character positions, suggesting potential inconsistencies in indication levels. After causal calibration, the model regenerates the character A (cardiovascular system) in the second layer, and the final encoding is adjusted to C09BA02. This example demonstrates the adaptive correction capability of residual correction for abnormal levels.

[0046] Preferably, the topological coherence method compares the generation time and the disappearance time of the barcode and selects persistent coherent barcodes with a generation-to-death ratio higher than a preset threshold to generate molecular topological vectors and semantic topological vectors.

[0047] In this invention, topological cohomology is used to extract stable topological features from molecular structure graphs and syntactic dependency graphs. A Vietoris-Rips complex is constructed from the molecular structure graph, and the generation and disappearance of the simplex are tracked across continuously expanding scales; the difference between the generation and disappearance times is called the barcode length, and their ratio is the generation-death ratio. When the generation-death ratio is higher than a set threshold, it indicates that the ring or connected structure corresponding to the barcode is stable across multiple scales, and therefore can serve as a key feature for distinguishing molecular geometric skeletons. Similarly, the same process is performed on the syntactic dependency graph to obtain semantic barcodes. Specifically, let the barcode set be B = {(l i ,d i )}, where l i d is the length of the barcode. i If we consider the death rate of barcodes as the criterion, then the life-to-death ratio is defined as:

[0048]

[0049] In this invention, only ρ is retained. i Barcodes exceeding a threshold are mapped to fixed-length vectors based on their length, dimensions, and order of appearance, denoted as molecular topological vectors and semantic topological vectors, respectively. This vectorization process is independent of specific language models or chemical fingerprints, thus ensuring compatibility with unknown corpora and novel molecules.

[0050] The generated two types of topological vectors are then injected into the sparse high-dimensional hypervector obtained by hashing. The hash function h maps the input identifier to a Boolean vector of dimension D, assigning a value of 1 to non-collision positions and 0 to other positions. To fuse different modal information, a bitwise XOR operation is first performed on the sparse vector and the molecular topological vector, then the resulting vector is left-circularly shifted by a fixed number of bits, and finally XORed again with the semantic topological vector to obtain the combined hypervector H. This binding transformation ensures that the three types of information maintain a one-to-one correspondence at the bit level, while avoiding excessive weighting of a single modality that could mask other features.

[0051] The combined hypervector is then mapped to a continuous vector z using a random orthogonal matrix. The mapping formula is:

[0052] z = WH

[0053] Where W satisfies The orthogonal matrix has row dimensions equal to the continuous space dimension and column dimensions equal to the high-dimensional hypervector dimension. Orthogonal constraints avoid introducing correlations during the mapping process, ensuring that the angular features of H remain separable in z. To adjust the noise level in the diffusion process, this invention uses the second norm ||t|| of the molecular topological vector. m ‖2. Noise Scheduling Settings:

[0054] σ(τ)=σ0exp(-γτ-η‖t m ‖2)

[0055] Where τ is the diffusion step number, and σ0, γ, and η are constants. In this way, molecules with higher ring system complexity retain more noise in the early stages of diffusion, which is beneficial for reconstructing the fine structure.

[0056] A continuous vector z is input into a generative neural network. During the diffusion stage, positive perturbation and negative denoising are performed based on noise scheduling to reconstruct multi-scale details. In the transformer stage, a five-level character sequence is recursively generated through self-attention, directly outputting the preliminary anatomical and treatment chemical code. Unlike traditional layer-by-layer retrieval, this invention generates complete codes at once, eliminating the maintenance costs of external mapping tables.

[0057] To measure the consistency between the generated sequence and the original vector, this invention will The hash is then mapped to a higher-dimensional space and the XOR difference is taken to obtain the superdimensional residual:

[0058]

[0059] in Indicates to Sparse hypervectors are generated using the same hashing rule and subjected to the same injection and binding processes. Positions with more bits in the residual represent points where the generated sequence contradicts the input semantics or structure. In subsequent causal models, r is used as a gradient modulation term to strengthen the penalty for error levels and achieve automatic regeneration.

[0060] The advantages of this invention include: 1. Topological homology filters out unstable barcodes, retaining only multi-scale salient structures, significantly improving the coding's ability to distinguish between heterogeneous and isomorphic drugs; 2. Hash binding and orthogonal mapping unify discrete symbols, molecular geometry, and textual semantics into the same continuous space, avoiding dimensional mismatch between different modalities; 3. Generative neural networks learn the co-occurrence patterns of coding levels through end-to-end training, enabling extrapolation of newly added or rare indications in the product manual; 4. Hyperdimensional residuals provide explicit inconsistency indicators, allowing causal models to be locally corrected without global backtracking.

[0061] Example: Encoding of antidepressants containing a phenylpiperazine structure. The molecular topological vector contains a single sustained loop and two zero-dimensional branch barcodes, while the semantic topological vector indicates a strong connection between the primary indication node and the dosage form node. After binding in the hash space, the generative neural network initially outputs... The result was N06AA05. After rehashing and calculating the residuals, it was found that the second-level characters did not match the semantic topology. The causal model regenerated the second-level characters based on the residuals, and the final encoding was adjusted to N06AB05, matching the pharmacological mechanism of the drug that inhibits monoamine oxidase. This demonstrates that the present invention can provide the correct anatomical and therapeutic chemical code for a novel molecule not previously covered in the specification, relying solely on the input topology and semantics.

[0062] Preferably, when performing hash mapping on the task input object, each identifier is mapped to a sparse high-dimensional hypervector of a preset dimension.

[0063] The core objective of the hash mapping stage is to embed the discrete identifiers in the task input object into a unified sparse high-dimensional space, enabling subsequent cross-modal binding and continuous vector mapping to maintain the approximate orthogonality between the identifiers without lossy indexing. This space is denoted as the sparse high-dimensional hypervector space in this invention, with a dimension set to a constant D, where D is much larger than the total number of identifiers in a single task, thus ensuring sparsity. For each identifier k in the input object, its index position is calculated using a one-way hash function h:

[0064] i = h(k) mod D

[0065] Here, `h` employs a non-cryptographic hash constructed using multiplication, scrambling, and bitwise operations to reduce hardware implementation complexity. After any identifier is mapped, a value of 1 is written to the position at dimension `i`, while the remaining dimensions remain 0. Since `D` is much larger than the number of identifiers, the probability of hash collisions is negligible; even if a collision occurs, the high-dimensional space can still retain the total amount of information through XOR operations after bit-level binding. If the task input object contains multiple types of identifiers, such as chemical names and target proteins, using the same `h` with a type prefix can avoid cross-type index overlap. The type prefix is ​​entered into the hash function via string concatenation, requiring no additional channels.

[0066] In hardware implementation, sparse hypervectors are stored in a sparse index format, saving only the bit index list, which reduces memory usage to O(N), where N is the number of identifiers, rather than O(D). This design is particularly GPU-friendly because the bit index list can be directly mapped to row indices in sparse matrix multiplication, merging the hash result with the subsequent binding transformation into a single kernel call.

[0067] To demonstrate the feasibility of the method, a processing example is given. Assume the task input contains the chemical name "clonitrazepam," the target protein UniProt number "P12428," and the text entity "oral administration." The dimension D is set to 10000, and the hash function outputs indices 147, 5582, and 9031. Therefore, the sparse hypervector is written with 1 at these three positions. When injecting subsequent molecular topological vectors, another set of indices is weighted and merged according to the same sparse storage format, without changing the previously positioned information. This design allows new identifiers to be added simply by appending the index, without rewriting the entire vector.

[0068] The technical benefits of hash mapping are mainly reflected in three aspects. First, by leveraging the approximate orthogonality of high-dimensional sparse vectors, arbitrary discrete strings are projected into an additivity space, providing a linearly commutative encoding basis for subsequent XOR binding and rotation operations. Second, hash functions do not rely on external vocabularies, supporting zero-sample mapping of new drug names or rare targets, significantly improving the model's extrapolation capability. Third, the use of a sparse index format reduces memory and bandwidth consumption, enabling binding transformations and orthogonal mappings to process more tasks in a single batch, thus improving inference throughput.

[0069] From an information theory perspective, sparse high-dimensional hypervectors can be viewed as an extreme form of locality-sensitive hashing. For any two distinct identifiers k1 and k2, if h(k1) ≠ h(k2), then their hash vectors have a Hamming distance of 2. After random orthogonal mapping, the angle between their corresponding continuous vectors remains significantly separated. If a collision occurs, their vectors completely overlap, leading to information loss. However, under the condition of a large dimension D, this probability satisfies:

[0070]

[0071] For the typical case of D=10000, the probability is only 0.0001. Therefore, this invention can maintain sufficient coding resolution while ensuring simple implementation.

[0072] Preferred, such as Figure 2 As shown, after injecting the molecular topological vector and the semantic topological vector, the binding transformation is completed by sequentially performing a bitwise XOR operation and a fixed-number cyclic shift operation to form a combined hypervector.

[0073] After the injection of the three types of structured results, this invention employs a bit-level binding transformation to fuse the molecular topological vector and the semantic topological vector into a sparse high-dimensional hypervector. This binding process is achieved through bitwise XOR operations and fixed-bit cyclic shift operations, aiming to simultaneously preserve both types of topological information and maintain symmetric invertibility in the vector space. The sparse high-dimensional hypervector is essentially a Boolean vector of dimension D, where each dimension can be considered as randomly assigned mask bits. Let the high-dimensional vector output from the hash mapping stage be v, and the molecular topological vector be t. m The semantic topological vector is t s Here, v and the two topological vectors are stored using sparse indexing, with vector elements taking only 0 or 1 values. The first step of binding performs a bitwise XOR operation, which is essentially a modulo-2 addition:

[0074]

[0075] This operation can be performed in a single instruction within the bitwise operation unit. Because t m The sparsity of is much smaller than D, and the XORed v′ remains sparse, while generating state flips for conflicting bits, constructing a new Boolean mode carrying molecular structure information. The second binding step performs a fixed-bit cyclic shift on v′, with a shift amount of s bits, indicating that after shifting s bits to the left, the high-bit overflow portion returns to the low-bit portion:

[0076] v″[i]=v′[(i+s)modD]

[0077] This shift operation is equivalent to transferring the weights of molecular information to a new bit interval, ensuring that different modalities are not all concentrated in the same index range after injection, reducing the probability of collisions and increasing hash entropy. A fixed shift amount s ensures the reversibility of the transformation; if molecular information needs to be extracted separately later, a reverse rotation can be performed with the same shift amount. The third step involves injecting the semantic topology vector again using a bitwise XOR operation.

[0078]

[0079] The resulting H, as a combined hypervector, contains three layers of information in a sparse high-dimensional space: the original identifier, the molecular topological bits mapped by shifting, and the semantic topological bits. Since the XOR operation is invertible, any topological vector can be recovered given other vectors, providing interpretability for subsequent causal model debugging. For example, in the residual solving stage, the initial encoding, after being hashed using the same logic, can be XORed with H to locate the bit segments causing the deviation.

[0080] This binding transformation is based on hyperdimensional computation theory and can be viewed as a multiplication operation in a hyperdimensional vector space. According to this theory, element binding achieves information fusion through nonlinear homomorphic functions, while ensuring the orthogonality and closure between vectors. The process of mapping from dense linear transformation to continuous representation vectors preserves these bit-level relationships, participating in the encoding and inference of generative neural networks in vector form.

[0081] The advantages of combining bitwise XOR with cyclic shifting are mainly reflected in four aspects. First, it saves more storage than simple concatenation or weighted summation, and the sparsity increases linearly with the number of injections rather than with the dimension, thus avoiding the dimensionality explosion problem. Second, the modulo-2 symmetry brought by XOR means that reversing either one eliminates the influence of the other, providing a reversible path for causal calibration. Third, the fixed shift introduces order information, which can determine the injection order in the vector space, providing a position signal for subsequent causal path search. Fourth, combined with the approximately orthogonal properties of hash functions, the probability of cross-task bit collisions is further reduced when encoding multiple tasks in the same high-dimensional space, supporting online batch processing.

[0082] The example demonstrates the practical feasibility of the binding process: dimension D is 10000, hash vector v contains 200 "1" bits, and molecular topological vector t... m Containing 60 "1"s, semantic topological vector t s Containing 50 "1" bits, with a shift of 17, the number of bits set after the first XOR operation does not exceed 260, and the index position shifts by 17 bits overall after the shift. The total number of bits set after the second XOR operation is approximately 310, occupying only 3.1% of the space, thus meeting the sparsity requirement. The memory usage increases by less than 20% compared to the original three-vector summation. This combined hypervector input to the orthogonal mapping matrix yields a continuous vector. After 10 rounds of training with the diffusion denoising and transformer joint network, the encoding prediction accuracy for 2000 drugs without known instructions improved by 4 percentage points, demonstrating that the binding transformation has advantages in both information preservation and inference performance.

[0083] Preferably, when mapping the combined hypervector to a continuous vector, noise scheduling parameters are generated based on the norm of the molecular topological vector, and the diffusion process is controlled accordingly.

[0084] In the generative neural network stage of this invention, the sparse high-dimensional combined hypervector is first converted into a continuous representation vector through an orthogonal mapping matrix, and then enters the diffusion denoising process. Diffusion denoising employs the idea of ​​stepwise noise addition and reverse restoration, with the noise level decreasing as the number of time steps changes. To enable the noise curve to adapt to the complexity of different molecular structures, this invention introduces the L2 norm of the molecular topological vector as the core driving force for noise scheduling. The L2 norm measures the global energy of the molecular topological vector, i.e., the richness of topological elements such as molecular ring systems, branches, and bridges; the larger the value, the more high-dimensional holes or long-period rings the molecule contains in space, requiring a longer denoising process to preserve these details. The noise scheduling function is denoted as:

[0085] σ(τ)=σ0exp(-γτ-η‖t m ‖2)

[0086] Where σ(τ) is the noise standard deviation at step τ, σ0 is the initial noise level, γ is the time decay coefficient, η is the topology adjustment coefficient, and t m Let represent the molecular topological vector. This formula directly adds topological complexity to the exponential decay term: when ‖t m When ||2 is large, σ(τ) remains at a relatively higher level at the same time step, giving the model ample opportunity for reconstruction; when ||t is large, σ(τ) remains at a relatively higher level at the same time step, giving the model ample opportunity for reconstruction; m The smaller ||2| indicates rapid noise decay, preventing overtraining on simple molecules from introducing spurious features. In implementation, ||t| m The calculation of ||2| is accomplished in the sparse indexing format by loading weights onto the set indexes and accumulating the squares. The computational complexity is linearly related to the number of set points, and is far lower than the dimension D. Noise scheduling parameters participate in backpropagation during the training phase, enabling the network to learn the mapping between "complex topology → high noise → long denoising time" and "simple topology → low noise → fast denoising time" in continuous space. For example: Suppose the topological vector L2 norm of molecule A is 5.2, and that of molecule B is 2.3. During the diffusion process at the same time step τ = 200, the noise standard deviations for both are:

[0087] σ 甲 =σ0exp(-γ·200-η·5.2)

[0088] σ 乙 =σ0exp(-γ·200-η·2.3)

[0089] Molecule A retains higher randomness, allowing for the recovery of multi-ring bridging structures in subsequent reverse processes; molecule B exhibits rapid noise disappearance, enabling the model to focus on finely recovering functional group substitution positions. Experiments show that applying this scheduling function to a publicly available anti-tumor drug library improves the average encoding accuracy by approximately four percentage points compared to a fixed-noise curve, with particularly significant effects on molecular samples with rare chiral centers or large steric hindrance substitutions.

[0090] This adaptive noise scheduling also possesses side effect suppression capabilities: for extremely complex and data-scarce molecules, their L2 norm may reach more than three times the average value, and excessive noise can lead to gradient vanishing. This invention ensures that the noise does not exceed the hardware numerical stability threshold by adding a truncation upper bound before the σ(τ) formula, and uses mixed precision for high-norm samples during the training phase to avoid overflow.

[0091] In summary, introducing the molecular topological vector norm as a noise scheduling parameter not only solves the contradiction of inconsistent duration between molecules of different sizes in diffusion denoising, but also enables the network to learn an interpretable mapping relationship of "structural complexity - noise scale - reconstruction depth" under a unified framework. This results in a stable output of preliminary anatomical and therapeutic chemical codes with hierarchical consistency, improving the accuracy and robustness of the entire drug coding determination process.

[0092] Preferably, the generative neural network is configured with a diffusion denoising layer and a transformer layer in sequence, wherein the diffusion denoising layer is used to reconstruct the multi-scale features of continuous vectors, and the transformer layer is used to recursively generate preliminary anatomical treatment chemical codes.

[0093] Generative neural networks are used to convert high-dimensional continuous vectors into five-level character sequences that conform to the drug classification hierarchy. To simultaneously preserve the global structural information and local details of the input vectors, this invention adopts a sequential architecture of "diffusion denoising layer - transformer layer". The diffusion denoising layer is responsible for reconstructing the multi-scale features of the continuous vectors; the transformer layer is responsible for recursively outputting the character sequences. The two layers complement each other, avoiding the loss of high-frequency details in the early stages of generation by a single decoder, and also avoiding the lack of long-range dependency modeling ability when the diffusion model generates independently.

[0094] The principle and implementation of a diffusion denoising layer: The diffusion model progressively adds Gaussian noise to the continuous input vector during the forward process and learns to restore the original noise during the reverse process. Let the input vector be z0. Adding noise at the τ-th step in the forward process yields:

[0095]

[0096] Where α τ To retain coefficients, ∈ τ The noise is independent and identically distributed Gaussian noise. The reverse process is performed by a neural network D with parameter θ. θ Predict and restore noise:

[0097]

[0098] α τThe noise scale is controlled based on the molecular topological vector norm, allowing molecules with higher topological complexity to retain more noise in the early stages, thus enabling the recovery of ring systems and bridging details layer by layer during the reverse phase. During training, the mean square error between predicted and actual noise is minimized to achieve consistent vector reconstruction across multiple scales. Because continuous vectors retain the global features of sparse high-dimensional supervectors and the two types of topological vector injections, the diffusion denoising layer reconstructs… It has explicit fidelity to avoid structural defects in subsequent character generation.

[0099] The principle and implementation of the converter layer; after diffusion denoising, the resulting... The input transformer layer utilizes a self-attention mechanism to capture long-term dependencies, generating a five-level sequence of anatomical treatment chemical codes autoregressively at the character level. The output of each level is processed by multi-head attention to compute a context vector, which is then mapped to a character probability distribution via a feedforward network. Decoding employs beam search with a fixed beam width; early stopping is triggered by the output ending character or reaching the five-level length. To maintain consistency with the diffusion reconstruction results, the generated characters are hashed into hypervectors immediately after each generation step and then compared with the hypervectors. Attention alignment is performed, enabling the model to be aware of global constraints for which no information has been generated. This design reduces the propagation of early generation errors.

[0100] The combined effects of the two layers include: the diffusion denoising layer provides coherent multi-scale features, eliminating the need for the transformer to learn global patterns from a randomly initialized space, thus reducing model parameters and training epochs. The transformer layer provides sequence modeling and symbolic fidelity capabilities, semantically correcting residual local inconsistencies in the diffusion denoising layer. Comparative experiments show that using the transformer alone requires setting complex pre-training objectives and is difficult to generalize to new molecules; using the diffusion model alone requires an explicit barcode-to-character mapping table, resulting in high maintenance costs. The serial architecture of this invention combines the advantages of both, significantly improving drug coding accuracy on the same dataset, especially reducing the error rate by more than half for drugs containing rare chiral centers or with multiple indications.

[0101] In this example, a batch of instruction manuals containing adenosine receptor antagonists and multi-target receptor blockers were selected. After training with a diffusion denoising layer, fine-grained topological components could be recovered from a high-noise vector within 20 steps. The transformer layer sequentially output the characters "C", "N", "A", "0", and "8". The third-layer characters were replaced during the beam search phase, and the final encoding was determined to be N06DA03, consistent with the results recorded in the pharmacopoeia. Compared with the baseline model without a diffusion denoising layer, which generated the character sequence N06DD03, residual detection showed a 30% improvement in the error rate of the second-layer characters. This example demonstrates that multi-scale reconstruction plays a necessary role in the encoding inference of complex polycyclic molecules.

[0102] A causal model is constructed on a pharmacological knowledge graph. The corrected anatomical treatment chemical code is obtained by using a combined hypervector as the initial state and calibrating with a hyperdimensional residual. The joint probability variance is calculated based on Monte Carlo Dropout inference, and the final anatomical treatment chemical code is determined by performing counterfactual search or manual verification according to the threshold. The combined hypervector, the final anatomical treatment chemical code, and the joint probability variance are written into the experience base, and the generative neural network and causal model are updated using a reinforcement learning algorithm.

[0103] After completing the combined hypervector mapping and initial encoding generation, this invention introduces a pharmacological knowledge graph to construct a structural causal model. The aim is to utilize the five-element relationship of "component—target—pathway—disease—encoding" to provide interpretable correction for the generated results. The pharmacological knowledge graph records causal dependencies in the form of directed edges, and node attributes contain the original information corresponding to molecular topological vectors and semantic topological vectors. First, the combined hypervector is used as the initial state of the graph god's frequent differential equation, and mapped to the embedding space of the five types of nodes in the graph through a vector splitting function. To enable the bias information of the generative neural network to be fed back to the causal model in real time, a hyperdimensional residual calibration term is added during the forward integration process. Let the node state evolution equation over time be:

[0104]

[0105] Where x is the node state vector, f θ For a parameterized graph neural network, r is the hyperdimensional residual vector, and λ is the residual weight. This formula treats the residual as an external driver that directly acts on the gradient of the differential equation, effectively suppressing deviations in the initial encoding at the disease or pathway level.

[0106] After integration, the causal model outputs a corrected coding sequence, which is compared character-level with the initial coding to obtain the corrected anatomical and therapeutic chemical coding. If they match, the generative neural network output is considered to have been validated by the knowledge graph; otherwise, the causal model output is taken as the current best candidate. To quantify the uncertainty of the candidate coding, this invention inserts dropout layers at the feedforward and attention weights of the causal model to perform Monte Carlo Dropout inference. Several random inferences are performed on the same input, and the variance of the joint probability distribution is calculated, denoted as σ. 2 If σ 2 If σ is less than the low threshold, the encoding is directly confirmed; if σ 2 If the threshold value falls between the low and high thresholds, it will be reviewed by a pharmaceutical expert; if σ 2 If the value exceeds a high threshold, a topological constraint counterfactual search is performed. The counterfactual search generates new combined hypervectors by adjusting the lengths of several barcodes with the highest birth-death ratios in the molecular topological vectors and repeats the aforementioned steps to explore the potential effective coding space.

[0107] Once the final anatomical treatment chemical code is determined, the combined hypervector, confirmation code, and joint probability variance, along with the task identifier and timestamp, are written into the experience base, forming a "state-action-confidence" triple for reinforcement learning. The experience base is stored using a graph database, with disease category as the partition key to achieve high-concurrency writing. During the reinforcement learning phase, a hierarchical Bayesian proximal policy algorithm is used to update the generative neural network and causal model. The policy network parameter is defined as θ, and the old policy is θ0. old The following clipping target is used:

[0108]

[0109] in A is the advantage function, and ∈ is the pruning coefficient. The advantage function is approximated by the difference between the actual reward and the value function. In this invention, the reward depends on whether the encoding is accepted by the causal model and the magnitude of its joint probability variance. This optimization process updates the policy network several steps in each iteration and then synchronizes it to the low-rank shared part of the causal model weights, achieving consistent parameter convergence between the generation and knowledge ends.

[0110] For example, when processing a novel kinase inhibitor, the initial encoding is L01XE. The causal model adjusts the disease level to "C" based on target and pathway information, resulting in C01XE. The joint probability variance of the Monte Carlo Dropout inference is 0.07, falling within the manually verified range. Pharmaceutical experts confirm that because the pathway is located on the adrenaline axis, the encoding should be C01AD. The system then writes this into its experience base and awards a high reward. Reinforcement learning adjusts the disease level of the generated model to "C" in the next round, significantly reducing similar errors.

[0111] Preferably, when performing Monte Carlo Dropout inference on the corrected anatomical treatment chemical code, a preset number of random samples are used to obtain the joint probability variance.

[0112] After completing the causal model output correction anatomical treatment chemical coding, this invention needs to evaluate the reliability of the coding to determine whether to directly confirm, proceed to manual review, or trigger a counterfactual search. To this end, this invention introduces Monte Carlo Dropout inference to quantify the uncertainty of the model. Dropout suppresses overfitting by randomly masking neurons during the regular training phase. If the masking operation is maintained during the inference phase, it can be considered as multiple random samplings of the network weights, thus approximating a Bayesian posterior distribution. Specifically, in the scenario of this invention, several dropout nodes are pre-inserted into the graph attention layer, linear mapping layer, and temporal evolution kernel of the causal model. During inference, some weights are reset to zero according to a fixed probability. S forward inferences are performed on the same input to obtain S candidate coding sequences and their joint probabilities. Let p be the joint probability of the s-th candidate. (s)It is defined as the product of the probabilities of five characters. This invention selects the variance of the joint probability as the uncertainty index, and the calculation formula is:

[0113]

[0114] in Let σ be the joint probability mean. 2 Let p be the joint probability variance. (s) This represents the joint probability value of the s-th sample. The symbol S represents the preset number of random samples, which is consistent with the number of samples taken during training to ensure that the estimation is unbiased.

[0115] At the implementation level, to reduce computational redundancy, this invention sets the Dropout probability to a fixed value only during the inference phase and batches the S inference iterations onto the GPU cores, saving GPU memory by sharing the forward graph. The character distributions between candidate encoded sequences can be concatenated along the tensor dimension and the joint probability vector calculated in one go. Then, the variance is calculated on the CPU side, achieving multi-GPU pipelined output. The causal model itself has already constrained topological consistency through graph god frequent differential equations; therefore, the variance of the joint probability mainly reflects the network's confidence in complex causal paths, rather than the generative neural network's confidence in character-level semantics. Experiments show that setting the Dropout probability to half of that during the training phase achieves a balance between variance accuracy and inference time.

[0116] The threshold mechanism is designed based on the distribution statistics of multiple batches of experiments. A low threshold is set below the quintile of the training set variance distribution, ensuring that directly confirmed samples are almost error-free; a high threshold is set above the ninth percentile to identify obviously conflicting codes. The middle range is reserved for manual review, allowing experts to make the final decision based on pharmacopoeias and the latest guidelines. This three-stage strategy ensures both automation efficiency in high-throughput scenarios and avoids the model incorrectly admitting rare cases.

[0117] For counterfactual searches, this invention still utilizes the variance metric for early stopping. If the newly generated code significantly reduces the variance, the search is terminated promptly and the current best code is updated; if the variance remains above the threshold after multiple perturbations, it reverts to the manual review channel to avoid wasting computational resources on ineffective searches. The perturbation amplitude of the molecular topology vector during the search process is constrained by the decay of the persistent barcode length, ensuring that the generated counterfactual samples still maintain chemical feasibility.

[0118] Experience base records triples <H,c final ,σ 2 The reinforcement learning phase maps variance inversely to the reward signal: when σ... 2 A high reward is given when the low-level code matches the manual verification; when σ 2The high-resolution model is penalized during the final manual review and modification. In this way, the generative neural network converges to a smaller variance region, the causal model converges to a more stable causal path, and the entire system forms a cluster-loop correction.

[0119] Example: For a novel immunomodulator, the first round of inference output of the causal model is encoded as LO4AX. Monte Carlo Dropout sampling is performed S=30 times, and σ is calculated. 2 =0.011, falling within the middle range. Expert review revealed a pathway hierarchy bias, which was adjusted to L04AD. This pair of samples was added to the experience base, and a slight negative reward was given to the generative model. After three rounds of offline reinforcement learning, the variance of drugs with similar structures during re-inference decreased to 0.004, allowing them to directly enter the automatic confirmation channel. The results show that using joint probability variance as an uncertainty measure and incorporating it into reinforcement learning not only improves the automation rate but also significantly reduces the expert review load.

[0120] By using Monte Carlo Dropout variance assessment, this invention ensures the accuracy of drug classification coding, provides quantitative basis for subsequent counterfactual search and expert review, and achieves continuous self-evolution of the model with the help of an experience base, thereby maintaining high confidence output under diverse new molecular input scenarios.

[0121] Preferably, the threshold corresponding to the joint probability variance is divided into a first threshold and a second threshold. When the joint probability variance is lower than the first threshold, the final anatomical treatment chemical code is directly confirmed. When it is higher than the second threshold, a counterfactual search is triggered. When it is between the first threshold and the second threshold, manual review is performed.

[0122] Joint probability variance measures the dispersion of the confidence distribution of a causal model for the same drug coding sequence in multiple Monte Carlo dropout inferences. A small variance indicates consistent joint probability assessments of the coding sequence under different random weight samplings, suggesting low coding uncertainty. A large variance indicates unstable predictions for the same input, posing a risk of structural or semantic conflicts. This invention uses a two-level threshold mechanism to map the probability variance to three processing paths: automatic verification, manual review, and counterfactual search, balancing efficiency and safety.

[0123] The principle for determining the threshold is as follows: First, variance distributions are collected for all samples on the training and independent validation sets, resulting in right-skewed long-tailed curves. Based on empirical rules, percentiles are used as boundaries: low thresholds are located near the 25th percentile, corresponding to the high confidence region of the model for common molecular structures and typical indications; high thresholds are located near the 90th percentile, corresponding to the high-risk region for rare ring systems or textual description anomalies. To prevent data drift from causing threshold invalidation, this invention automatically re-estimates the variance distribution and smoothly updates the threshold after each offline training session.

[0124] Implementation process: During forward inference of the causal model, the dropout probability is maintained and remains consistent with that during training. The joint probability p is calculated S times for the same combination of hypervectors. (s) Let the mean of the joint probability be:

[0125]

[0126] The joint probability variance is:

[0127]

[0128] S represents the number of samples, p (s) Let represent the joint probability obtained from the s-th random sampling. The final variance σ 2 With two-level thresholds and Comparison: If The system immediately confirms the current encoding; if The data is pushed to the pharmaceutical review interface for experts to verify in conjunction with clinical guidelines; if... Initiate a counterfactual search. The counterfactual search generates a nearest-neighbor combination supervector by fine-tuning the length of the persistent barcode with the highest birth-death ratio in the molecular topological vector, and then re-enters Monte Carlo evaluation until the variance drops to the safe zone or the search step limit is reached.

[0129] This three-stage decision-making strategy brings two benefits. First, low-risk samples are directly confirmed, reducing manual intervention and maintaining high throughput. Second, high-risk samples are automatically triggered for searching, avoiding blind extrapolation of the model in unknown chemical spaces. Empirical data shows that the threshold strategy controls the proportion of manual review to about 10% of the overall task workload, but improves the coding accuracy of rare structured drugs by more than 8%. Example: For antiviral molecules containing perfluorocyclic alcohol side chains, the initial variance was 0.16, which was higher than the high threshold. After adjusting the topological barcode through a counterfactual search, the variance decreased to 0.03, and the final coding passed automatic confirmation, avoiding human misjudgment.

[0130] Update Mechanism: The system periodically writes the combined hypervector, confirmation code, and variance into the experience base. During the reinforcement learning phase, the variance and expert feedback are mapped to reward signals. After parameter updates, the variance distribution is recalculated and the threshold is adjusted to achieve dynamic adaptation. This process is repeated, and the invention maintains the robustness of threshold determination while expanding the pharmacological knowledge graph, ensuring that the encoding results are both efficient and reliable.

[0131] Preferably, the combined hypervector, final anatomical treatment chemical code, and joint probability variance, along with task identifiers and time information, are written into an experience base to form experience samples, and the experience samples are used as input data for reinforcement learning algorithms.

[0132] To enable the coding system to continuously evolve when processing new molecules and semantics, this invention writes the combined hypervector, the final anatomical treatment chemical code, and the joint probability variance, along with task identifiers and temporal information, into an experience base, forming experience samples that can be used for reinforcement learning. This process not only records model input and output but also simultaneously saves confidence indices, thereby providing density-weighted signals for policy optimization. The structure of the experience samples is as follows: the key "state" stores the combined hypervector H; the key "action" stores the final determined anatomical treatment chemical code C. final The key "sigma2" stores the joint probability variance σ. 2 The keys "uid" and "timestamp" store the task identifier and generation time, respectively. The experience database is implemented using a key-value database, with disease categories as partition keys, ensuring sub-millisecond latency for both insertion and retrieval.

[0133] In the reinforcement learning phase, encoding inference is viewed as a sequential decision problem, and the policy network parameters are denoted as θ. To correlate the reward with the model confidence, this invention designs the following immediate reward function:

[0134] R=β(1-σ 2 )-δ

[0135] Where β is the confidence weight and δ is the manual correction penalty term (set to 1 when the final encoding is modified after manual review, otherwise 0). This function encourages the model to output encoding results with low variance and without manual intervention. The policy update adopts the hierarchical Bayesian proximal policy method, treating the output distribution of the generative neural network as a high-level policy and the correction distribution of the causal model as a low-level policy, ensuring a smooth transition of the gradients of the two policies in the parameter space by sharing a low-rank basis matrix. The pruning objective function is written as follows:

[0136]

[0137] Where r(θ) represents the probability ratio between the old and new strategies, A is the advantage function, and ∈ is the pruning coefficient. The advantage function is calculated from the difference between the reward R and the value function estimate, ensuring that the update step size is controlled.

[0138] Experience samples are written to the replay buffer using a first-in, first-out (FIFO) strategy. Each strategy update involves uniformly sampling batches of samples from the buffer according to disease categories to avoid high-frequency, common drugs covering features of rare categories. To suppress overestimation of the value function, this invention randomly masks a portion of σ in the batch. 2 Set the field to the mean so that the network can maintain stable output even when the confidence level is missing, and will not degenerate due to overfitting variance.

[0139] For example, a coding system processes approximately one million tasks per week, accumulating an experience base of a similar magnitude of samples. Statistical analysis reveals σ 2The median of the distribution was 0.012, and the 95th percentile was 0.065. When β=2, the reward for high-confidence samples with no intervention was close to 2; the reward for samples requiring manual correction but with low variance was approximately 1; and the reward for samples with high variance and that were modified approached 0, causing the policy network to tend to produce low-variance encodings. After three iterations, the system's encoding accuracy on the new compound benchmark set improved from 93.2% to 95.8%, while the manual review rate decreased from 12% to 7%. This indicates that experience-based reinforcement learning effectively enhances the model's adaptability and reliability.

[0140] Another advantage of the storage strategy is traceability and auditability. Because each experience sample retains a timestamp and task identifier, if subsequent pharmacopoeia standard updates necessitate coding adjustments, historical predictions can be quickly located and batch retrained via key lookup. The experience repository also supports exporting subsets by disease classification, providing a data source for fine-tuning domain-specific models and shortening transfer learning time.

[0141] In summary, by incorporating information such as combined hypervectors, final encoding, and joint probability variance into the experience base, this invention constructs a data-policy closed loop. The reward function design explicitly incorporates confidence level and the cost of manual intervention into the optimization objective; the hierarchical Bayesian proximal policy method ensures the coordinated convergence of the generative network and the causal model; and the experience replay buffer prevents data distribution shifts. This mechanism enables the system to maintain high accuracy and low labor costs even when facing constantly emerging new drugs and indications, significantly improving the sustainability and economic efficiency of the drug coding determination process.

[0142] Preferably, the reinforcement learning algorithm employs a hierarchical Bayesian proximal policy optimization algorithm to simultaneously update the parameters of the generative neural network and the causal model.

[0143] The hierarchical Bayesian proximal policy optimization algorithm is a reinforcement learning method that incorporates Bayesian priors and hierarchical parameter design based on proximal policy optimization. This invention uses this algorithm to simultaneously update the parameters of both the generative neural network and the causal model. Its principle can be divided into three layers: the top layer is the decision policy distribution, the middle layer is the low-rank shared basis matrix, and the bottom layer is the specific network weights. The top layer uses the parameterized policy π... θ The output drug coding sequence probability is calculated; the middle layer projects all weights of the generative neural network and the causal model onto a shared orthogonal subspace and represents them as a low-rank basis matrix B; the bottom layer coefficient matrix Λ controls the linear combination of each network on the basis matrix. In this way, the two networks share directional information during updates while retaining their own detailed differences.

[0144] The empirical samples include combined hypervectors, final anatomical treatment chemical codes, joint probability variance, task identifiers, and timestamps. The reward function is calculated based on the joint probability variance and manual adjustments.

[0145] R=β(1-σ 2 )-δ

[0146] Where β is the confidence weight, σ 2 Let δ be the joint probability variance, and δ be the manually adjusted penalty label. The advantage function, derived from the difference between the reward and value functions, measures the improvement of the current policy relative to the baseline. The policy update objective is in a pruned form. in A is the advantage function, and ∈ is the pruning coefficient, ensuring that parameter variations do not exceed the trust region. The Bayesian prior assumes that the elements of the middle layer basis matrix are independent based on a normal distribution, and simultaneously provides regularization for generative networks and causal models, making their gradient directions converge in the same direction and preventing overfitting.

[0147] During training, a batch of samples is first randomly sampled in the experience replay buffer, and then the reward and advantage are calculated. For rare disease categories, the sampling probabilities are reweighted according to the inverse of the category frequency to avoid common samples dominating the gradient. Each iteration is executed in the following order: 1. Freeze the basis matrix and update only the coefficient matrix for a few steps; 2. Jointly fine-tune the basis matrix in the low-loss interval; 3. Synchronize the coefficients to the causal model so that the two networks maintain a shared subspace. This alternating process balances stability and representational capability.

[0148] Example: After three rounds of training on a dataset containing one million experience samples, the average accuracy of drug coding improved from 93.2% to 96.1%, the median joint probability variance decreased from 0.018 to 0.011, and the manual review rate decreased from 12% to 7%. Furthermore, the sparsity of the edge weights in the causal model improved, significantly enhancing interpretability. The example shows that for a newly emerging class of cyclic peptide antibiotics, this algorithm can quickly control the error rate below 4% with only a few hundred new samples, demonstrating that the shared low-rank basis matrix has strong generalization ability for scenarios with few samples. In summary, the hierarchical Bayesian proximal policy optimization algorithm, through hierarchical sharing, probability pruning, and Bayesian regularization, achieves the synergistic self-evolution of generative neural networks and causal models, significantly improving the accuracy, stability, and interpretability of the drug coding process in this invention.

[0149] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects.

[0150] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for determining drug codes, characterized in that, include: Collect drug instruction manual text data, drug chemical structure data, and active ingredient and target data, generate a set of structured text data, molecular structure data, and target data, and integrate them as task input objects with a unique task identifier; Based on the topological homology method, molecular topological vectors and semantic topological vectors are extracted from the syntactic dependency relations of molecular structure data and structured text data respectively and merged into the task input object. The task input object is hashed to obtain sparse high-dimensional hypervectors. After injecting the molecular topological vectors and semantic topological vectors, a combined hypervector is formed through binding transformation and mapped to a continuous vector. Generative neural networks are used to generate preliminary anatomical treatment chemical codes and calculate hyperdimensional residuals. A causal model is constructed on a pharmacological knowledge graph. The corrected anatomical treatment chemical code is obtained by using a combined hypervector as the initial state and calibrating with a hyperdimensional residual. The joint probability variance is calculated based on Monte Carlo Dropout inference, and the final anatomical treatment chemical code is determined by performing counterfactual search or manual verification according to the threshold. The combined hypervector, the final anatomical treatment chemical code, and the joint probability variance are written into the experience base, and the generative neural network and causal model are updated using a reinforcement learning algorithm.

2. The method according to claim 1, characterized in that, The topological coherence method compares the generation time and the disappearance time of the barcode and selects persistent coherent barcodes with a generation-to-death ratio higher than a preset threshold to generate molecular topological vectors and semantic topological vectors.

3. The method according to claim 1, characterized in that, When performing hash mapping on the task input object, each identifier is mapped to a sparse high-dimensional hypervector of a preset dimension.

4. The method according to claim 1, characterized in that, After injecting the molecular topological vector and the semantic topological vector, the binding transformation is completed by sequentially performing a bitwise XOR operation and a fixed-number cyclic shift operation to form a combined hypervector.

5. The method according to claim 1, characterized in that, When mapping the combined hypervectors to continuous vectors, noise scheduling parameters are generated based on the norm of the molecular topological vectors, and the diffusion process is controlled accordingly.

6. The method according to claim 1, characterized in that, The generative neural network is configured with a diffusion denoising layer and a transformer layer in sequence. The diffusion denoising layer is used to reconstruct the multi-scale features of continuous vectors, and the transformer layer is used to recursively generate the preliminary anatomical treatment chemical code.

7. The method according to claim 1, characterized in that, When performing Monte Carlo Dropout inference on the corrected anatomical treatment chemical code, a preset number of random samples are used to obtain the joint probability variance.

8. The method according to claim 1, characterized in that, The thresholds corresponding to the joint probability variance are divided into a first threshold and a second threshold. When the joint probability variance is lower than the first threshold, the final anatomical treatment chemical code is directly confirmed. When it is higher than the second threshold, a counterfactual search is triggered. When it is between the first threshold and the second threshold, manual review is performed.

9. The method according to claim 1, characterized in that, The combined hypervector, final anatomical treatment chemical code, and joint probability variance, along with task identifiers and time information, are written into an experience base to form experience samples, which are then used as input data for reinforcement learning algorithms.

10. The method according to claim 1, characterized in that, The reinforcement learning algorithm employs a hierarchical Bayesian proximal policy optimization algorithm to simultaneously update the parameters of the generative neural network and the causal model.

Citation Information

Cited By

  • Graph neural network calculation method combining graph sparsity and low-bit quantization

    CN121413657A

  • Complex peptide traceable structure coding method

    CN122201510A