CN115526322A - Sequence generating type knowledge inference method and system based on precision transform - Google Patents

Sequence generating type knowledge inference method and system based on precision transform Download PDF

Info

Publication number
CN115526322A
CN115526322A CN202211168517.2A CN202211168517A CN115526322A CN 115526322 A CN115526322 A CN 115526322A CN 202211168517 A CN202211168517 A CN 202211168517A CN 115526322 A CN115526322 A CN 115526322A
Authority
CN
China
Prior art keywords
sequence
inference
knowledge
rule
path
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211168517.2A
Other languages
Chinese (zh)
Inventor
夏毅
罗军勇
兰明敬
周刚
陈晓慧
李志博
卢记仓
刘铄
王世宇
朱秀宝
王凌
李珠峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Information Engineering University of PLA Strategic Support Force
Original Assignee
Information Engineering University of PLA Strategic Support Force
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Information Engineering University of PLA Strategic Support Force filed Critical Information Engineering University of PLA Strategic Support Force
Priority to CN202211168517.2A priority Critical patent/CN115526322A/en
Publication of CN115526322A publication Critical patent/CN115526322A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/04Inference or reasoning models
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/02Knowledge representation; Symbolic representation
    • G06N5/022Knowledge engineering; Knowledge acquisition
    • G06N5/025Extracting rules from data

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Computational Linguistics (AREA)
  • Computing Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention belongs to the technical field of knowledge maps, and particularly relates to a sequence generation type knowledge reasoning method and system based on precision transform, which are used for extracting entities in a target knowledge map and relationships among the entities, and inducing a structured rule sequence in the target knowledge map; constructing a precision transform inference model for knowledge inference and map environment dynamic interaction, wherein the precision transform inference model adopts a rule guide mode to construct a training path sample of the inference model when dynamically interacting with a map environment, and trains the precision transform inference model by using the training path sample so as to learn the common occurrence capability of rule learning in a path; and (3) carrying out knowledge reasoning through a precision Transformer reasoning model on the basis of the extracted entities, the relationships among the entities and the rule sequence, and outputting a reasoning result. According to the method, the inference sequence is processed in parallel by using a precision Transformer framework according to the current inference state through a sequence generating inference process dynamically interacting with the map environment, and the next action is inferentially inferred, so that the faster knowledge inference is realized, the inference efficiency is improved, and the inference interpretability is enhanced.

Description

