Question and answer processing method and device, computer program product, medium and electronic equipment

By using sparse timing knowledge graphs and external corpus in the question-answer system, dynamically selecting text form actions and generating inference paths, the problems of low accuracy of question-and-answer and difficult processing of timing changes in the prior art are solved, and higher accuracy and robustness of question-and-answer are achieved.

CN119692445APending Publication Date: 2025-03-25MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411692636.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The prior art relies on predefined embedded vectors and Q&A pair data sets in the process of processing questions and answers, resulting in low accuracy of question and answers and difficulty in effectively handling timing changes of knowledge graphs.

Method used

By determining the external corpus corresponding to the problem, extracting text information from it and adding it to the sparse timing knowledge graph, the text form action is selected, and a reasoning path is generated based on the external environment state and text form action to determine the reply information of the problem.

Benefits of technology

It improves the accuracy and robustness of the Q&A system, can better utilize timing information, reduce data loss problems, and enhance problem understanding and path reasoning capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119692445A_ABST
    Figure CN119692445A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a question and answer processing method and device, a computer program product, a computer readable storage medium and electronic equipment, and relates to the technical field of computers, and the method comprises the following steps: determining an external corpus corresponding to a question; extracting text information from the external corpus, and adding the text information to a sparse time sequence knowledge graph; selecting a text form action from the text information of the sparse time sequence knowledge graph; determining a first action according to an external environment state and the text form action, and generating a reasoning path according to the first action; and determining reply information corresponding to the question according to the reasoning path. The question and answer accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] Knowledge graph question answering aims to query the knowledge graph by asking questions in natural language and obtain accurate answers from it. In the past few years, the field of knowledge graph question answering has made great progress, including methods based on graph neural networks, methods based on logical reasoning, and methods based on reinforcement learning. However, traditional knowledge graph question answering methods often only consider static knowledge graphs, ignoring the impact of temporal changes in knowledge on question answering.

[0003] In related technologies, the question-answering method can be embedded in the knowledge graph to reason on multiple relationship chains of the knowledge graph to find the correct answer. In addition, a shared embedding space can be used to adopt a shared answer scoring module. Through the shared module, the model can understand natural language questions and generate more accurate answer scores.

[0004] However, most of the above methods rely on pre-defined embedding vectors and question-answer pair datasets, which have certain limitations in the question-answering process and result in low question-answering accuracy. Summary of the invention

[0005] The purpose of the present disclosure is to provide a question and answer processing method, a question and answer processing device, a computer program product, a computer-readable storage medium, and an electronic device, thereby overcoming the problem of low question and answer accuracy caused by the limitations and defects of related technologies to at least a certain extent.

[0006] According to one aspect of the present disclosure, a question-answering processing method is provided, including: determining an external corpus corresponding to a question; extracting text information from the external corpus, and adding the text information to a sparse temporal knowledge graph; selecting a text-form action from the text information in the sparse temporal knowledge graph; determining a first action according to an external environment state and the text-form action, and generating an inference path according to the first action; and determining reply information corresponding to the question according to the inference path.

[0007] According to one aspect of the present disclosure, there is provided a question-answer processing device, comprising: an external corpus acquisition module, used to determine the external corpus corresponding to a question; a knowledge graph supplement module, used to extract text information from the external corpus, and add the text information to a sparse temporal knowledge graph; a text form action selection module, used to select a text form action from the text information of the sparse temporal knowledge graph; an inference path generation module, used to determine a first action according to an external environment state and the text form action, and generate an inference path according to the first action; a reply information determination module, used to determine the reply information corresponding to the question according to the inference path.

[0008] According to one aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the computer program implements any one of the above-mentioned question and answer processing methods.

[0009] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any one of the above-mentioned question and answer processing methods is implemented.

[0010] According to one aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned question and answer processing methods by executing the executable instructions.

[0011] In the technical solution provided in the embodiments of the present disclosure, on the one hand, selecting text-based actions from the text information of the sparse temporal knowledge graph can better utilize the temporal information in the sparse temporal knowledge graph, avoid the problem of data missing due to insufficient data, and improve comprehensiveness and flexibility. On the other hand, selecting text-based actions from the text information of the sparse temporal knowledge graph, determining the first action based on the external environment state and the text-based actions complement each other, and then jointly generating a reasoning path to determine the reply information of the question, can improve the ability to understand the problem and improve the path reasoning ability, reduce the limitations that may exist in a single intelligent agent, and thus improve the accuracy and robustness of the reply information.

[0012] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0014] Figure 1 The system architecture diagram for implementing the question-answer processing method in an embodiment of the present disclosure is schematically shown.

[0015] Figure 2 A flowchart of a question-answering processing method in an embodiment of the present disclosure is schematically shown.

[0016] Figure 3 The flowchart of determining the text form action in the embodiment of the present disclosure is schematically shown.

[0017] Figure 4The flowchart of determining the action at each moment in the embodiment of the present disclosure is schematically shown.

[0018] Figure 5 The flowchart of generating the reasoning path in the embodiment of the present disclosure is schematically shown.

[0019] Figure 6 The flowchart of selecting the reasoning path in the embodiment of the present disclosure is schematically shown.

[0020] Figure 7 The following is a schematic diagram showing a process of generating reply information in an embodiment of the present disclosure.

[0021] Figure 8 A schematic diagram schematically shows a framework of knowledge graph question answering in an embodiment of the present disclosure.

[0022] Fig. 9 The specific flow chart of the question and answer processing method in the embodiment of the present disclosure is schematically shown.

[0023] Fig.10 The following is a schematic diagram of a block diagram of a question-answer processing device in an embodiment of the present disclosure.

[0024] Fig.11 The block diagram of the electronic device according to the embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0025] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

[0026] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0027] In some embodiments of the present disclosure, multi-hop knowledge graph question answering tasks can be processed by embedded knowledge graph question answering (Embedded Knowledge Graph Question Answering, EmbedKGQA), that is, reasoning on multiple relationship chains of the knowledge graph to find the correct answer. The core idea of ​​EmbedKGQA is to use knowledge graph embedding technology to learn the semantic representation of entities and relationships. It uses an ontology knowledge base to learn these embeddings and encode the entities and relationships in the knowledge graph. In this way, when processing questions, the model can use these embeddings to judge the similarity between entities and relationships, so as to reason and answer questions.

[0028] The EmbedKGQA model mainly consists of three key modules: entity embedding module, question embedding module and answer selection module. First, the entity embedding module is used to learn the embedding representation of all entities in the knowledge graph. Then, the question embedding module is responsible for converting the question into an embedding representation. Finally, the answer selection module combines the question and relation similarity scores to select the final answer.

[0029] In the above method, when dealing with sparse knowledge graph question-answering tasks, EmbedKGQA only processes the static knowledge graph and cannot dynamically adapt to the changes and temporal relationships of the knowledge graph. It has poor adaptability, which leads to inaccurate question-answering. EmbedKGQA mainly relies on embedded representation and static knowledge graph structure, lacks interaction with context, and thus cannot accurately capture the semantics of the question, which is likely to lead to misunderstandings. EmbedKGQA may rely more on pre-defined embedding vectors and question-answer pair datasets during training, and its learning ability may be limited to a certain extent. Therefore, this method may be limited by the accuracy and richness of semantic expression, resulting in inaccurate matching results.

[0030] In some embodiments of the present disclosure, it can also be processed by a neural model BiNet, which is designed to jointly process knowledge graph completion and multi-hop question answering based on knowledge graphs and formulate them as a multi-task learning problem. BiNet proposes a method of sharing embedding space and answer scoring module, so that the two tasks can automatically share potential features and learn the interaction between the natural language question decoder and the answer scoring module.

[0031] The model includes parts for KGQA and KGC tasks. The BiNet model consists of two key components: a shared embedding space and an answer scoring module. BiNet utilizes a shared embedding space, which means that KGC and Multi-hop KGQA tasks can share similar embedding representations to better capture the semantic associations between entities and relations. BiNet adopts a shared answer scoring module, which enables the model to learn end-to-end for KGC and Multi-hop KGQA tasks simultaneously. By sharing this module, the model can better understand natural language questions and generate more accurate answer scores.

[0032] However, the existing BiNet model, first of all, because it is a joint model, it needs to process knowledge graph completion and multi-hop question and answering tasks at the same time. This may lead to a high time cost for model training and reasoning, and may have a high complexity. Secondly, the BiNet model is highly dependent on data because it requires a large amount of labeled data for multi-task learning. If there is a lack of sufficient labeled data, the performance of the model may be affected. Thirdly, the BiNet model may have limited generalization capabilities when processing sparse temporal knowledge graphs. Because the temporal knowledge graph may be missing or incomplete, and the BiNet model may find it difficult to effectively handle this sparsity. Therefore, the BiNet model may have some limitations when processing sparse temporal knowledge graph question and answer, which may lead to inaccurate question and answer.

[0033] In an embodiment of the present disclosure, in order to solve the above-mentioned technical problems, a question and answer processing method is provided, which can be applied to the scenario of question and answer based on a sparse temporal knowledge graph, thereby realizing the function of intelligent question and answer based on a sparse temporal knowledge graph.

[0034] Figure 1 A system architecture diagram for implementing the question-answer processing method and the question-answer processing device is schematically shown in FIG. Figure 1As shown in , in some embodiments, the system architecture 100 on which the question-answering process depends may include a user terminal 110 and a server terminal 120. The user terminal 110 may include at least one terminal arranged on the user side. The server terminal 120 may be a server. Information transmission may be performed between the user terminal 110 and the server terminal 120 via a network 130. The server terminal 120 is used to reply to the question input by the user terminal 110. The user terminal 110 is used to display the reply information corresponding to the question on the operation interface.

[0035] It should be noted that in the above question-answering processing method, the server 120 can be any type of server or server cluster. The user end 110 can be any smart device that can input questions, such as a smart phone, computer, tablet computer, smart speaker, vehicle-mounted device, wearable device, monitoring device, smart TV and other devices. The above question-answering processing method can be completely executed by the server; it can also be partially executed by the user end and partially executed by the server end, which is not specifically limited here.

[0036] Based on the above system architecture, refer to Figure 2 As shown in , the question-answering processing method may mainly include the following steps:

[0037] In step S210, the external corpus corresponding to the question is determined;

[0038] In step S220, text information is extracted from the external corpus, and the text information is added to the sparse temporal knowledge graph;

[0039] In step S230, a textual action is selected from the text information of the sparse temporal knowledge graph;

[0040] In step S240, a first action is determined according to the external environment state and the text-based action, and a reasoning path is generated according to the first action;

[0041] In step S250, response information corresponding to the question is determined according to the reasoning path.

[0042] In the disclosed embodiment, selecting text-based actions from the text information of the sparse temporal knowledge graph can better utilize the temporal information in the sparse temporal knowledge graph, avoid the problem of data missing due to insufficient data, and improve comprehensiveness and flexibility. In addition, selecting text-based actions from the text information of the sparse temporal knowledge graph, and determining the first action based on the external environment state and the text-based actions complement each other, and then jointly generating a reasoning path to determine the response information of the question.

[0043] Next, refer to Figure 2The question and answer processing method in the embodiment of the present disclosure is specifically described as shown in FIG.

[0044] In step S210, the external corpus corresponding to the question is determined.

[0045] In the method of the embodiment of the present disclosure, the question and answer can be realized by an intelligent interactive device. The intelligent interactive device can be an independent intelligent device, such as an intelligent robot, a self-service intelligent terminal, an intelligent speaker, etc.; it can also be an intelligent assistant set on an intelligent terminal, such as a public account or an application, etc.; it can also be a search engine, which is not specifically limited here, as long as it can realize the interactive process of intelligent question and answer.

[0046] Specifically, the question can be any type of question, which is not specifically limited here. The user can input the question in any way such as text, voice, image, etc., which is not specifically limited here.

[0047] After obtaining the question input by the user, the external corpus corresponding to the question can be determined. The external corpus can be corpus information related to the question. For example, text fragments related to the question extracted from databases such as the Internet, databases, and document collections. The external corpus can be composed of multiple sentences, and the multiple sentences can be represented as D = {s1, s2, ..., s D}, where D represents external corpus, s represents sentences, and each sentence is a sequence of words, which can be expressed as follows For each sentence s i First, we can use the entity detection model to identify the text fragments in the sentence A text snippet refers to a text snippet associated with a fact entity in a sparse temporal knowledge graph. A text snippet can be represented as The entity detection model can be any type of machine learning model.

[0048] In step S220, text information is extracted from the external corpus, and the text information is added to the sparse temporal knowledge graph.

[0049] In the embodiment of the present disclosure, after determining the external corpus corresponding to the question, text information can be extracted based on the external corpus. For example, a text segment of each sentence can be obtained, and entity extraction can be performed on the text segment to obtain multiple entities. Furthermore, an entity linking model can be used to link each text segment to a node in the sparse temporal knowledge graph. The entity linking model can also be any type of machine learning model. Finally, for each entity (e k ,e j ,t), replace the text fragment corresponding to the entity in the sentence with three wildcards 、 <obj> 和 <timestamp> ,即替换为主语实体、谓语实体和时间戳,以得到文本信息。此处的文本信息可以为文本信息组,即可以通过信息组的形式表示。

[0050] 其中,e k是句子s i中的一个实体,它在稀疏时序知识图谱中被链接到一个节点上。这个实体可以被视为句子中的一个主语实体,e j是句子s i中的另一个实体,也被链接到稀疏时序知识图谱中的一个节点上。它可以被视为句子中的一个谓语实体。t是一个时间戳,指示了该关系或事件发生的时间。它与句子s i中的某个文本片段相关联。

[0051] 由于句子长短不一,为了提高一致性,本公开实施例中,还可以对长句子进行截断得到该句子对应的子句s i (j,k),该子句中可包含相关实体,由此得到一条辅助的文本信息,文本信息例如可以为文本形式四元组,可表示为 其中,e k和e j表示在句子s i中检测出并链接到稀疏时序知识图谱中的两个不同实体,即e k和e j都是从文本片段 中提取出来的实体,并且e j≠e k意味着它们是不同的实体;子句 表示的是截断后的句子s i,子句中包含上述从文本片段提取到的实体。因此,文本形式四元组 表示了一个辅助信息结构,该文本形式四元组的形式为<e j,s i (j,k),e k,t>,其目的是给出文本描述、实体、关系和时间戳的结合。通过对每个句子进行上述处理,以便形成补充语料对应的文本形式四元组集合δ D。其中,文本信息中可以包含多个文本形式动作,文本形式动作指的是加入时间戳的动作。

[0052] 在得到文本信息之后,可以将文本信息添加至稀疏时序知识图谱中,以对稀疏时序知识图谱进行补充。稀疏时序知识图谱是通过随机移除时序知识图谱中一定比例的四元组而构成的,与原始数据集的稠密时序知识图谱不同。因此,本公开实施例是从稀疏时序知识图谱中推断问题的答案,而不是直接使用原始数据集中提供的密集时序知识图谱。

[0053] 本公开实施例中,通过文本强化方法从外部语料中提取文本形式四元组来补充稀疏时序知识图谱,从而增加图结构的密度。

[0054] 在步骤S230中,从所述稀疏时序知识图谱的文本信息中选择文本形式动作。

[0055] 本公开实施例中,为了实现全面准确的问答,可构建多个智能体,通过多个智能体实现模拟问答,无需用户进行参与。智能体指的是用于执行不同任务的数字代理,可通过智能体执行不同类型的操作,在稀疏时序知识图谱中确定问题的回复信息。并且每个智能体可以由一个机器学习模型模拟。根据应用场景的不同,可配置不同类型的智能体。智能体的数量可以为两个,也可以配置为三个或五个等等,具体根据实际需求进行确定。

[0056] 在一些实施例中,智能体可以包括第一智能体以及第二智能体,第一智能体可以为证据提取器,证据提取器用于从稀疏时序知识图谱的文本信息中提取符合条件的动作。第二智能体可以为路径生成器,路径生成器用于根据外部环境状态生成一个可能的路径或者动作序列,该路径指向可能的答案或者下一步应该探索的方向。外部环境可以在每个时间步,即每个时刻t为第一智能体和第二智能体提供每个时刻的外部环境状态,外部环境状态s t至少可以包括与问题相关的已知资料信息,除此之外还可包括已执行动作以及执行结果。在知识图谱问答领域,多个智能体可以协作学习,相互传递信息和知识,从而提高系统的性能和效果。通过引入多智能体协作学习,可以更好地利用知识图谱中的时序信息,弥补稀疏时序知识图谱中的缺失和稀疏性,提高问答的准确性和鲁棒性。

[0057] 本公开实施例中,第一智能体可以为证据抽取器。第一智能体可从稀疏时序知识图谱的文本信息包含的多个参考文本形式动作中抽取文本形式动作。文本形式动作可以具有高置信度。在得到文本形式动作之后,还可基于该文本形式动作来补充稀疏时序知识图谱,有效地缓解了时序知识图谱稀疏性造成的影响。

[0058] 示例性地,可通过分类器确定稀疏时序知识图谱对应的文本形式动作空间中,每个文本形式动作的置信度分数,并对置信度分数进行分类,筛选出置信度分数大于分数阈值的文本形式动作。文本形式动作空间中包含所有可能的资料信息和动作。每个动作可能是从文本中提取的一个信息片段,表示为a i=(e1,r,e2,c),其中e1和e2是实体,r是关系,c是上下文信息。

[0059] 进一步地,可以在置信度分数大于分数阈值的文本形式动作中,随机抽取一个动作,以将随机抽取的动作确定为文本形式动作。当然,也可以按照置信度分数或者是其他筛选参数选择一个动作,具体根据实际需求进行确定。

[0060] 图3中示意性示出了确定文本形式动作的示意图,参考 图3中所示,主要包括以下过程:

[0061] 在步骤S310中,通过分类器确定稀疏时序知识图谱对应的文本形式动作空间中,每个文本形式动作的置信度分数。

[0062] 在步骤S320中,判断每个置信度分数是否大于分数阈值;若是,则转至步骤S330;若否,则结束。

[0063] 在步骤S330中,筛选出置信度分数大于分数阈值的动作。

[0064] 在步骤S340中,从置信度分数大于分数阈值的动作中随机选择一个作为文本形式动作。

[0065] 本公开实施例中,第一智能体可动态选择最合适的文本动作来补充原始的稀疏时序知识图谱,同时可以筛选出高置信度的文本形式动作并过滤掉噪音,以提高准确性。

[0066] 在步骤S240中,根据外部环境状态以及所述文本形式动作确定第一动作,并根据所述第一动作生成推理路径。