Sequence generating type knowledge inference method and system based on precision transform
Technical Field
The invention belongs to the technical field of knowledge maps, and particularly relates to a sequence generation type knowledge reasoning method and system based on precision transform.
Background
With the widespread use of artificial intelligence technology, the interpretability of artificial intelligence has received increasing attention. In the currently popular deep learning model, a complex processing mechanism and a large number of parameters make it difficult for human beings to trace back and understand the reasoning process, so that the interpretability of the end-to-end black box learning method is poor, and high-performance complex algorithms, models and systems generally cannot explain autonomous decisions and behaviors of the algorithms and the models to human users, and the interpretability of decision logic is lacking. Interpretability is crucial for users to effectively understand, trust, and manage artificial intelligence applications, in stark contrast to the concept of "black boxes" in deep neural networks. Unexplainable models often present in practice situations where it is difficult to predict the correct outcome, which in low risk environments will not have serious consequences (e.g. video recommendation systems), while for systems with higher reliability requirements are very dangerous (e.g. medical, legal and information security domains), the model has to explain how the relevant predictions are obtained. Therefore, it is very important to realize interpretable Artificial Intelligence (XAI), which provides a trusted foundation, on which Artificial Intelligence can act in a wider range, helping to identify potential errors, further improving models, improving information service quality, meeting the requirements of morality and law, and providing more intelligent services for users. The knowledge graph is one of the core technologies of the existing artificial intelligence, and as a novel knowledge representation method, the knowledge graph contains a large amount of prior knowledge, massive information is organized in a structured triple mode, and different data sources are associated and deeply fused in an entity and relationship mode. As a semantic and structural expression mode of knowledge, the knowledge graph carries out knowledge reasoning on entities and relations in a human-understandable expression form, combines entity information around nodes through auxiliary means such as reasoning paths and logic rules, and carries out explicit interpretable knowledge graph reasoning, and provides a solution for realizing interpretable artificial intelligence. At present, a large number of knowledge maps, such as YAGO, dbpedia and Freebase, have been developed, and have wide application prospects in the fields of information retrieval, information security, network space security and the like, and the prominent expression of the knowledge maps is that the knowledge maps are widely concerned in both academia and industry.
Knowledge reasoning is a process of generalizing from individual knowledge to general knowledge by starting from known knowledge and acquiring new facts from the knowledge through reasoning mining or generalizing a large amount of existing knowledge. Early reasoning research is mostly in the field of logic description and knowledge engineering, many scholars advocate formalized methods to describe the objective world, and it is always the focus of their research to consider that all reasoning is based on existing logic knowledge, such as first-order logic and predicate logic, and how to draw correct conclusions from known propositions and predicates. In recent years, with the explosive growth of the data scale of the internet, the traditional method based on the manual establishment of the knowledge base cannot adapt to the mining requirement of the big data era on a large amount of knowledge. At present, knowledge-graph-oriented knowledge inference is a typical representative of the knowledge inference field, and the method combines knowledge such as concepts, attributes, relations and the like on the graph structure of the knowledge graph and carries out specific related knowledge inference tasks through related inference technologies. Concepts, attributes and relations contained in the knowledge graph can be naturally used for explanation, and are more consistent with the cognition of human beings on the explanation, so that the intuitive modeling is convenient for reasoning and explanation scenes of the real world. Although the prior knowledge inference method based on the knowledge graph has good effect and provides partial interpretability, the following defects still exist: (1) In the reasoning process, an intelligent agent for reasoning needs to explore a large number of paths, and each time the walk reasoning of one hop is added, the search space grows exponentially, so that the conventional reasoning model usually needs long model convergence time and the reasoning speed is slow. (2) Most corpora in the real environment are low-resource, and most constructed knowledge maps are sparse. The sparseness of the map environment causes the loss of a plurality of key reasoning paths, so that the reasoning module has a phenomenon of reasoning interruption.
Disclosure of Invention
Therefore, the invention provides a sequence generating knowledge inference method and a sequence generating knowledge inference system based on a precision transform, which realize dynamic interaction between a knowledge map and an inference process, can solve the interruption phenomenon caused by path loss in the inference process and are convenient to apply in an actual scene.
According to the design scheme provided by the invention, a sequence generating knowledge reasoning method based on a precision Transformer is provided, which comprises the following contents:
extracting entities and relationships among the entities in the target knowledge graph, and inducing a structured rule sequence in the target knowledge graph;
constructing a precision Transformer inference model for knowledge inference and map environment dynamic interaction, wherein the precision Transformer inference model adopts a rule guiding mode to construct a training path sample of the inference model when dynamically interacting with a map environment, and trains the precision Transformer inference model by using the training path sample so as to learn the common occurrence capability of rule learning in a path;
and (3) carrying out knowledge reasoning by using the extracted entities, the relationships among the entities and the rule sequence through a precision Transformer reasoning model and outputting a reasoning result.
As a precision Transformer-based sequence generation type knowledge inference method, further, in mining the rules in the target knowledge graph, a rule induction method is used for inducing the structural rules in the target knowledge graph; and using a preset score threshold to screen out the rules with confidence scores higher than the score threshold.
As the sequence generating knowledge inference method based on the precision transform, the precision transform inference model further comprises an encoder and a decoder, each entity and relationship are embedded and expressed in the encoder to generate a token sequence, and the precedence order of the inference process is distinguished by adding position codes in the embedded expression of the entities or the relationship; in the decoder, the next step of reasoning action is output by task decoding the sequence before the current learning sequence item.
As the sequence generation type knowledge inference method based on the precision Transformer, a decoder of an inference model adopts a Causal Transformer model to decode a token sequence of the encoder and generate a next inference sequence.
As a sequence generating knowledge inference method based on precision transform in the present invention, further, a precision transform inference model adopts cross entropy as a target loss function, and utilizes label smoothing to smooth the loss function, where the target loss function is expressed as:
Figure BDA0003862500320000031
wherein, tau represents the sequence, k represents the sequence number of the sequence, V represents the dictionary formed by each element in the sequence, alpha i Weight representing label smoothness, q represents query, p (i | q, τ) <k ) Representation is according to the current sequence sumAnd generating sequence probability distribution in the next step of query, wherein the element belongs to a set hyper-parameter, and K represents the total number of sequence categories.
As a sequence generating knowledge inference method based on precision transform, the invention further adopts a rule-guided mode to construct a training path sample of an inference model, and firstly traverses all random walk paths within k under preset query conditions by a random walk method; secondly, initializing entity and relationship representation in the graph by using a graph embedding method, and traversing each path of all entity and relationship element pairs in the random walk path; and then, sorting the importance of all random walk paths according to the path rule rewards and the semantic similarity between the paths and the query conditions, and selecting the first N paths as training path samples.
The sequence generating type knowledge inference method based on the precision transform further ranks all random walk paths according to the importance of the rule reward of the paths and the semantic similarity between the paths and the query conditions, and uses a formula
Figure BDA0003862500320000032
To calculate a path score, and to rank the importance by score size, where p i Represents the path i, a i Representing semantic similarity between the corresponding path and the query condition, c i Represents the regular reward of the corresponding path, and λ is the weight parameter.
As the sequence generating type knowledge inference method based on precision transform, the semantic similarity a between the path and the query condition i The calculation is carried out by embedding the attention values representing the preset query conditions into the path, and the calculation process is represented as follows: a is i =softmax(q T r i ),
Figure BDA0003862500320000033
Wherein r is i For all embedded representations of corresponding path samples, p ij For the corresponding entity and relationship element pairs in the path sequence, q represents the query stripPiece a, represents a weight matrix composed of corresponding attention values.
The invention relates to a sequence generation type knowledge reasoning method based on precision Transformer, further, rule reward of a path is obtained through confidence score of the rule, if the path sequence of random walk corresponds to the extracted rule, the confidence corresponding to the rule is taken as the rule reward, if the path of random walk meets a plurality of rules at the same time, the confidence between the rules is large, the rule with the maximum confidence score is selected as a matching rule, and the confidence corresponding to the matching rule is taken as the rule reward.
Further, the present invention provides a precision Transformer-based sequence generating knowledge inference system, comprising: a rule mining module, a model building module and a knowledge reasoning module, wherein,
the rule mining module is used for extracting entities and relationships among the entities in the target knowledge graph and inducing a structured rule sequence in the target knowledge graph;
the model construction module is used for constructing a precision transducer inference model for knowledge inference and map environment dynamic interaction, wherein the precision transducer inference model adopts a rule guide mode to construct a training path sample of the inference model when dynamically interacting with a map environment, and trains the precision transducer inference model by using the training path sample so as to learn the common occurrence capability of rules in a learning path;
and the knowledge reasoning module is used for carrying out knowledge reasoning through a precision Transformer reasoning model on the basis of the extracted entities, the relationship among the entities and the rule sequence and outputting a reasoning result.
The invention has the beneficial effects that:
the knowledge inference method adopts sequence generation type knowledge inference to realize the knowledge inference oriented to the knowledge map, models the whole knowledge inference process into a sequence, models the sequence through a precision Transformer of an encoder-decoder structure, and generates a next inference sequence in an autoregressive manner, thereby realizing more efficient and rapid knowledge inference; meanwhile, the scheme can be adapted to a larger-scale real knowledge map for reasoning application by virtue of the efficiency advantage of sequence generation sequence reasoning. By means of the advantages of the sequence generation model, the inference model in the scheme does not learn in the previous path exploration mode, and realizes path inference through sequence generation, so that the model has higher robustness to missing paths in the inference process. Compared with the current neural network of the black box which can not explain and directly output the reasoning result, the scheme can display the reasoning process in an interpretable path mode, the model is relatively more transparent, and the trust degree of people on model decision is higher. In addition, the unexplainable property of the reasoning method has great influence on the reasoning result and the related backtracking, and another advantage brought by the explicit reasoning adopted by the scheme is that the wrong reasoning sample can be better backtracked.
Description of the drawings:
FIG. 1 is a schematic diagram of a knowledge inference process in an embodiment;
FIG. 2 is a schematic diagram of a sequential knowledge inference process in an embodiment;
FIG. 3 is a schematic diagram of a precision Transformer inference model in the embodiment;
fig. 4 is a schematic flow of a rule-guided path sample construction process in an embodiment.
The specific implementation mode is as follows:
in order to make the objects, technical solutions and advantages of the present invention clearer and more obvious, the present invention is further described in detail below with reference to the accompanying drawings and technical solutions.
The embodiment of the invention, as shown in fig. 1, provides a precision Transformer-based sequence generating knowledge inference method, comprising:
s101, extracting entities and relationships among the entities in a target knowledge graph, and inducing a structured rule sequence in the target knowledge graph;
s102, constructing a precision Transformer inference model for knowledge inference and map environment dynamic interaction, wherein when the precision Transformer inference model dynamically interacts with a map environment, a training path sample of the inference model is constructed in a rule guiding mode, and the precision Transformer inference model is trained by utilizing the training path sample so as to learn the common experience capability of rules in a path;
and S103, carrying out knowledge inference through a precision Transformer inference model on the basis of the extracted entities, the relationships among the entities and the rule sequence, and outputting an inference result.
The precision Transformer models the relationship between the Return-to-go sequence (RET-to-go), state sequence (state) and action sequence (action) using RL as an autoregressive sequence modeling problem. In contrast to the generally accepted behavioral cloning (behavior cloning) modeling only state and action relationships, reward and past triplet (Rt, st, at) sequences are additionally considered. As shown in fig. 2, unlike the conventional search method based on trial and error (trial-and-error) for reinforcement learning, in the embodiment of the present invention, a precision Transformer inference model is used to simulate the interaction process of reinforcement learning, and an inference module generates and outputs the next inference action based on learning the reward, state and action input of the history sequence. Therefore, when the inference model in the scheme is trained, the inference sequence can be processed in parallel through the Transformer architecture, the inference module and the knowledge graph environment carry out dynamic interaction, the inference process generates and infers the next inference sequence according to the current inference state, and faster inference is realized.
In the process of mining the rules in the target knowledge graph, a rule induction method can be used for inducing the structured rules in the target knowledge graph; and using a preset score threshold to screen out the rules with confidence scores higher than the score threshold. Modeling the serialized knowledge inference process, i.e. giving head entity e s And query q, the model generates a complete inferred process sequence τ, the tail entity e of which o I.e. the result of the inference, expressed as: q: = (e) s ,r q ),τ:=(R 1 ,a 1 ,s 1 ,...,R n ,a n ,e o ,<eos>)。
As a preferred embodiment, further, the precision Transformer inference model includes an encoder and a decoder, in the encoder, each entity and relationship are embedded and represented, a token sequence is generated, and the precedence order of the inference process is distinguished by adding position codes in the embedded representation of the entities or the relationships; in the decoder, the next step of reasoning action is output by task decoding the sequence before the current learning sequence item. And the decoder of the inference model adopts a Causal transform model to decode the token sequence of the encoder and generate a next inference sequence.
Referring to fig. 3, in the encoder module of the Transformer, each entity and relationship may be embedded and represented by a knowledge graph embedding model ConvE, and each token is mapped to a vector of the same dimension. Meanwhile, in order to further distinguish the precedence relationship of inference, a corresponding position code can be added to each entity or the embedded representation of the relationship. At the decoder module, the decoding generation task of the embedded sequence can be carried out through a Causal Transformer model, and the next possible action is generated in an autoregressive mode through the sequence mode in the learning inference path. The original Transformer inputs all the contexts into the model, learns some co-occurrence patterns in the sequence through a self-attention mechanism, however, when the mechanism is applied to the inference task, the mechanism can cause the following inference sequence to be exposed to the model for learning, and the purpose of simulating inference cannot be achieved. In the embodiment of the scheme, a Causal Transformer can be adopted, only the sequence before the current learning sequence item is input into the model, and the next action is output, so that the method is more suitable for the application of a knowledge inference task.
Figure BDA0003862500320000061
p(·∣q,τ <k )=CausalTransformer(Encoded_Sequence(e s ,r q<k ))
In the training process, cross entropy can be used as a loss function, and label smoothing (label-smoothing) is used to smooth the loss function, so as to prevent an overfitting phenomenon, and a specific loss function can be expressed as:
Figure BDA0003862500320000062
Figure BDA0003862500320000063
as a preferred embodiment, further, in the training path sample of the inference model is constructed in a rule-guided manner, first, all random walk paths within k under a preset query condition are traversed by a random walk method; secondly, initializing entity and relationship representation in the graph by using a graph embedding method, and traversing each path of all entity and relationship element pairs in the random walk path; and then, sorting the importance of all random walk paths according to the path rule rewards and the semantic similarity between the paths and the query conditions, and selecting the first N paths as training path samples.
And (3) guiding the capability of sequence co-occurrence in a learning path of the precision Transformer by generating high-quality path training samples. If the path is sampled by simply relying on the random walk strategy, the sampling path may have low sample quality, and even noise may be introduced. In order to construct high-quality path samples and enable a sequence generation model to learn better, the invention provides guidance for constructing training path samples in a rule-guided mode. The rules are the frequently-appearing path combination modes in the map, global information guidance can be provided for selection of high-quality training samples, and the random walk searching path is more representative by extracting the rules with the global information and combining an attention mechanism and the global information guidance of the rules.
As shown in fig. 4, given a query of training samples, a random walk path within all k hops of the query is first traversed by a random walk method. Then, initializing the entity and relationship representation in the map by a knowledge map embedding method, and traversing all elements in the random walk path to each path p i And (4) performing representation.
Figure BDA0003862500320000071
Wherein r is i For representation of corresponding path samples, p ij For each corresponding element (entity and relationship) in the path sequence.
Next, in the stage of measuring the path sample quality, all path embedding r is calculated i And calculating the semantic similarity between each path and the corresponding query according to the attention value of the query q, wherein the calculation method comprises the following steps:
a i =softmax(q T r i )
in the rule guiding stage, some rules can be extracted from the knowledge graph through a rule induction method AnyBURL, the rules are path combination modes which frequently appear in the graph, and the guidance of global information can be provided for the path reasoning of the reinforcement learning agent. A sample of the extraction rule is as follows:
concept:athlete_playsin_league(a,b)←concept:athlete_playsin_team(a,e)∧concept:team_playsin_league(e,b)
each rule corresponds to a confidence score, and the higher the confidence score is, the higher the confidence of the corresponding rule is. Meanwhile, the higher the confidence score is, the more frequently the mode appears in the knowledge graph is shown, and the higher the confidence of the corresponding rule is. And performing additional regular reward on the path which is randomly walked according to the high-confidence rule. If the path sequence of the random walk corresponds to the extracted rule, using the confidence corresponding to the rule as an additional rule reward c i . The higher the credibility of the rule corresponding to the inference path is, the higher the confidence of the rule is, and the higher the rule reward obtained by the path sample is.
Figure BDA0003862500320000072
At the same time, if the path of random walk satisfies the rule at the same time
Figure BDA0003862500320000073
And rules
Figure BDA0003862500320000074
At this time, the corresponding R is compared 1 And R 2 And taking the rule corresponding to the higher confidence score as the matching rule.
Calculating final score by comprehensively considering attention score and rule reward score of the semantic similarity
Figure BDA0003862500320000075
The importance of all random walk paths is sorted through the scores, the first N paths are selected as high-quality path samples, and the quality of the path samples is higher than that of training paths obtained through a pure random walk method in reliability, so that a precision Transformer reasoning module can be trained better, and the co-occurrence capability of sequences in the paths can be learned. The specific algorithm can be designed as follows:
Figure BDA0003862500320000076
Figure BDA0003862500320000081
first, an embedded representation of entities and relationships in the graph is initialized. Then, the training samples are sampled by using a training path sample construction method guided by the rules. Then, at the stage of an encoder, embedding and representing the entity and the relation by using a knowledge map embedding model, and constructing an input token sequence; in the decoder stage, the token sequence of the encoder is decoded by caual Transformer autoregressive to generate the next inference sequence. And finally, learning the co-occurrence mode of the inference sequence by a teacher training parallel training method. Through a sequence generating type reasoning process dynamically interacting with the map environment, next action can be reasoned in a generating type according to the current reasoning state, and a precision Transformer architecture is utilized to process a reasoning sequence in parallel, so that faster knowledge reasoning is realized, the reasoning efficiency is improved, and the reasoning interpretability is enhanced.
Further, based on the foregoing method, an embodiment of the present invention further provides a precision transform-based sequence generating knowledge inference system, including: a rule mining module, a model building module and a knowledge reasoning module, wherein,
the rule mining module is used for extracting entities and relationships among the entities in the target knowledge graph and inducing a structured rule sequence in the target knowledge graph;
the model construction module is used for constructing a precision Transformer inference model for knowledge inference and map environment dynamic interaction, wherein the precision Transformer inference model adopts a rule guide mode to construct a training path sample of the inference model when dynamically interacting with a map environment, and trains the precision Transformer inference model by using the training path sample so as to learn the common occurrence ability of rules in a learning path;
and the knowledge reasoning module is used for carrying out knowledge reasoning through a precision Transformer reasoning model on the basis of the extracted entities, the relationship among the entities and the rule sequence and outputting a reasoning result.
Unless specifically stated otherwise, the relative steps, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of the present invention.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description.
The elements of the various examples and method steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and the components and steps of the examples have been described in a functional generic sense in the foregoing description for clarity of hardware and software interchangeability. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the technical solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
Those skilled in the art will appreciate that all or part of the steps of the above methods may be implemented by instructing the relevant hardware through a program, which may be stored in a computer-readable storage medium, such as: read-only memory, magnetic or optical disk, and the like. Alternatively, all or part of the steps of the foregoing embodiments may also be implemented by using one or more integrated circuits, and accordingly, each module/unit in the foregoing embodiments may be implemented in the form of hardware, and may also be implemented in the form of a software functional module. The present invention is not limited to any specific form of combination of hardware and software.
Finally, it should be noted that: although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood by those skilled in the art that the following descriptions are only illustrative and not restrictive, and that the scope of the present invention is not limited to the above embodiments: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A sequence generating knowledge inference method based on precision transform is characterized by comprising the following contents:
extracting entities and relationships among the entities in the target knowledge graph, and inducing a structured rule sequence in the target knowledge graph;
constructing a precision Transformer inference model for knowledge inference and map environment dynamic interaction, wherein the precision Transformer inference model adopts a rule guiding mode to construct a training path sample of the inference model when dynamically interacting with a map environment, and trains the precision Transformer inference model by using the training path sample so as to learn the common occurrence capability of rule learning in a path;
and (3) carrying out knowledge reasoning through a precision Transformer reasoning model on the basis of the extracted entities, the relationships among the entities and the rule sequence, and outputting a reasoning result.
2. The precision Transformer-based sequence generation knowledge inference method of claim 1, wherein in mining the rules in the target knowledge graph, a rule induction method is used to induce the structured rules in the target knowledge graph; and filters out the rules with confidence scores higher than the score threshold using a preset score threshold.
3. The Decision fransformer-based sequence generative knowledge inference method of claim 1, wherein the Decision fransformer inference model comprises an encoder and a decoder, wherein each entity and relationship are embedded in the encoder to generate a token sequence, and the embedded representation of the entity or relationship is added with a position code to distinguish the precedence of the inference process; in the decoder, the next step of reasoning action is output by task decoding the sequence before the current learning sequence item.
4. The precision Transformer-based sequence generative knowledge inference method of claim 3, wherein the decoder of the inference model employs a Causal transform model to perform decoding task on token sequence of the encoder and generate the next step inference sequence.
5. The method of claim 1 or 3 or 4The sequence generating knowledge inference method based on the precision transform is characterized in that a precision transform inference model adopts cross entropy as a target loss function, and utilizes label smoothing to smooth the loss function, wherein the target loss function is expressed as:
Figure FDA0003862500310000011
Figure FDA0003862500310000012
wherein, tau represents the sequence, k represents the sequence number of the sequence, V represents the dictionary formed by each element in the sequence, alpha i Weight representing label smoothness, q represents query, p (i | q, τ) <k ) Representing the generation of sequence probability distribution according to the current sequence and the next step of query, wherein the element is a set hyper-parameter, and K represents the total number of sequence categories.
6. The Decision Transformer-based sequence generating knowledge inference method of claim 1, wherein in constructing the training path sample of the inference model in a rule-guided manner, first, all random walk paths within k under preset query conditions are traversed by a random walk method; secondly, initializing entity and relationship representation in the graph by using a graph embedding method, and traversing each path of all entity and relationship element pairs in the random walk path; and then, sorting the importance of all random walk paths according to the path rule rewards and the semantic similarity between the paths and the query conditions, and selecting the first N paths as training path samples.
7. The precision Transformer-based sequence-generating knowledge inference method of claim 6, wherein in ranking the importance of all random walk paths according to their regular rewards and semantic similarity between the path and query conditions, the formula is used to determine the importance of the path
Figure FDA0003862500310000021
To calculate a path score, and to rank the importance by score size, where p i Represents the path i, a i Representing semantic similarity between the corresponding path and the query condition, c i Represents the regular reward of the corresponding path, and λ is the weight parameter.
8. The precision transform-based sequence generative knowledge inference method of claim 6 or 7, characterized in that the semantic similarity a between the path and the query condition i The calculation is carried out by embedding the attention values representing the preset query conditions into the path, and the calculation process is represented as follows: a is a i =softmax(q T r i ),
Figure FDA0003862500310000022
Wherein r is i For all embedded representations of corresponding path samples, p ij Q represents a query condition, and a represents a weight matrix formed by corresponding attention values for corresponding entity and relationship element pairs in the path sequence.
9. The precision transform-based sequence-generated knowledge inference method of claims 6 or 7, characterized in that the rule reward of a path is obtained through the confidence score of the rule, if the path sequence of the random walk corresponds to the extracted rule, the confidence corresponding to the rule is taken as the rule reward, if the path of the random walk satisfies multiple rules at the same time, the confidence between the rules is large, the rule with the largest confidence score is selected as the matching rule, and the confidence corresponding to the matching rule is taken as the rule reward.
10. A precision Transformer-based sequence-generating knowledge inference system, comprising: a rule mining module, a model building module and a knowledge reasoning module, wherein,
the rule mining module is used for extracting entities and relationships among the entities in the target knowledge graph and inducing a structured rule sequence in the target knowledge graph;
the model construction module is used for constructing a precision Transformer inference model for knowledge inference and map environment dynamic interaction, wherein the precision Transformer inference model adopts a rule guide mode to construct a training path sample of the inference model when dynamically interacting with a map environment, and trains the precision Transformer inference model by using the training path sample so as to learn the common occurrence ability of rules in a learning path;
and the knowledge reasoning module is used for carrying out knowledge reasoning through a precision Transformer reasoning model on the basis of the extracted entities, the relationship among the entities and the rule sequence and outputting a reasoning result.
CN202211168517.2A 2022-09-24 2022-09-24 Sequence generating type knowledge inference method and system based on precision transform Pending CN115526322A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211168517.2A CN115526322A (en) 2022-09-24 2022-09-24 Sequence generating type knowledge inference method and system based on precision transform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211168517.2A CN115526322A (en) 2022-09-24 2022-09-24 Sequence generating type knowledge inference method and system based on precision transform