[0067] 本公开实施例中,第二智能体可以为路径生成器,路径生成器用于根据证据提取器抽取的文本形式动作以及外部环境提供的每个时刻的外部环境状态确定出每个时刻的候选动作,进而从候选动作中确定出每个时刻的最优动作。首先,可根据文本形式动作以及外部环境提供的第一时刻的外部环境状态确定出第一候选动作,并从第一候选动作中确定出最优动作,从而生成推理路径,进而确定出与问题对应的回复信息。在整个过程中,可通过强化学习算法实现,以最大化奖励。

[0068] 示例性地,可结合外界环境提供的外部环境状态以及第一智能体抽取的文本形式动作,从候选动作空间中确定至少一个第一候选动作。外部环境状态可至少包括已知资料信息,例如可包括已知资料信息、已执行动作以及已执行动作的执行结果。其中,已知资料信息指的是模型在进行问题回答过程中已经收集到的与问题相关的信息,例如,已知资料信息可包括知识图谱中的实体和关系、外部语料中的文本信息、补充的文本信息中的一种或多种。

[0069] 示例性地,知识图谱中的实体和关系指的是从知识图谱中直接提取的信息,包括与问题相关的实体(如人名、地点、组织等)、实体之间的关系(如"出生于”、"工作在”等)以及这些关系的时间戳。外部语料中的文本信息包括证据抽取器从外部语料库(如互联网、数据库、文献集等)中提取的文本片段,这些片段可能提供了问题所需的额外背景信息或间接线索。补充的文本信息,是通过文本强化方法从外部语料中抽取并加入到当前状态的四元组,包括实体、关系、时间戳和与之相关的文本描述。已执行动作的历史记录:智能体在回答过程中所采取的所有动作序列,例如包括查询知识图谱、提取文本信息和应用推理规则等。动作的执行结果,指的是每个动作执行后的输出,例如,查询知识图谱可能返回新的实体和关系,而推理规则可能推导出新的结论。随着交互过程的进行,已知资料信息会不断更新和扩充,从而提高问题回答的准确性和可靠性。

[0070] 所有的第一候选动作可构成候选动作空间,即候选动作空间中包括外部环境状态下可以执行的所有动作,候选动作空间中的第一候选动作可以是与外部环境状态中的已知资料信息相关联的动作,可以为与已知资料信息相关的进一步推理步骤。具体地,可以通过第二智能体对外部环境状态以及文本形式动作进行拟合处理,得到至少一个第一候选动作。进一步地,可以确定出在外部环境状态下每个第一候选动作的执行概率,并将执行概率最高的第一候选动作确定为第一动作,即最优动作。当然,也可根据执行概率最小的第一候选动作确定第一动作,此处不作具体限定。

[0071] 在一些实施例中,可通过强化学习方法计算每个第一候选动作的执行概率。具体地,可确定在外部环境状态下执行每个第一候选动作的条件概率,进一步根据条件概率得到执行概率。示例性地,可用策略网络表示的概率分布确定在外部环境状态下执行每个第一候选动作的条件概率,策略网络所表示的条件概率可以如公式(1)所示:

[0072] π(a|s t)=P(a|s t) 公式(1)

[0073] 其中,π表示策略网络。策略网络用于决定在每个时间步的给定状态下应采取的动作,即确定在外部环境状态下应执行的动作。策略可以是确定性的,也可以是随机的,此处以策略为随机策略为例进行说明。在随机策略中,策略π是一个概率分布,给出在外部环境状态s t下各个第一候选动作的执行概率。a表示动作。这是智能体在外部环境状态下可以执行的操作。动作的具体形式取决于问题的类型,例如,在证据提取任务中,动作可能是从文本中选择一个特定的证据片段。外部环境状态s t表示在时间步t或当前时刻的环境状态。外部环境状态是描述当前时刻所处的环境的一组信息。例如,在证据提取任务中,外部环境状态包括当前已知资料信息集合、上下文信息等。P(a|s t)表示在外部环境状态s t下执行动作a的概率,即在外部环境状态下第一候选动作为a的条件概率,条件概率用于表示在给定外部环境状态s t时执行第一候选动作a的可能性。这个概率是由策略网络π决定的。

[0074] 进一步地,在得到外部环境状态下每个候选动作的条件概率后,可使用神经网络模型来对这些条件概率进行修正,以对条件概率进行近似处理。神经网络模型可以如DQN(deep Q-network)或策略网络。示例性地,可以将神经网络模型的模型参数输入至策略网络,对条件概率进行修正,从而确定每个第一候选动作的执行概率。其中,将神经网络模型的模型参数输入至策略网络可以为:根据模型参数对策略网络中的外部环境状态进行修正。基于此,可以将神经网络模型的模型参数与外部环境状态共同作为计算执行概率的条件,确定出在外部环境状态下,每个第一候选动作的执行概率。近似处理得到的执行概率例如可以参考公式(2)所示:

[0075] π(a|s t;θ)公式(2)

[0076] 其中,θ为神经网络模型的模型参数,该模型参数可通过训练最大化第一智能体和第二智能体的奖励来优化得到,且该模型参数可以为固定参数,而不是随机变量。

[0077] 接下来,可以选择执行概率最高的第一候选动作,并将该执行概率最高的第一候选动作确定为外部环境状态下的第一动作,即路径生成器在第一时刻确定出的最优动作。选择执行概率最高的第一候选动作的方式可以如公式(3)所示:

[0078]

[0079] 其中,公式(3)用于表示在外部环境状态s t下,选择使得策略π(a|s t;θ)表示的执行概率最高的动作a*,其中,a*表示的是使得策略概率最大的动作,即使得执行概率最大的第一候选动作。 用于标识对动作a执行最大化操作。π(a|s t;θ)用于表示在外部环境状态下执行动作a的概率。

[0080] 综上所述,根据最大执行概率确定出的第一候选动作可以为路径生成器确定出的第一动作,即最优动作。在执行该第一动作时,第一动作也会对外部环境状态产生影响,因此可以对外部环境状态进行更新,以使得外部环境状态转换至更新后的外部环境状态s t+1,并且,更新后的外部环境状态是根据外部环境状态以及外部环境状态下执行的第一动作共同决定的。

[0081] 参考 图4中所示,在第一时刻,可根据外部环境状态以及文本形式动作确定第一动作,在执行第一动作时,可更新外部环境状态以得到更新后的外部环境状态。进一步,可将更新后的外部环境状态以及第一动作作为输入,以确定第二时刻的第二动作,并根据第二动作对更新后的外部环境状态再次进行更新,将再次更新后的外部环境状态与第二动作输入后,确定第三时刻的第三动作。如此重复,直至确定出每个时刻的最优动作。

[0082] 在此基础上,可根据每个时刻的最优动作,扩展推理路径。例如可根据第一时刻的第一动作、第二时刻的第二动作等最优动作扩展推理路径。

[0083] 参考 图5中所示,在由于执行第一动作导致外部环境状态发生变化后,可得到更新后的外部环境状态,根据第一动作生成推理路径的过程可以包括以下步骤:

[0084] 在步骤S510中,根据第一动作对外部环境状态进行更新以确定更新后的外部环境状态,并确定第一智能体以及第二智能体的奖励;

[0085] 在步骤S520中,将最大化第一智能体的奖励以及第二智能体的奖励作为优化目标,根据奖励的方向对第一智能体和第二智能体进行更新,以得到更新后的第一智能体和更新后的第二智能体;

[0086] 在步骤S530中,根据更新后的第一智能体确定文本形式动作,并基于更新后的第二智能体,根据更新后的外部环境状态以及文本形式动作确定第二动作,直至满足结束条件为止,以生成推理路径。

[0087] 本公开实施例中,当路径生成器执行了第一动作后,可以结束第一轮循环,进入下一轮循环,如此循环,直至满足结束条件为止。需要说明的是,在第二智能体执行第一动作之后,外界环境状态由第一时刻的外部环境状态转移到新的环境状态,例如变更为第二时刻的外部环境状态s t+1,更新后的外部环境状态是由外部环境状态以及执行的第一动作共同决定的。然后进入下一轮循环,重新执行确定文本形式动作以及基于第二智能体确定最优动作的过程,重复执行上述步骤,直至达到预设的循环次数或条件为止。

[0088] 示例性地,基于强化学习算法确定推理路径的过程中,可以根据第一智能体和第二智能体的奖励确定优化目标,例如将最大化第一智能体和第二智能体的奖励作为优化目标,重复执行确定文本形式动作以及确定基于第二智能体确定最优动作的过程,直至满足结束条件为止,从而确定出推理路径。

[0089] 在一些实施例中,首先可获取第一智能体和第二智能体的奖励。在获得第一智能体和第二智能体的奖励之后,可通过Q-learning更新策略,通过强化学习方法,使得奖励最大化。即,可以最大化奖励作为优化目标,循环执行确定文本形式动作以及确定最优动作的过程,直至满足结束条件为止,以生成推理路径。其中,可使用奖励来更新第一智能体和第二智能体的参数,使得模型能够更好地适应当前任务。更新过程通常使用梯度下降或其他方式实现,根据奖励的方向调整第一智能体和第二智能体的参数,以使得模型更可能产生更高奖励的行为。需要说明的是,在每一次迭代中,模型都会不断地与外界环境状态交互,以计算奖励,更新参数,直到达到预定义的性能水平或收敛到最优解为止。

[0090] 接下来,对计算第一智能体和第二智能体的奖励的过程进行说明。奖励用于表示对第一智能体和第二智能体的动作的评价或反馈信息,奖励可以是一个标量值或一个向量。

[0091] 本公开实施例中,可根据外部环境状态提供的外部奖励和内部定义的内部奖励来计算第一智能体和第二智能体的奖励;也可以通过奖励函数确定即时奖励,并根据价值函数对即时奖励进行处理,以确定第一智能体和第二智能体的奖励。

[0092] 首先对根据外部环境状态提供的外部奖励和内部定义的内部奖励来计算第一智能体和第二智能体的奖励的具体过程进行详细说明。假设有两个智能体,第一智能体A和第二智能体B,它们分别处于外界环境状态s A和s B,并执行动作a A和动作a B。在时间步t,奖励根据外部环境状态提供的外部奖励以及内部定义的内部奖励得到。

[0093] 外部环境状态提供的外部奖励通常表示为r A(t)和r B(t),这些外部奖励反映了两个智能体在外部环境中的表现,可以由环境动态生成。

[0094] 内部定义的奖励函数可以基于外部环境状态和动作来计算,假设内部奖励分别表示为R A(s A(t),a A(t))和R B(s B(t),a B(t))。

[0095] 基于此,奖励可通过以下方式来计算:

[0096] 首先,获取外部环境状态:第一智能体A的外部环境状态s A(t);第二智能体B的外部环境状态s B(t)。

[0097] 其次,选择智能体的动作:第一智能体A选择动作a A(t),第二智能体B选择动作a B(t)。

[0098] 再次,执行动作并更新外部环境状态:外界环境根据第一智能体A选择的动作a A(t)以及第二智能体B选择的动作a B(t)进行外界环境状态更新,并返回新的状态(即更新后的外部环境状态)和外部奖励。更新后的外部环境状态,即更新后的外部环境状态可表示为s A(t+1)和s B(t+1)。第一外部奖励记为r A(t)以及第二外部奖励记为r B(t)。

[0099] 接下来可使用内部奖励函数计算第一智能体和第二智能体的内部奖励,第一智能体的第一内部奖励可以表示为R A(s A(t),a A(t)),第二智能体的第二内部奖励可表示为R B(s B(t),a B(t))。

[0100] 进一步地,可以将外部环境提供的第一外部奖励以及内部定义的第一内部奖励进行加权求和,得到第一智能体的奖励;将外部环境提供的第二外部奖励以及内部定义的第二内部奖励进行加权求和,得到第二智能体的奖励,具体表示为公式(4):

[0101]

[0102] 其中,α和β是权重参数,用于平衡外部奖励和内部奖励的影响。

[0103] 除此之外,还可以通过奖励函数确定第三奖励,并根据价值函数对第三奖励进行处理,以得到第四奖励,并将第四奖励确定为第一智能体以及第二智能体的奖励。其中,第三奖励可以为即时奖励,第四奖励可以为期望总奖励。根据价值函数对即时奖励进行处理时,可对折扣因子以及第三奖励进行逻辑处理得到累积奖励,并确定累积奖励对应的期望值,以得到第四奖励。

[0104] 奖励函数R(s,a)用于评估每个外部环境状态与动作对的即时奖励,例如评估外部环境状态与第一动作组成的数据对的即时奖励。价值函数V(s)表示在外部环境状态s下能够获得的期望总奖励。价值函数可以如公式(5)所示:

[0105]

[0106] 其中,V(s)是在状态s下的价值函数,表示从外部环境状态s出发,未来所能获得的期望总奖励。E是期望值,表示对未来所有可能的外部环境状态和动作序列进行加权平均。 表示从时间步t=0到终止时间T的累积奖励。γ是折扣因子,范围在0到1之间。折扣因子用于表示未来奖励的衰减程度。即使未来的奖励对当前的决策有影响,但因为时间较远,衰减后其影响会变小。R(s t,a t)表示在时间步t的外部环境状态s t下执行动作a t所获得的即时奖励。

[0107] 示例性地,可以最大化奖励为优化目标,更新第一智能体和第二智能体,根据更新后的第一智能体确定文本形式动作,并基于更新后的第二智能体,根据更新后的外部环境状态以及文本形式动作确定第二动作。具体地,可根据更新后的外部环境状态以及文本形式动作确定至少一个与更新后的外部环境状态中的已知资料信息相关联的第二候选动作。进一步确定每个第二候选动作的执行概率,并根据执行概率确定第二动作。

[0108] 其中,第二智能体中可包括LSTM(Long Short Term Memory networks,长短期记忆网络),第二候选动作可以基于第二智能体,根据更新后的外部环境状态以及重新确定的文本形式动作确定。示例性地,可以通过第二智能体对更新后的外部环境状态以及重新确定的文本形式动作进行拟合处理,得到至少一个第二候选动作。第二候选动作也可以根据长短期记忆网络确定,第二候选动作的具体确定过程包括:

[0109] 路径生成器在生成推理路径时,整个生成过程可包括初始阶段以及推理阶段。在初始阶段中,路径生成器首先需要初始化决策历史。决策历史存储了从初始状态即初始时刻到第一时刻的所有动作序列。进一步地,路径生成器利用预训练的知识图谱嵌入对初始决策历史进行编码,以得到序列数据。除此之外,还可以对记忆向量进行初始化。示例性地,为了捕获问题的潜在意图,将问题对应的记忆向量初始化为常量。并且,记忆向量将随着推理过程进行逐步衰减,记忆向量可用于反映模型对问题不同部分的关注程度。

[0110] 基于此,路径生成器可通过长短期记忆网络对从初始时刻对当前时刻的所有动作序列进行编码,以得到序列数据。进一步地,可以对序列数据进行编码,更新长短期记忆网络的隐藏状态,以生成第一时刻的隐含表示。隐含表示指的是对长短期记忆网络输出的序列数据进行编码得到的编码特征,可以用于指导路径生成器对外部环境状态进行扩展,即根据外部环境状态和隐含表示,生成下一步可能的动作或节点。即,可以基于外部环境状态和隐含表示,帮助路径生成器探索潜在的路径空间,例如生成第二时刻的动作的方向。

[0111] 接下来,可根据隐含表示确定第一时刻的记忆向量,确定第一时刻对问题的关注程度。其中,记忆向量的更新可以受到隐含表示的影响,从而使得记忆向量反映模型对不同部分的关注程度。随着推理过程的进行,记忆向量的衰减和更新可以由隐含表示所指导,确保模型在推理过程中动态调整其注意力。示例性地,记忆向量在每个时间步或每个时刻都会衰减一定的值。长短期记忆网络中读取门和写入门,使得模型能够灵活地管理内部情感记忆的读取和更新。通过这种方式,模型可以动态调整其注意力,确保问题的各个部分在推理过程中被充分考虑。

[0112] 与此同时,可根据外部环境状态以及记忆向量,确定位于第一时刻之后的第二时刻的预测动作,预测动作可以为第二时刻要执行的动作,也可以是一个动作序列。其中,LSTM能够处理序列数据,并能有效捕获长时间依赖关系。在每个时间步,LSTM会更新其隐藏状态,从而生成第一时刻的隐含表示。这些隐含表示综合了先前动作的影响和第一动作的选取策略。LSTM在路径生成器中的作用是利用其循环网络的特性来处理序列数据,维护历史信息,并在每个时间步生成当前时刻的隐含表示。LSTM输出的动作通常是基于当前已有的证据和历史信息的一个序列预测。这个预测可以是下一步要执行的动作,也可以是一个动作序列。

[0113] 在确定出预测动作之后,可以将预测动作与第二智能体确定的第二候选动作进行集成,以将预测动作和第二智能体确定的第二候选动作共同确定为最终的第二候选动作,从而使得第二智能体根据强化学习算法从多个第二候选动作中,根据第二候选动作的执行概率,选择第二动作。其中,由于强化学习输出的第二动作是基于第一动作和外部环境状态来最大化奖励而实现。基于此,LSTM生成的预测动作可以作为强化学习策略的第二候选动作之一,通过强化学习算法从上述第二候选中选择一个最优动作,作为第二动作,以扩展推理路径。

[0114] 本公开实施例中,通过第二智能体,确定每个候选动作的执行概率,能够在每个外部环境状态下选择最合适的动作来扩展推理路径,提高准确性。

[0115] 在生成推理路径时,为了提高准确性,可生成多个候选推理路径,进而从多个候选推理路径中筛选出推理路径。示例性地,可使用基于束搜索的动作选择机制,确定多个候选推理路径。候选推理路径的数量可以为N,具体可以根据预先配置的束宽参数确定,束宽参数用于表示每次选择出的结果的数量,即可用于表示候选推理路径的数量。束宽参数可根据实际需求进行确定,例如可以为5或者是10等等。

[0116] 在确定多个候选推理路径时,可确定第一候选推理路径以及第二候选推理路径,以根据第一候选推理路径以及第二候选推理路径确定多个候选推理路径。其中,可以按照排列顺序对多个候选推理路径进行排序,选择排列在前N位的候选推理路径。排列顺序可以为与问题相关性由大到小的顺序。多个候选推理路径,代表了每个时刻可能的最优选择。通过确定候选推理路径,模型能够在每个时间步都考虑多个潜在的动作序列,从而提高找到最优解的概率。

[0117] 需要说明的是,在根据第一候选推理路径以及第二候选推理路径生成候选推理路径时,第一候选推理路径的数量以及第二候选推理路径的数量之和等于候选推理路径的数量。第一候选推理路径可以为包含文本形式动作的路径,第二候选推理路径可以为根据路径得分选择得到的候选推理路径。并且,第一候选推理路径的优先级高于第二候选推理路径的优先级。即,在生成候选推理路径时,可首先选择包含文本形式动作的第一候选推理路径,进一步根据路径得分选择剩余的第二候选推理路径。在一些实施例中,路径生成器采用自适应采样策略,该策略在选择包含文本形式动作的第一候选推理路径时赋予其更高的优先级。具体而言,在topN的候选推理路径中,选择topK(K≤N)个包含文本形式动作的第一候选推理路径,其余候选推理路径则根据路径得分选择第二候选推理路径。路径得分可根据与问题的相关性、路径准确性确定。通过上述方式,可确保模型既能探索传统的知识图谱动作路径,又能尝试新的文本形式动作路径,从而提升整体推理能力。

[0118] 在得到候选推理路径之后,可对候选推理路径进行路径评估,以选择出最优路径作为推理路径。在一些实施例中,可根据每个候选推理路径的长度、节点的权重以及边的权重、候选推理路径中包含的信息质量、候选推理路径终点的相关性中的一种或多种,对每个候选推理路径进行评分;根据评分,从多个候选推理路径中确定推理路径。

[0119] 示例性地,可根据评分参数对每个候选推理路径进行评分,评分参数可以包括路径长度、节点的权重和边的权重、候选推理路径中包含的信息质量、候选推理路径终点与问题的相关性中的一种或多种。例如,问题为关于某个特定的实体或关系的,则需要考虑路径终点与问题的相关性。具体地,可确定每个评分参数的权重,基于权重以及该评分参数对应的参考分值,对多个评分参数进行加权平均确定候选推理路径的评分,或者也可以通过投票机制或其他方式确定每个候选推理路径的评分。评分用于表示候选推理路径的质量。进一步地,可将所有候选路径按评分从大到小的顺序进行排序,选择评分最大的候选推理路径作为潜在的最优路径,即作为最终的推理路径。

[0120] 参考 图6中所示,可根据自适应采样策略,选取topK(K≤N)个包含文本形式动作的第一候选推理路径,以及根据路径选择N-K个第二候选推理路径,以确定N个候选推理路径。进一步地,确定每个候选推理路径的评分,以将评分最大的候选推理路径作为推理路径。

[0121] 本公开实施例中,通过包含文本形式动作的第一候选推理路径以及第二候选推理路径确定候选推理路径,进一步通过评分确定最终的推理路径,能够提高推理路径的准确性。

[0122] 在步骤S250中,根据所述推理路径确定与所述问题对应的回复信息。

[0123] 本公开实施例中,在确定出推理路径之后,可从推理路径中确定出与问题对应的回复信息,即从路径生成器生成的最优路径中确定出与问题匹配的回复信息。回复信息可以为任意形式,此处不作具体限定。

[0124] 在一些实施例中,可根据问题的属性参数以及推理路径的结构,使用不同的方式从推理路径中确定回复信息。属性参数用于描述问题的性质或类型,属性参数可包括实体关系问题或实体属性问题。推理路径的结构用于表示推理路径是否包含文本形式动作。基于此,可根据推理路径是否包含文本形式动作,以及推理路径的属性参数为实体关系问题或实体属性问题,选择根据目标节点或目标边的属性、终点实体或者是文本形式动作的动作内容中的一种确定回复信息。

[0125] 在一些实施例中,在推理路径的结构为不包含文本形式动作的情况下,可确定问题的属性参数。若问题的属性参数为实体关系问题,将推理路径中的终点实体作为问题的回复信息。例如,若推理路径的起始节点为电灯,中间节点为发明(关系),终点节点为A,根据中间实体可确定问题为实体关系问题。此时推理路径为电灯-发明(关系)-A。因此,可以将终点实体"A”作为提取到的问题的回复信息。

[0126] 在推理路径不包含文本形式动作的情况下,若问题为实体属性问题,将推理路径中目标节点或目标边的属性作为回复信息。目标节点可以为终点节点,目标边可以为与中间节点连接的边。例如,若推理路径的起始节点为A,中间节点为出生地(关系),终点节点为B,根据中间节点与起始节点之间的关系,可确定问题为某个实体属性问题。此时推理路径为A-出生地(关系)-B。因此,可以将"B”作为提取到的问题的回复信息。

[0127] 如果推理路径包含文本形式动作,则无需考虑问题的属性参数,直接根据推理路径中包含的文本形式动作的动作内容,采用自然语言处理算法对动作内容进行分析,得到问题的回复信息。

[0128] 本公开实施例中,可以通过多个智能体之间的信息交换和协作来填补缺失数据的导致的不完整的问题,提高系统对问题的精准理解,提高回复信息准确性。并且,第一智能体和第二智能体可以分别负责一部分数据或知识,并通过协作完成对问题的全面理解和回答,避免了局限性,提高了全面性。另外,时序知识图谱中的问题往往需要跨越多个时间点进行推理和理解。传统的单一智能体方法可能无法有效处理这种复杂的推理需求。基于多智能体协作学习的方法可以将复杂的推理任务分解成多个子任务,并由不同的智能体负责不同的部分,通过协作完成整个推理过程。这种分布式的推理方式可以更高效地应对复杂问题,提高问答系统的性能和鲁棒性。

[0129] 图7中示意性示出了确定回复信息的流程图,参考 图7中所示,首先可对推理路径进行分类,将推理路径划分为包含文本形式动作以及不包含文本形式动作。当推理路径包含文本形式动作时,可采用自然语言处理算法得到问题的回复信息。当推理路径不包含文本形式动作时,可判断问题的属性参数为实体关系问题或实体属性问题。若问题为实体关系问题,将推理路径中的终点实体作为问题的回复信息;若问题为实体属性问题,将推理路径中目标节点或目标边的属性作为问题的回复信息。

[0130] 本公开实施例中,通过问题的属性参数以及推理路径的结构,选择不同方式从推理路径中确定出问题的回复信息,能够提高回复信息的准确性。

[0131] 在确定出问题的回复信息之后,可进一步对回复信息进行验证。具体地,可对回复信息的正确性以及相关性进行验证,以提高回复信息的准确性以及可靠性。示例性地,可对回复信息进行多路径验证以确定其可信度,并使用外部知识库或者是其他信息验证答复信息的正确性。即,如果多个推理路径指向相同或相似的回复信息,通过交叉验证提高答案的可信度。使用外部知识库或其他信息来源验证回复信息的正确性。

[0132] 除此之外,还可以对回复信息进行语义一致性检查以及逻辑一致性检查,以确保答复信息与问题在语义上是一致的,确保回复信息在逻辑上是合理的。

[0133] 图8中示意性示出了知识图谱问答处理方法的框架图,参考 图8中所示,主要通过文本强化方法以及隐式推理方法。可通过文本强化方法提取文本信息,该文本信息可以表示为文本形式四元组的形式。将文本信息输入至证据提取器得到高置信度的文本形式动作,将高置信度的文本形式动作输入至路径生成器,执行最优动作,以拓展推理路径。并且将最优动作输出至外部环境,以使得外部环境状态进行变化。外部环境将动作继续输入至系统,循环拓展推理路径。

[0134] 文本强化方法首先从外部语料中提取文本形式四元组表示的文本信息,文本形式四元组包括实体、关系、时间戳和文本描述。然后证据抽取器,用于动态选择最合适的文本形式动作来补充原始时序知识图谱,同时可以筛选出高置信度的文本形式动作并过滤掉噪音。隐式推理方法则通过多智能体协作学习的方式,在联合动作空间中计算每个候选动作的概率,并选择最合适的动作来扩展推理路径。另外,证据抽取器和路径生成器在与外部环境交互时协作执行最优动作,以最大化各自的奖励。

[0135] 图9中示意性示出了基于稀疏时序知识图谱的问答处理方法的具体流程示意图,参考 图9中所示,可通过文本强化方法和隐式推理方法实现智能问答。文本强化方法通过从外部语料中提取文本信息来补充稀疏时序知识图谱,从而增加图结构的密度。为了筛选出高置信度的文本信息并过滤掉噪音,通过第一智能体表示的证据抽取器,在每个时刻动态地选择高置信度的文本形式动作,来补充原始的稀疏时序知识图谱。隐式推理方法则通过第二智能体计算第一时刻的每个第一候选动作的执行概率,并根据执行概率从第一候选动作中选择最合适的第一动作,以作为第一时刻的最优动作来扩展推理路径并且可执行最优动作。此外,基于束搜索的动作选择机制,维护多条推理路径,并采用自适应采样策略来增加包含文本形式动作的推理路径的优先级,从而增加第一智能体和第二智能体获得正向奖励的概率。证据抽取器和路径生成器在与外部环境交互时协作执行最优动作,以最大化各自的奖励。最优动作可影响外部环境状态,外部环境将第一时刻的第一动作输入至系统,继续通过第一智能体和第二智能体生成第二时刻的最优动作,以拓展推理路径,如此循环,直至得到推理路径为止。本公开实施例中,通过利用外部语料提取文本信息,进一步从文本信息中选择文本形式动作,根据外部环境状态以及文本形式动作确定出第一动作,进而根据第一动作确定出推理路径,有效地缓解了时序知识图谱稀疏性造成的影响,提高了全面性。

[0136] 举例而言,若用户输入的问题是"哪位科学家发明了电灯?”,系统可执行以下步骤:

[0137] 路径生成与评分:使用束搜索和自适应采样策略生成多个候选推理路径,并对每个候选推理路径进行评分。

[0138] 选择最优路径:根据每个候选推理路径的评分选择最优路径作为推理路径。假设最优路径表示的推理路径为电灯-发明(关系)-A。

[0139] 答案提取:从最优路径中提取答复信息为"A”。因此,可以将"A”作为提取到的问题的回复信息。

[0140] 本公开实施例中的技术方案,能够动态适应知识图谱的变化和时序关系,提高了适应性,也增加了与上下文的互动,能够准确地确定问题的语义,准确理解问题。无需依赖预先定义好的嵌入向量以及问答对数据集,避免了局限性,提高了回复信息的准确性和丰富度。

[0141] 需要补充的是,在通过第一智能体以及第二智能体进行路径推理之前,首先可分别对第一智能体和第二智能体进行单独训练。进一步地,可在单独训练完后后,对第一智能体以及第二智能体进行联合训练,以得到用于推理的第一智能体和第二智能体。

[0142] 示例性地,模型首先采用策略梯度方法对第一智能体和第二智能体进行训练。具体地,通过最大化预定义的目标函数来优化参数,从而得到训练后的第一智能体以及训练后的第二智能体,使得证据抽取器和路径生成器能够更好地学习任务的特征和模式。

[0143] 接下来对联合训练的过程进行说明。联合训练旨在同时训练多个协同工作的智能体,以便多个智能体能够相互协作并共同提高性能。在联合训练时,可确定一个联合损失函数,旨在同时考虑证据抽取器和路径生成器的性能。这个联合损失函数可包括对证据抽取的准确性和路径生成的有效性的评估指标。在联合训练时,可通过梯度下降方法或其他方式,根据第二智能体的输出调整第一智能体的参数,根据第一智能体的输出调整第二智能体的参数,同时优化第一智能体和第二智能体的参数,使第一智能体和第二智能体在联合训练过程中共同最大化预定义的联合损失函数。反复迭代训练过程,不断调整证据抽取器和路径生成器的参数,直至满足训练结束条件为止。即,使得两个智能体相互影响并调整自己的参数,以使得整体的性能达到最优化,并从而使得多个智能体能够更好地适应彼此的特点和输出。通过联合训练,证据抽取器和路径生成器可以相互协作,相互影响,并逐步优化其性能,从而实现更好的任务执行效果。

[0144] 在模型训练完成之后,可通过评分参数对第一智能体以及第二智能体进行评估。可基于联合训练后的第一智能体和第二智能体对样本问题进行拟合,得到样本问题的参考回复信息,并确定参考回复信息的函数返回值,函数返回值可以用于表示参考回复信息是否正确。

[0145] 示例性地,可通过稀疏时序知识图谱中包含的事件数量、以及每个样本问题的参考回复信息的函数返回值确定评分参数,进而根据评分参数确定第一智能体以及第二智能体的质量。

[0146] 在一些实施例中,可获取稀疏时序知识图谱,该知识图谱中包含125000个实体和323000个事实,以及410000个自然语言问题。为了回答这些问题,需要进行时间推理。每个事实都以四元组的形式表示,包括主题、关系、对象和时间戳(表示开始时间和结束时间)。其中,主题和对象表示的是实体。

[0147] 该数据集分为训练数据、验证数据和测试数据,分别包含350000、30000和30000个问答对。评估时采用Hits@1和Hits@10作为评分标准。采用哪种评分标准,具体可根据任务类型进行确定,例如当任务类型为问答类任务是,可选择Hits@1作为评分标准。当任务类型为推荐类任务时,可选择Hits@10作为评分标准,以反映系统在一定范围内是否能够覆盖或涵盖用户可能感兴趣的内容,即使并非始终在首位。

[0148] 本公开实施例中,任务类型为从稀疏时序知识图谱中推断问题的答案,而不是直接使用原始数据集中提供的密集时序知识图谱。可以使用稀疏的CronQuestions数据集,用Hits@1作为评分标准,确定评分,具体公式如下:

[0149]

[0150] 其中,m=1或10,分别代表评估时考虑的是单个正确答案还是前10个正确答案。|eventNum|表示事实的数量,也就是稀疏时序知识图谱中包含的事件数量。函数σ(x)用于判断给定的输入x是否是正确答案,如果x是正确答案,则函数返回值为1,否则函数返回值为0。其中,输入可以为样本问题的参考回复信息。四元组排序rank i表示一种衡量模型性能的指标,该指标取决于模型对问题答案的排列顺序。数值越大代表模型性能越好,而数值越小则代表模型性能较差。

[0151] 综上所述,基于多智能体协作学习的稀疏时序知识图谱问答处理方法,通过多智能体之间的协作,系统能够更充分地利用数据中的信息,包括稀疏的时序知识图谱数据。第一智能体和第二智能体通过协作共享信息和结果,从而提高了数据的利用效率。多智能体协作学习使得系统能够更好地理解和推理复杂的问题,特别是需要跨越多个时间点进行推理的情况。通过将推理任务分解为多个子任务,并由不同智能体协作完成,系统能够更有效地应对复杂推理需求,提升了问题理解和推理能力。由于多智能体之间的协作和信息交换,系统的问答准确性和鲁棒性得到了提高。智能体之间相互补充,共同完成对问题的回答,减少了单一智能体可能存在的局限性,从而提高了问答系统的准确性和鲁棒性。多智能体协作学习方法具有较强的可扩展性,能够方便地应用于不同规模和复杂度的时序知识图谱问答任务中。通过增加或减少智能体的数量,系统能够适应不同规模的时序知识图谱数据和问题复杂度,具有较强的灵活性和可扩展性。

[0152] 图10中示意性示出了问答处理装置的示意图,参考 图10中所示,该问答处理装置1000主要包括以下模块:

[0153] 外部语料获取模块1001,用于确定问题对应的外部语料;

[0154] 知识图谱补充模块1002,用于从所述外部语料中提取文本信息,并将所述文本信息添加至稀疏时序知识图谱;

[0155] 文本形式动作选择模块1003,用于从所述稀疏时序知识图谱的文本信息中选择文本形式动作;

[0156] 推理路径生成模块1004,用于根据外部环境状态以及所述文本形式动作确定第一动作,并根据所述第一动作生成推理路径;

[0157] 回复信息确定模块1005,用于根据所述推理路径确定与所述问题对应的回复信息。

[0158] 在本公开的一种示例性实施例中,所述外部语料包括多个句子;所述从所述外部语料中提取文本信息,包括:获取所述句子的文本片段;提取所述文本片段的多个实体,并将所述文本片段链接至所述稀疏时序知识图谱的节点上,得到所述多个实体、所述句子的子句以及时间戳;所述子句包含提取的多个实体;根据所述多个实体、所述子句以及所述时间戳生成所述文本信息。

[0159] 在本公开的一种示例性实施例中,所述从所述稀疏时序知识图谱的文本信息中选择文本形式动作,包括:基于第一智能体,确定所述文本信息中每个参考文本形式动作的置信度分数;基于所述置信度分数随机抽取文本形式动作,得到文本形式动作。

[0160] 在本公开的一种示例性实施例中,所述外部环境状态至少包括与所述问题相关的已知资料信息;所述根据外部环境状态以及所述文本形式动作确定第一动作,包括:基于第二智能体,根据外部环境状态以及所述文本形式动作确定至少一个第一候选动作;所述候选动作与所述外部环境状态中的已知资料信息相关联;确定每个第一候选动作的执行概率,并根据所述执行概率确定第一动作。

[0161] 在本公开的一种示例性实施例中,所述确定每个第一候选动作的执行概率,包括:通过策略网络确定在外部环境状态下执行每个第一候选动作的条件概率;将神经网络模型的模型参数输入至所述策略网络中,以通过所述模型参数对所述条件概率进行近似处理,确定每个候选动作的执行概率;其中,所述神经网络模型的模型参数通过对第一智能体和第二智能体的奖励进行训练而更新。

[0162] 在本公开的一种示例性实施例中,所述根据所述第一动作生成推理路径,包括:根据第一动作对所述外部环境状态进行更新以确定更新后的外部环境状态,并确定第一智能体以及第二智能体的奖励;将最大化第一智能体的奖励以及第二智能体的奖励作为优化目标,根据奖励的方向对第一智能体和第二智能体进行更新,以得到更新后的第一智能体和更新后的第二智能体;根据更新后的第一智能体确定文本形式动作,并基于更新后的第二智能体,根据更新后的外部环境状态以及文本形式动作确定第二动作,直至满足结束条件为止,以生成推理路径。

[0163] 在本公开的一种示例性实施例中,所述根据更新后的外部环境状态以及文本形式动作确定第二动作,包括:根据所述更新后的外部环境状态以及文本形式动作确定至少一个第二候选动作;所述第二候选动作与所述更新后的外部环境状态中的已知资料信息相关联;确定每个第二候选动作的执行概率,并根据所述执行概率确定第二动作。

[0164] 在本公开的一种示例性实施例中,所述第二智能体中包括长短期记忆网络,所述方法还包括:基于长短期记忆网络对初始时刻到第一时刻之间的动作序列进行编码,以得到序列数据;对所述序列数据进行处理,更新所述长短期记忆网络的隐藏状态,以生成所述第一时刻的隐含表示;根据所述隐含表示确定所述第一时刻的记忆向量,并根据所述外部环境状态以及所述记忆向量,确定位于第一时刻之后的第二时刻的预测动作,并根据所述预测动作确定所述至少一个第二候选动作;其中,所述记忆向量用于表示长短期记忆网络在第一时刻对问题的关注程度,所述记忆向量根据所述隐含表示进行更新。

[0165] 在本公开的一种示例性实施例中,所述确定第一智能体以及第二智能体的奖励,包括:在外部环境状态下,根据外部环境确定第一智能体的第一外部奖励和第二智能体的第二外部奖励;基于外部环境状态以及第一智能体执行的动作确定第一智能体的第一内部奖励,并基于外部环境状态以及第二智能体执行的动作确定第二智能体的第二内部奖励;将第一外部奖励与第一内部奖励进行加权求和,得到第一智能体的奖励;将第二外部奖励与第二内部奖励进行加权求和,得到第二智能体的奖励。

[0166] 在本公开的一种示例性实施例中,所述确定第一智能体以及第二智能体的奖励,包括:确定外部环境状态和第一动作组成的数据对的第三奖励;对所述第三奖励进行变换,确定在外部环境状态下能够获得的第四奖励,并将所述第四奖励确定为第一智能体的奖励以及第二智能体的奖励。

[0167] 在本公开的一种示例性实施例中,在生成推理路径时,所述方法还包括:根据预先配置的束宽参数生成多个候选推理路径,并从多个候选推理路径中确定所述推理路径。

[0168] 在本公开的一种示例性实施例中,所述根据预先配置的束宽参数生成多个候选推理路径,包括:根据所述预先配置的束宽参数,确定第一候选推理路径以及第二候选推理路径;根据所述第一候选推理路径以及所述第二候选推理路径确定多个候选推理路径;其中,所述第一候选推理路径中包含所述文本形式动作,所述第一候选推理路径的优先级高于第二候选推理路径的优先级。

[0169] 在本公开的一种示例性实施例中,所述从多个候选推理路径中确定所述推理路径,包括:根据所述候选推理路径的长度、节点权重以及边的权重、候选推理路径中包含的信息质量、候选推理路径终点的相关性中的一种或多种,对所述候选推理路径进行评分;根据所述评分,从多个候选推理路径中确定所述推理路径。

[0170] 在本公开的一种示例性实施例中,所述基于所述推理路径确定与所述问题对应的回复信息,包括:在所述推理路径不包含文本形式动作的情况下,若所述问题的属性参数为实体关系问题,将所述推理路径中的终点实体作为所述回复信息;在所述推理路径不包含文本形式动作的情况下,若所述问题的属性参数为实体属性问题,将所述推理路径中目标节点或目标边的属性作为所述回复信息;在所述推理路径包含文本形式动作的情况下,通过自然语言处理算法对所述文本形式动作的动作内容进行分析,得到所述回复信息。

[0171] 在本公开的一种示例性实施例中,在确定所述回复信息之后,所述方法还包括:通过多路径验证方式对所述回复信息进行验证,并通过外部知识库对所述回复信息进行验证。

[0172] 在本公开的一种示例性实施例中,所述方法还包括:对第一智能体以及第二智能体进行单独训练,并在单独训练完成后对所述第一智能体以及第二智能体进行联合训练。

[0173] 在本公开的一种示例性实施例中,所述对所述第一智能体以及第二智能体进行联合训练,包括:确定联合损失函数,并通过梯度下降算法对所述第一智能体以及所述第二智能体的参数进行调整,直至所述联合损失函数满足训练结束条件为止。

[0174] 在本公开的一种示例性实施例中,在对所述第一智能体以及第二智能体进行联合训练后,所述方法还包括:基于联合训练后的第一智能体和第二智能体对样本问题进行拟合,确定所述样本问题的参考回复信息,并获取所述参考回复信息的函数返回值;所述函数返回值用于表示所述回复信息是否正确;通过稀疏时序知识图谱中包含的事件数量以及所述函数返回值确定评分参数,并根据所述评分参数对所述第一智能体以及所述第二智能体进行评估。

[0175] 需要说明的是,上述问答处理装置中各模块的具体细节,已经在对应的方法中进行了详细的描述,因此此处不再赘述。

[0176] 应当注意,尽管在上文详细描述中提及了用于动作执行的设备的若干模块或者单元,但是这种划分并非强制性的。实际上,根据本公开的实施方式,上文描述的两个或更多模块或者单元的特征和功能可以在一个模块或者单元中具体化。反之,上文描述的一个模块或者单元的特征和功能可以进一步划分为由多个模块或者单元来具体化。

[0177] 此外,尽管在附图中以特定顺序描述了本公开中方法的各个步骤,但是,这并非要求或者暗示必须按照该特定顺序来执行这些步骤,或是必须执行全部所示的步骤才能实现期望的结果。附加的或备选的,可以省略某些步骤,将多个步骤合并为一个步骤执行,以及 / 或者将一个步骤分解为多个步骤执行等。

[0178] 在本公开的示例性实施例中,还提供了一种能够实现上述方法的电子设备。

[0179] 所属技术领域的技术人员能够理解,本公开的各个方面可以实现为系统、方法或程序产品。因此,本公开的各个方面可以具体实现为以下形式,即:完全的硬件实施方式、完全的软件实施方式(包括固件、微代码等),或硬件和软件方面结合的实施方式,这里可以统称为"电路”、"模块”或"系统”。

[0180] 下面参照 图11来描述根据本公开的这种实施方式的电子设备1100。 图11显示的电子设备1100仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。

[0181] 如 图11所示,电子设备1100以通用计算设备的形式表现。电子设备1100的组件可以包括但不限于:上述至少一个处理单元1110、上述至少一个存储单元1120、连接不同系统组件(包括存储单元1120和处理单元1110)的总线1130以及显示单元1140。

[0182] 其中,所述存储单元存储有程序代码,所述程序代码可以被所述处理单元1110执行,使得所述处理单元1110执行本说明书上述"示例性方法”部分中描述的根据本公开各种示例性实施方式的步骤。例如,所述处理单元1110可以执行如 图2中所示的步骤。

[0183] 存储单元1120可以包括易失性存储单元形式的可读介质,例如随机存取存储单元(RAM)11201和 / 或高速缓存存储单元11202,还可以进一步包括只读存储单元(ROM)11203。

[0184] 存储单元1120还可以包括具有一组(至少一个)程序模块11205的程序 / 实用工具11204,这样的程序模块11205包括但不限于:操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。

[0185] 总线1130可以为表示几类总线结构中的一种或多种,包括存储单元总线或者存储单元控制器、外围总线、图形加速端口、处理单元或者使用多种总线结构中的任意总线结构的局域总线。

[0186] 电子设备1100也可以与一个或多个外部设备1200(例如键盘、指向设备、蓝牙设备等)通信,还可与一个或者多个使得用户能与该电子设备1100交互的设备通信,和 / 或与使得该电子设备1100能与一个或多个其它计算设备进行通信的任何设备(例如路由器、调制解调器等等)通信。这种通信可以通过输入 / 输出(I / O)接口1150进行。并且,电子设备1100还可以通过网络适配器1160与一个或者多个网络(例如局域网(LAN),广域网(WAN)和 / 或公共网络,例如因特网)通信。如图所示,网络适配器1160通过总线1130与电子设备1100的其它模块通信。应当明白,尽管图中未示出,可以结合电子设备1100使用其它硬件和 / 或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。

[0187] 通过以上的实施方式的描述,本领域的技术人员易于理解,这里描述的示例实施方式可以通过软件实现,也可以通过软件结合必要的硬件的方式来实现。因此,根据本公开实施方式的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中或网络上,包括若干指令以使得一台计算设备(可以是个人计算机、服务器、终端装置、或者电子设备等)执行根据本公开实施方式的方法。

[0188] 需要说明的是,本公开一些实施例中还提供了一种计算机程序产品,计算机程序产品包括计算机程序,计算机程序被处理器执行时实现上述方法。

[0189] 在一种实施方式中,计算机程序产品可以是包含计算机程序的有形产品,如存储有计算机程序的计算机可读存储介质。可读存储介质可以是基于电、磁、光、电磁、红外线等信号的存储介质,包括但不限于:随机存取存储器(RAM),只读存储器(ROM),磁带,软盘,闪存(Flash),机械硬盘(HDD),固态硬盘(SSD),等等。示例性的,计算机程序产品可以实现为存储有计算机程序的非易失性存储介质,如只读存储器,与非门闪存(Nand Flash)等。

[0190] 除此之外,还提供了一种计算机可读存储介质。该计算机可读存储介质中包括计算机程序,计算机程序被处理器执行时实现上述方法。

[0191] 在一种实施方式中,计算机程序产品可以是包含计算机程序的无形产品。示例性的,计算机程序产品可以实现为虚拟数字产品,如存储有计算机程序的可执行文件,安装包等数字文件。

[0192] 计算机程序的代码可以通过一种或多种程序设计语言来编写。程序设计语言如C语言、Java、C++等。程序代码可以完全地在用户计算设备上执行,或者部分地在用户计算设备上执行,或者作为一个独立的软件包执行,或者部分在用户计算设备上部分在远程计算设备上执行,或者完全在远程计算设备或服务器上执行。在涉及远程计算设备的情形中,远程计算设备可以通过任意种类的网络,如局域网(LAN)、广域网(WAN)等,连接到用户计算设备,或者,可以连接到外部计算设备(例如通过运营商提供的因特网连接)。

[0193] 计算机程序可以通过电、磁、光、电磁、红外线等信号承载或传输。电子设备可以将承载计算机程序的信号转换为数字信号,进而运行计算机程序。当计算机程序在电子设备上运行时,其代码用于使电子设备执行(更具体地,可以使电子设备的处理器执行)本公开各种示例性实施方式的方法步骤。

[0194] 通过以上的实施方式的描述,本领域的技术人员易于理解,这里描述的示例实施方式可以通过软件实现,也可以通过软件结合必要的硬件的方式来实现。因此,根据本公开实施方式的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中或网络上,包括若干指令以使得一台计算设备(可以是个人计算机、服务器、终端装置、或者网络设备等)执行根据本公开实施方式的方法。

[0195] 此外,上述附图仅是根据本公开示例性实施例的方法所包括的处理的示意性说明,而不是限制目的。易于理解,上述附图所示的处理并不表明或限制这些处理的时间顺序。另外,也易于理解,这些处理可以是例如在多个模块中同步或异步执行的。

[0196] 应当注意,尽管在上文详细描述中提及了用于动作执行的设备的若干模块或者单元,但是这种划分并非强制性的。实际上,根据本公开的实施方式,上文描述的两个或更多模块或者单元的特征和功能可以在一个模块或者单元中具体化。反之,上文描述的一个模块或者单元的特征和功能可以进一步划分为由多个模块或者单元来具体化。

[0197] 本领域技术人员在考虑说明书及实践这里公开的内容后,将容易想到本公开的其他实施例。本申请旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由权利要求指出。

[0198] 应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求来。 < / timestamp> < / obj>

Claims

1. A question-answering processing method, characterized in that: include: Determine the external corpus corresponding to the question; Extracting text information from the external corpus and adding the text information to a sparse temporal knowledge graph; Selecting a textual action from the textual information in the sparse temporal knowledge graph; Determine a first action according to the external environment state and the text-form action, and generate a reasoning path according to the first action; Response information corresponding to the question is determined according to the reasoning path.

2. The question-answer processing method according to claim 1, characterized in that: The external corpus includes a plurality of sentences; The extracting text information from the external corpus includes: Obtaining a text fragment of the sentence; Extracting multiple entities from the text fragment, and linking the text fragment to the nodes of the sparse temporal knowledge graph, to obtain the multiple entities, clauses of the sentence, and a timestamp; the clauses contain the entities extracted from the text fragment; The text information is generated according to the multiple entities, the clauses, and the timestamp.

3. The question-answer processing method according to claim 1, characterized in that: The action of selecting a text form from the text information of the sparse temporal knowledge graph includes: Determining, based on the first agent, a confidence score for each reference text form action in the text information; A text-form action is randomly extracted based on the confidence score to obtain a text-form action.

4. The question-answer processing method according to claim 1, characterized in that: The external environment state at least includes known data information related to the problem; the first action is determined according to the external environment state and the text-based action, including: Based on the second agent, at least one first candidate action is determined according to the external environment state and the text-form action; the first candidate action is associated with known data information in the external environment state; An execution probability of each first candidate action is determined, and a first action is determined according to the execution probability.

5. The question-answer processing method according to claim 4, characterized in that: The determining the execution probability of each first candidate action includes: Determine the conditional probability of executing each first candidate action under the external environment state through the policy network; The model parameters of the neural network model are input into the policy network to approximate the conditional probability through the model parameters to determine the execution probability of each candidate action; wherein the model parameters of the neural network model are updated by training the rewards of the first agent and the second agent.

6. The question-answer processing method according to claim 1, characterized in that: Generating a reasoning path according to the first action includes: Update the external environment state according to the first action to determine an updated external environment state, and determine rewards for the first agent and the second agent; Taking maximizing the reward of the first agent and the reward of the second agent as the optimization goal, the first agent and the second agent are updated according to the direction of the reward to obtain an updated first agent and an updated second agent; A text-based action is determined based on the updated first agent, and a second action is determined based on the updated second agent according to the updated external environment state and the text-based action, until an end condition is met, to generate a reasoning path.

7. The question-answer processing method according to claim 6, characterized in that: The determining of the second action according to the updated external environment state provided by the external environment and the text-based action includes: Determine at least one second candidate action according to the updated external environment state and the text form action; the second candidate action is associated with the known data information in the updated external environment state; An execution probability of each second candidate action is determined, and a second action is determined according to the execution probability.

8. The question-answer processing method according to claim 7, characterized in that: The second agent includes a long short-term memory network, and the method further includes: Encode the action sequence from the initial moment to the first moment based on the long short-term memory network to obtain sequence data; Processing the sequence data, updating the hidden state of the long short-term memory network to generate an implicit representation of the first moment; Determine a memory vector at the first moment according to the implicit representation, determine a predicted action at a second moment after the first moment according to the external environment state and the memory vector, and determine the at least one second candidate action according to the predicted action; The memory vector is used to represent the degree of attention that the long short-term memory network pays to the problem at the first moment, and the memory vector is updated according to the implicit representation.

9. The question-answer processing method according to claim 6, characterized in that: The determining of rewards for the first agent and the second agent includes: Under the external environment state, determining a first external reward for the first agent and a second external reward for the second agent according to the external environment; Determine a first internal reward for the first agent based on the external environment state and the action performed by the first agent, and determine a second internal reward for the second agent based on the external environment state and the action performed by the second agent; Perform a weighted summation of the first external reward and the first internal reward to obtain a reward for the first agent; The second external reward and the second internal reward are weighted summed to obtain the reward of the second agent.

10. The question-answer processing method according to claim 6, characterized in that: The determining of rewards for the first agent and the second agent includes: Determine a third reward for a data pair consisting of an external environment state and a first action; The third reward is transformed to determine a fourth reward that can be obtained under the external environment state, and the fourth reward is determined as a reward for the first agent and a reward for the second agent.

11. The question-answer processing method according to claim 1, characterized in that: When generating the reasoning path, the method further includes: A plurality of candidate reasoning paths are generated according to preconfigured beam width parameters, and the reasoning path is determined from the plurality of candidate reasoning paths.

12. The question-answer processing method according to claim 11, characterized in that: The generating of multiple candidate reasoning paths according to the pre-configured beam width parameters includes: Determining a first candidate reasoning path and a second candidate reasoning path according to the preconfigured beam width parameter; Determine a plurality of candidate reasoning paths according to the first candidate reasoning path and the second candidate reasoning path; The first candidate reasoning path includes the text-based action, and the priority of the first candidate reasoning path is higher than that of the second candidate reasoning path.

13. The question-answer processing method according to claim 11, characterized in that: Determining the reasoning path from a plurality of candidate reasoning paths includes: Scoring the candidate reasoning path according to one or more of the length of the candidate reasoning path, the node weights and the edge weights, the quality of information contained in the candidate reasoning path, and the relevance of the endpoints of the candidate reasoning path; The reasoning path is determined from a plurality of candidate reasoning paths according to the score.

14. The question-answer processing method according to claim 1, characterized in that: The determining the reply information corresponding to the question based on the reasoning path includes: In the case where the reasoning path does not include a text-based action, if the attribute parameter of the question is an entity relationship question, the end entity in the reasoning path is used as the reply information; In the case where the reasoning path does not include a text-based action, if the attribute parameter of the question is an entity attribute question, the attribute of the target node or target edge in the reasoning path is used as the reply information; In the case where the reasoning path includes a text-based action, the action content of the text-based action is analyzed by a natural language processing algorithm to obtain the reply information.

15. The question-answer processing method according to claim 1, characterized in that: After determining the reply information, the method further includes: The reply information is verified through a multi-path verification method, and the reply information is verified through an external knowledge base.

16. The question-answer processing method according to claim 6, characterized in that: The method further comprises: The first agent and the second agent are trained separately, and after the separate training is completed, the first agent and the second agent are jointly trained.

17. The question-answer processing method according to claim 16, characterized in that: The joint training of the first agent and the second agent includes: Determine a joint loss function, and adjust the parameters of the first agent and the second agent by a gradient descent algorithm until the joint loss function meets the training end condition.

18. The question-answer processing method according to claim 16, characterized in that: After jointly training the first agent and the second agent, the method further includes: Fitting the sample question based on the first agent and the second agent after joint training, determining reference reply information of the sample question, and obtaining a function return value of the reference reply information; the function return value is used to indicate whether the reply information is correct; The scoring parameters are determined by the number of events contained in the sparse time series knowledge graph and the function return value, and the first agent and the second agent are evaluated according to the scoring parameters.

19. A question-answer processing device, characterized in that: include: An external corpus acquisition module, used to determine the external corpus corresponding to the question based on the question; A knowledge graph supplement module, used to extract text information from the external corpus and add the text information to the sparse temporal knowledge graph; A text-based action selection module, used to select text-based actions from the text information in the sparse temporal knowledge graph; A reasoning path generating module, configured to determine a first action according to an external environment state and the text-based action, and to generate a reasoning path according to the first action; A response information determination module is used to determine the response information corresponding to the question according to the reasoning path.

20. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the question and answer processing method according to any one of claims 1 to 18 is implemented.

21. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the question-answering processing method according to any one of claims 1 to 18.

22. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to execute the question and answer processing method described in any one of claims 1-18 by executing the executable instructions.