Publications (1)

Publication Number Publication Date
CN115526322A true CN115526322A (en) 2022-12-27

Family

ID=84699361

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211168517.2A Pending CN115526322A (en) 2022-09-24 2022-09-24 Sequence generating type knowledge inference method and system based on precision transform

Country Status (1)

Country Link
CN (1) CN115526322A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116705338A (en) * 2023-08-08 2023-09-05 中国中医科学院中医药信息研究所 Traditional Chinese medicine multi-mode knowledge graph reasoning method and device based on rules and paths
CN117634599A (en) * 2023-10-17 2024-03-01 中国电子信息产业集团有限公司第六研究所 Path reasoning method and device based on knowledge graph, electronic equipment and medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116705338A (en) * 2023-08-08 2023-09-05 中国中医科学院中医药信息研究所 Traditional Chinese medicine multi-mode knowledge graph reasoning method and device based on rules and paths
CN116705338B (en) * 2023-08-08 2023-12-08 中国中医科学院中医药信息研究所 Traditional Chinese medicine multi-mode knowledge graph reasoning method and device based on rules and paths
CN117634599A (en) * 2023-10-17 2024-03-01 中国电子信息产业集团有限公司第六研究所 Path reasoning method and device based on knowledge graph, electronic equipment and medium

Similar Documents

Publication Publication Date Title
CN111522962B (en) Sequence recommendation method, device and computer readable storage medium
Pfeffer Practical probabilistic programming
CN114064918B (en) Multi-modal event knowledge graph construction method
CN115526322A (en) Sequence generating type knowledge inference method and system based on precision transform
CN111079409B (en) Emotion classification method utilizing context and aspect memory information
Wu et al. Exploring large language model for graph data understanding in online job recommendations
Patil et al. Visual question generation: The state of the art
CN111538838B (en) Problem generating method based on article
CN116975350A (en) Image-text retrieval method, device, equipment and storage medium
Cao et al. Social media text generation based on neural network model
CN115964459B (en) Multi-hop reasoning question-answering method and system based on food safety cognition spectrum
Choi et al. Knowledge graph extension with a pre-trained language model via unified learning method
Perez-Castro et al. Efficiency of automatic text generators for online review content generation
CN111145914A (en) Method and device for determining lung cancer clinical disease library text entity
Zhao et al. Generative multi-task learning for text classification
Tang et al. Predictive modelling of student behaviour using granular large-scale action data
Bao et al. Multi-step deductive reasoning over natural language: An empirical study on out-of-distribution generalisation
CN117112786A (en) Rumor detection method based on graph attention network
CN116629361A (en) Knowledge reasoning method based on ontology learning and attention mechanism
CN116433800A (en) Image generation method based on social scene user preference and text joint guidance
Li et al. ANN: a heuristic search algorithm based on artificial neural networks
Shan Social network text sentiment analysis method based on CNN-BiGRU in big data environment
CN114185595A (en) Method name generation method based on code structure guidance
Yao et al. Fuzzy Representation Learning on Dynamic Graphs
CN113051353A (en) Attention mechanism-based knowledge graph path reachability prediction method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination