Search recommendation method of weighted directed reasoning tree set generated based on reasoning trajectory

Through the weighted directed reasoning tree collection method based on reasoning trajectory generation, the problem of insufficient utilization of logically related reasoning chains and contextual information in the existing technology is solved, more accurate and stable search recommendation results are achieved, and semantic matching and planning are enhanced. Reasoning skills.

CN118673131AActive Publication Date: 2024-09-20NORTHEASTERN UNIV CHINA

Patent Information

Application Number
CN202410823151.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-09-20
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

Existing search recommendation methods have limitations in processing logically related or directed inference chains with inheritance relationships, lack semantic coherence, and fail to make full use of rich contextual information, resulting in insufficient accuracy and stability of recommendation results.

Method used

Using a weighted directed inference tree collection method based on inference trajectory generation, the weighted directed inference tree is converted into a vector representation through vector space mapping and inference path fusion, and a large model is used to generate a complete inference path, combined with direct preference optimization The algorithm optimizes the strategy model to improve the accuracy and stability of recommendation results.

Benefits of technology

A collection of weighted directed inference trees with rich semantic information is constructed, which significantly improves the accuracy of semantic understanding and recommendation, improves the quality and robustness of recommendation results, and enhances the modeling capabilities of application fields.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0004909676040000044
    Figure BDA0004909676040000044
  • Figure BDA0004909676040000059
    Figure BDA0004909676040000059
  • Figure BDA0004909676040000111
    Figure BDA0004909676040000111
Patent Text Reader

Abstract

The invention provides a search recommendation method of a weighted directed reasoning tree set generated based on reasoning tracks, and relates to the technical field of search recommendation. The method comprises the following steps: collecting historical text data in a specific business scene according to user requirements, extracting semantic information, and constructing a weighted directed reasoning tree set with semantic information and a complete reasoning track by utilizing the extracted semantic information; converting weighted directed inference trees in the weighted directed inference tree set into vector representation by adopting a vector space mapping and inference path fusion method; taking the large model as a strategy model, generating a complete reasoning path by adopting a reasoning track generation method based on the large model, constructing a preference data set, and optimizing the strategy model by adopting a direct preference optimization algorithm; and obtaining a search word provided by the user and inputting the search word into the optimized strategy model to obtain a final recommendation result of the search word, so that more personalized and high-quality search results and recommendation contents are provided for the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of search recommendation, and in particular to a search recommendation method based on a weighted directed inference tree set generated based on inference trajectories. Background Art

[0002] Search recommendation technology combines the advantages of search engines and recommendation systems, aiming to provide users with personalized and high-quality search results and recommended content. This technology intelligently analyzes users' historical behaviors and interest preferences, and combines the characteristics of the data itself to deeply explore users' personalized needs, thereby accurately matching and recommending content that meets their needs. Efficient and accurate search recommendation technology can not only significantly enhance users' search experience and reduce information overload problems, but also quickly discover content that users are interested in. Therefore, it has broad application prospects in many fields such as information retrieval, e-commerce, medical assistance, and teaching systems.

[0003] Traditional search recommendation methods mainly rely on keyword matching and rule-based retrieval, which uses keyword matching to retrieve relevant documents and perform reasoning and sorting according to established rules. However, this method has certain limitations. First, the existing recommendation system does not fully consider that the information stored in recommendation applications such as product recommendation, medical assistance, and teaching systems may have directed reasoning chains that are logically related or have a connection relationship. The historical data or records contained in the above storage information can actually provide a traceable reasoning basis for subsequent recommendation searches. Secondly, single or multiple discrete search terms are relatively isolated and lack logical relationships, resulting in the lack of semantic coherence in the generated reasoning path and failure to fully utilize rich contextual information. In order to overcome the above limitations, researchers have proposed methods of knowledge graphs and attention mechanisms. On the one hand, knowledge graphs capture the relationship between semantic entities by constructing a knowledge base with a directed graph or tree structure, thereby providing support for the reasoning process. However, the relationship network in the knowledge graph is complex, requiring a lot of manpower to finely model domain knowledge, resulting in high costs for building and maintaining the knowledge base. On the other hand, the attention mechanism focuses on the contextual semantics of sequential data and can capture long-distance dependencies, but it still has limitations when dealing with complex decision planning and reasoning challenges.

[0004] In general, the above methods are still insufficient in terms of reasonable use of domain knowledge and contextual semantics, as well as efficient planning and reasoning capabilities. This not only limits the ability of existing search recommendation algorithms to mine the inherent laws and relevance of data, but also affects the efficiency of guiding search recommendations by generating reasonable reasoning paths. Therefore, developing a new method that can effectively integrate semantic information and planning and reasoning capabilities has become the key to improving the accuracy and stability of search recommendation technology. Summary of the invention

[0005] In view of the above-mentioned deficiencies of the prior art, the present invention proposes a search recommendation method based on a weighted directed inference tree set generated by inference trajectory, aiming to provide users with more personalized and high-quality search results and recommended content.

[0006] The present invention proposes a search recommendation method for a weighted directed inference tree set generated based on an inference trajectory, the method comprising the following steps:

[0007] Step 1: Collect historical text data in specific business scenarios according to user needs, extract semantic information from the historical text data, and use the extracted semantic information to build a set of weighted directed reasoning trees with semantic information and complete reasoning trajectories;

[0008] Step 2: Using the method of vector space mapping and reasoning path fusion, the weighted directed reasoning tree in the set of weighted directed reasoning trees with semantic information and containing complete reasoning trajectories is converted into a vector representation;

[0009] Step 3: Use the big model as the policy model π θ , adopts the reasoning trajectory generation method based on the large model, and uses the strategy model and the vector representation of the weighted directed reasoning tree to generate a complete reasoning path; where θ is the parameter of the strategy model;

[0010] Step 4: Build a preference dataset based on the complete reasoning path

[0011] Step 5: Based on the preference dataset Use direct preference optimization algorithm to optimize the strategy model and obtain the optimized strategy model π * ;

[0012] Step 6: Obtain the search terms provided by the user and input the optimized strategy model π * In the above example, we use the optimized strategy model π * Get the final recommended results for the search term;

[0013] The step 1 further comprises:

[0014] Step 1.1: Collect several historical text data in specific business scenarios according to user needs;

[0015] Step 1.2: Clean the collected historical text data, take each cleaned historical text data as a data sample and construct a data sample set;

[0016] Step 1.3: Use the information extraction model UIE to extract information from all data samples in the data sample set, and use the pre-trained model to convert the extracted information into a text vector representation with semantic information;

[0017] Step 1.4: Use the text vector representation with semantic information to construct a set of weighted directed reasoning trees with semantic information and containing complete reasoning trajectories;

[0018] The step 1.3 further comprises:

[0019] Step 1.3.1: For the i-th data sample in the data sample set, use the information extraction model UIE to extract entities, relationships between entities, and key information used to judge the importance of entities and the importance of relationships between entities from the data sample; where i = {1, ..., n}, n represents the number of data samples in the data sample set;

[0020] Step 1.3.2: Take each extracted entity as a node and use the extracted entities to construct a node set N; take the relationship between each extracted entity as a directed edge and use the relationship between the extracted entities to construct a directed edge set E; use the extracted key information to set a weight in the range of [0,1] for each node and each directed edge and construct a weight set W;

[0021] The nodes are divided into: input nodes, intermediate nodes and output nodes;

[0022] Step 1.3.3: Use the pre-trained model to convert the node set N, the directed edge set E, and the weight set W from text representation to a text vector representation containing semantic information, and obtain the converted node set N i , the converted directed edge set E i And the converted weight set W i ;

[0023] The converted node set N i Denoted as: N i ={n1,…,n j ,…,n m}, where n1 represents the text vector representation of the first node; n j Represents the text vector representation of the jth node; n m Represents the text vector representation of the mth node;

[0024] The converted directed edge set is recorded as: E i ={e1,…,e h ,…,e k}, where e1 represents the text vector representation of the first directed edge; e h The text vector representation of the h-th directed edge; e k The text vector representation of the k-th directed edge;

[0025] The converted weight set Wi Denoted as: in represents the set of directed edge weights after conversion, and in The text vector representation representing the weight of the first directed edge; The text vector representation representing the weight of the h-th directed edge; The text vector representation representing the weight of the k-th directed edge; represents the set of node weights after conversion, and in The text vector representation of the first node weight; The text vector representation representing the weight of the jth node; The text vector representation representing the weight of the mth node;

[0026] The step 1.4 further comprises:

[0027] Step 1.4.1: Use the transformed node set N i , the converted directed edge set E i And the converted weight set W i Construct a weighted directed inference tree T for the i-th data sample i , denoted as T i =(N i ,E i ,W i );

[0028] Step 1.4.2: Construct a weighted directed inference tree for each data sample in the data sample set, and use the weighted directed inference trees of all data samples to construct a set of weighted directed inference trees with semantic information and containing complete inference trajectories, denoted as T = {T1,…,T i ,…,T n}, where T1 and T n They respectively represent the first weighted directed inference tree and the nth weighted directed inference tree in the weighted directed inference tree set;

[0029] The step 2 further comprises:

[0030] Step 2.1: For the i-th weighted directed inference tree T in the set of weighted directed inference trees with semantic information and containing complete inference trajectories i , is T i The node set N in i Define a transfer matrix M n , is T i The set of directed edges E in i Define a transfer matrix M e ; wherein the transfer matrix Mn and the transfer matrix M e Independent of each other;

[0031] Step 2.2: Define the projection function and use the projection function and transfer matrix M n and the transfer matrix M e , the node set N i and the directed edge set E i Project them into the same vector space to obtain the projected node vector representation and directed edge vector representation;

[0032] The projection function is expressed as:

[0033]

[0034] where n x is the node set N i The nodes participating in the projection; To use the transfer matrix M n For x The node vector representation obtained after projection; e y is the directed edge set E i The directed edges participating in the projection; To use the transfer matrix M e For y The directed edge vector representation obtained after projection; and In the same vector space;

[0035] Step 2.3: Based on the projected node vector representation and directed edge vector representation, calculate the node vector representation of all nodes in the weighted directed reasoning tree that integrates the node semantic information and the reasoning path information;

[0036] The calculation method of the node vector representation of the fused node semantic information and the reasoning path information is as follows: for an input node in a weighted directed reasoning tree, the node vector representation after the input node is projected is used as the node vector representation of the fused node semantic information and the reasoning path information of the input node; for an intermediate node or an output node in a weighted directed reasoning tree, the calculation method of the node vector representation of the fused node semantic information and the reasoning path information of the intermediate node or the output node is as follows:

[0037]

[0038] in is the node vector representation of the fusion node semantic information and reasoning path information of the intermediate node or output node; for node n x The node vector obtained after projection is represented by express The weight of semantic information in express The parent node of is represented by the node vector after projection; px Indicates from arrive The directed edges of Represents a directed edge e px Directed edge vector representation after projection; To represent a directed edge The weight of semantic information in

[0039] Step 2.4: Convert the weighted directed inference tree T i The node vector representations of the fused node semantic information and reasoning path information of all nodes in the ensemble are weighted and summed according to the weights to obtain the vector representation of the weighted directed reasoning tree;

[0040] The step 3 further comprises:

[0041] Step 3.1: Obtain several groups of search terms x and the recommended results y corresponding to each group of search terms;

[0042] Step 3.2: Clean the acquired search terms, use the pre-trained model to convert the cleaned search terms and the recommended results corresponding to each group of search terms into vector representations, and use the converted vector representations to construct a training set where x (α) represents the vector representation of the αth group of search terms after conversion; y (α) The vector representation after the conversion of the recommendation results corresponding to the αth group of search terms is represented;

[0043] Step 3.3: Train the training set x in (α) As the starting point of the reasoning path, y (α) As the end point of the reasoning path, the training set Input strategy model π θ , generate a complete reasoning path;

[0044] Step 3.4: For the training set All the search terms x and the recommended results y corresponding to the search terms x generate a complete reasoning path respectively;

[0045] The step 3.3 further comprises:

[0046] Step 3.3.1: Generate an intermediate node on the reasoning path using the vector representation of the starting point of the reasoning path and the vector representation of the weight of the starting point of the reasoning path and use it as the current intermediate node;

[0047] Step 3.3.2: Determine whether the current intermediate node is the end point of the reasoning path; if so, generate a complete reasoning path; if not, execute step 3.3.3;

[0048] Step 3.3.3: Input the vector representations of all nodes, all directed edges, and all weights in the reasoning path from the starting point to the current intermediate node into the strategy model, use the strategy model to gradually infer the leaf nodes based on the known parts of the reasoning path, and generate an estimated reasoning path from the current intermediate node to the leaf node;

[0049] Step 3.3.4: Use the method of vector space mapping and reasoning path fusion to convert the estimated reasoning path into a vector representation, and obtain the vector representation P of the estimated reasoning path;

[0050] Step 3.3.5: Calculate the semantic structure similarity between the vector representation P of the estimated reasoning path and the vector representations of all weighted directed reasoning trees in the weighted directed reasoning tree set, and use the obtained semantic similarity as the expected reward of the current intermediate node;

[0051] Step 3.3.6: Determine whether the number of estimated reasoning paths is greater than the preset maximum number of estimated reasoning paths. If not, return to step 3.3.3; if so, select the next node of the current intermediate node in the estimated reasoning path with the highest expected reward as the child node of the current intermediate node, and then use the child node as the new current intermediate node and return to step 3.3.2;

[0052] Step 3.3.7: Build a set of possible reasoning paths using all estimated reasoning paths except the complete reasoning path

[0053] The preferred dataset described in step 4 The construction method is: for the training set x is the starting point of the reasoning path (α) , and the resulting complete reasoning path is used as (α) The corresponding correct reasoning path At the same time, from the estimated reasoning path set Select at least one estimated reasoning path from (α) The corresponding incorrect reasoning path Using x (α) , and Construct a set of preference data, denoted as A set of preference data is constructed for each set of vector representations of search terms in the training set, and a preference data set is constructed using all the obtained preference data.

[0054] The optimization objective function of the direct preference optimization algorithm described in step 5 is:

[0055]

[0056] in is the optimization objective function of the direct preference optimization algorithm; π ref is the reference strategy model; To represent the preference data set The preferred data (x, τ w ,τ l )The mathematical expectation of all possible values, τ w For the correct reasoning path, τ l is the incorrect inference path; σ is the hyperparameter used to represent the confidence interval; β is the hyperparameter in the optimization objective function; π θ (τ w |x) means that given the search term x, the strategy model π θ Take the correct reasoning path τ w The possibility of ref (τ w |x) means that given the search term x, the reference strategy model π ref Take the correct reasoning path τ w The possibility of θ (τ l |x) means that given the search term x, the strategy model π θ Taking incorrect reasoning path τ l The possibility of ref (τ l |x) means that given the search term x, the reference strategy model π ref Taking incorrect reasoning path τ l possibility;

[0057] The step 6 further comprises:

[0058] Step 6.1: Get the search term q provided by the user and perform data cleaning, and use the pre-trained model to vectorize the cleaned search term, and then concatenate the obtained vector representation with the prompt in the optimized strategy model to obtain the normalized search term vector representation q′;

[0059] Step 6.2: Input the normalized retrieval term vector representation q′ into the optimized strategy model π * Starting from q′, generate u candidate reasoning paths to the output nodes of each weighted directed reasoning tree in the set of weighted directed reasoning trees, and construct a set of candidate reasoning paths O = {o1, o2, ..., o u}; where o1, o2, ..., ou They are the 1st, 2nd and uth candidate reasoning paths in the candidate reasoning path set respectively;

[0060] Step 6.3: Calculate the conditional probability scores of all candidate reasoning paths in the candidate reasoning path set O, and sort all candidate reasoning paths in descending order according to the conditional probability scores to obtain an ordered candidate path set. in They are the 1st, 2nd and uth ordered candidate paths in the ordered candidate path set respectively;

[0061] Step 6.4: From the ordered candidate path set O * Select the first S ordered candidate paths from the query, take the endpoints of the first S ordered candidate paths as the S recommended results for the search term q, and construct a recommended result set Where S is the preset maximum number of recommendations; These are the recommendation results corresponding to the 1st, 2nd and Sth ordered candidate paths respectively;

[0062] Step 6.5: Send the recommendation result set R to the user, and the user selects a recommendation result from the recommendation result set R as the final recommendation result, and adds the search term q and the final recommendation result to the training set. Used to continuously optimize the strategy model.

[0063] The beneficial effects of adopting the above technical solution are:

[0064] The method of the present invention innovatively constructs a set of weighted directed reasoning trees with rich semantic information, clearly depicts the logical structure and semantic connection of the reasoning process, and lays the foundation for semantic matching and planning reasoning. The language model is used to encode the nodes, edges and weights in the weighted directed reasoning tree into vector representations, retaining the semantic features and being able to model the application field in a detailed and in-depth manner.

[0065] The method of the present invention introduces a large language model (LLM) as a strategic model to automatically generate reasoning trajectories, giving full play to the advantages of LLM semantic understanding and planning reasoning. Based on a set of weighted directed reasoning trees, LLM makes full use of logically related or connected directed reasoning paths in historical data or recorded storage information, explores the optimal reasoning trajectory through an efficient planning reasoning framework, and significantly improves the accuracy of semantic understanding and recommendation.

[0066] The method of the present invention uses the optimal reasoning trajectory automatically generated by LLM to construct a preference data set. Based on the preference data set, the direct preference optimization algorithm (DPO) is used to further optimize the LLM policy model. DPO directly optimizes the policy model on the user's preference data set by defining a preference loss function, without the need for reward modeling or reinforcement learning framework, thereby comprehensively improving the execution and optimization efficiency of the method. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1 This is a flow chart of a search recommendation method for a weighted directed inference tree set generated based on an inference trajectory in this embodiment;

[0068] Figure 2 A schematic diagram of a search recommendation method for a weighted directed inference tree set generated based on an inference trajectory in this embodiment;

[0069] Figure 3 A schematic diagram of the complete reasoning path is generated for this implementation. DETAILED DESCRIPTION

[0070] In order to facilitate the understanding of the present application, the specific embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings and embodiments. The following embodiments are used to illustrate the present invention, but are not intended to limit the scope of the present invention. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thoroughly understood.

[0071] The present invention aims to provide a search recommendation method based on a set of weighted directed inference trees generated by reasoning trajectories. The core idea is to use a large language model (LLM) to automatically generate reasoning trajectories. Considering that LLM training requires a large amount of data support, the existing data often only contains search terms and final recommendation results, lacking information about the intermediate reasoning process. Therefore, a small cardinality complete data set containing existing reasoning paths is first collected, that is, 0.5% to 1% of the LLM training data, and a set of weighted directed inference trees containing rich semantic information is constructed based on the collected data; then, with the help of the planning and reasoning capabilities of LLM, LLM is allowed to generate a complete reasoning trajectory to reach the reasoning scheme based on the search terms and final recommendation results under self-supervision, that is, to generate a reasoning path from the search terms to the output node in the weighted directed inference tree, so as to determine the precise search recommendation process. According to the generated complete reasoning trajectory, a preference data set is constructed. Based on the preference data set, the Direct Preference Optimization (DPO) algorithm is used to feedback optimize the LLM, fully integrating semantic information and planning reasoning capabilities, further improving the accuracy of trajectory generation and final recommendation result prediction, so that the generation of the final recommendation result no longer depends solely on keyword matching or rule-based retrieval, but allows LLM to mine directed reasoning paths with logical correlation or continuation between the search terms and the final recommendation results, so as to improve the accuracy and stability of the search recommendation technology. The above process comprehensively improves the recommendation quality and robustness of a search recommendation method based on a set of weighted directed reasoning trees generated by reasoning trajectories, providing users with more personalized and high-quality search results and recommended content.

[0072] In the process of self-supervised generation of reasoning trajectories by large models, in order to ensure the correctness of the final recommendation results obtained through autonomous exploration only through known search terms, the strategy adopted is to ensure that the intermediate reasoning steps of each step are correct as much as possible, thereby increasing the accuracy of the recommendation results; and in order to evaluate the accuracy of a certain intermediate reasoning step, the search terms and the intermediate steps that have been inferred as correctly as possible are used as preconditions, and the final recommendation results are predicted based on the preconditions. The correctness of this intermediate reasoning step is judged by comparing the consistency of the predicted final recommendation results with the actual results. This avoids the problem of being unable to evaluate the correctness of the intermediate results by relying solely on induced data containing a small cardinality of complete paths, and at the same time avoids the high cost and potential bias brought about by the manual annotation reasoning process.

[0073] The present embodiment is a search recommendation method for a weighted directed inference tree set generated based on an inference trajectory, such as Figure 1 As shown, the method comprises the following steps:

[0074] Step 1: Collect historical text data in specific business scenarios according to user needs, extract semantic information from the historical text data, and use the extracted semantic information to build a set of weighted directed reasoning trees with semantic information and complete reasoning trajectories;

[0075] Step 1.1: Collect several historical text data in specific business scenarios according to user needs;

[0076] In this embodiment, user needs may come from specific problems or goals in actual business. By communicating with specific users, specific problems or goals in actual business are determined and corresponding text information is collected, providing a basis for the subsequent construction of weighted directed reasoning trees and supporting the application of the reasoning tree in actual scenarios. Since the method proposed in this embodiment has a wide range of application scenarios, the specific business scenario should be determined according to user needs, and historical text data or feedback should be collected for the business scenario, where the business scenario includes but is not limited to real application needs such as product recommendation, medical assistance, and teaching systems. For example, in the product recommendation scenario, it is possible to consider collecting users' historical browsing records, purchase records, and preference information; in the medical assistance scenario, it is possible to consider collecting patients' medical information, diagnosis results, and treatment plans; and in the teaching system, it is possible to consider collecting students' learning records, performance data, and student feedback; the collected text information is used to construct a set of weighted directed reasoning trees with semantic information, and is used as a small amount of induced data for LLM self-supervision to generate reasoning trajectories.

[0077] Step 1.2: Clean the collected historical text data, take each cleaned historical text data as a data sample and construct a data sample set.

[0078] The data cleaning includes: format standardization, data deduplication, missing data supplementation, outlier processing, data accuracy verification and irrelevant data removal.

[0079] In this embodiment, taking the medical diagnosis scenario as an example, real historical text data related to this field is collected, including a series of unstructured data such as medical case records, patient information, and medical follow-up visits. In order to ensure the quality and consistency of the original data, it is necessary to clean the collected real historical text data, including: format standardization, deduplication, missing data processing, outlier processing, data accuracy verification, and irrelevant data removal. First, the collected data is converted into a unified format, including: unified date format, consistent naming specifications, unified data units, consistent data encoding, and data format standardization, etc., for subsequent processing and analysis. For example, the date format is unified into YYYY-MM-DD, the named entities use a consistent naming specification, the data units are unified into kilograms, millimeters of mercury, etc., a unified encoding specification such as ICD-10 encoding is used, and data format consistency is ensured, such as text using UTF-8 encoding, numerical values ​​using floating point numbers, etc. For example, for medical diagnosis record data, the date of consultation can be standardized, such as converting "May 13, 2024" to "2024-05-13"; standardize the patient's name and unify it into a consistent spelling, such as unifying "John Smith" and "JohnS." into "John Smith"; unify the disease name using ICD-10 coding, and code "hypertension" as "I10"; ensure that the diagnosis results are described using a unified diagnostic standard to avoid the use of unclear or ambiguous diagnostic terms. Identify and delete duplicate data entries to avoid analysis bias caused by data duplication, and handle missing data, using methods such as filling and interpolation to ensure the integrity and accuracy of the data. At the same time, handle outliers, identify and handle values ​​that exceed a reasonable range or data that does not conform to the actual situation to avoid the impact of outliers on the analysis results. Next, verify the accuracy of the data and ensure the credibility of the data by comparing it with other data sources or review by professionals. Finally, clear irrelevant data and delete data that is irrelevant or irrelevant to the analysis target to improve the quality and efficiency of the data set. These data cleaning steps ensure the quality and consistency of the data and provide a reliable data foundation for subsequent entity relationship extraction.

[0080] Step 1.3: Use the Universal Information Extraction (UIE) model to extract information from all data samples in the data sample set, and use the pre-trained model to convert the extracted information into a text vector representation with semantic information.

[0081] Step 1.3.1: For the i-th data sample in the data sample set, use the information extraction model UIE to extract entities, relationships between entities, and key information used to judge the importance of entities and the importance of relationships between entities from the data sample; where i = {1,…,n}, n represents the number of data samples in the data sample set.

[0082] In this embodiment, key information refers to information that is of great significance or plays a decisive role in the reasoning process, and can help the reasoning tree to more accurately reflect the actual situation and reasoning rules.

[0083] Step 1.3.2: Take each extracted entity as a node and use the extracted entities to construct a node set N; take the relationship between each extracted entity as a directed edge and use the relationship between the extracted entities to construct a directed edge set E; use the extracted key information to set a weight in the range of [0,1] for each node and each directed edge and construct a weight set W.

[0084] The nodes are divided into: input nodes, intermediate nodes and output nodes.

[0085] In this embodiment, the node is used to represent the reasoning step or reasoning condition; the reasoning step refers to each operation or judgment performed in the process of reasoning or decision-making; the reasoning condition refers to the premise or assumption that needs to be met in the reasoning process. Nodes are divided into: input nodes, intermediate nodes and output nodes; among which the input node refers to the premise in the reasoning process, and the first entity extracted from the data sample is used as the input node, that is, during training, the input node is the corresponding first node in each data sample after data cleaning; during testing or application, the input node is the specific requirement input by the user, that is, the search term, and the input node is used as the root node of the weighted directed reasoning tree. The intermediate node represents the intermediate reasoning step generated according to the reasoning rule, which is used to connect the input node and the output node. The output node represents the final decision result of the reasoning.

[0086] In this embodiment, directed edges are used to represent the dependency between reasoning steps or reasoning conditions. Weights are used to represent the relevance of the relationship between nodes or the importance of the relationship in the reasoning process.

[0087] Step 1.3.3: Use the pre-trained model to convert the node set N, the directed edge set E, and the weight set W from text representation to a text vector representation containing semantic information, and obtain the converted node set N i , the converted directed edge set E i And the converted weight set W i .

[0088] In this embodiment, by using existing pre-trained models such as BERT, GPT, etc., nodes, directed edges and weights are converted from textual representations of natural language descriptions that are easy for humans to understand into textual vector representations containing rich semantic information that are convenient for calculation and analysis in the inference tree. It can be ensured that nodes, directed edges and weights not only have a tree structure relationship, but also contain rich semantic information, so that the subsequently constructed weighted directed inference tree set can better express the logical structure and textual semantics between nodes.

[0089] The converted node set N i Denoted as: N i ={n1,…,n j ,…,n m}, where n1 represents the text vector representation of the first node; n j Represents the text vector representation of the jth node; n m Represents the text vector representation of the m-th node.

[0090] In this embodiment, because in a weighted directed inference tree, the node plays the role of promoting the inference process. For example, if a medical diagnosis system scenario is considered, the inference steps may be observations of patient symptoms, results of medical tests, and assumptions about the condition, and the inference conditions may be some restrictions, constraints, or requirements on the characteristics of the problem or task; for example, in a product recommendation system, the conditions may include information such as the user's purchase history, preferences, and location. In order to convert the inference steps and conditional information into semantic information in the nodes, this can be achieved by using natural language descriptions, labels, or other symbols. Each inference tree clearly shows the structure and logical relationship between all nodes in the inference tree.

[0091] The converted directed edge set is recorded as: E i ={e1,…,e h ,…,e k}, where e1 represents the text vector representation of the first directed edge; e h The text vector representation of the h-th directed edge; e k The text vector representation of the k-th directed edge.

[0092] In this embodiment, the dependency relationship between the reasoning steps or conditions is converted from a text form representation described in natural language to a text vector representation with directed edges using a pre-trained model, wherein the dependency relationship between the reasoning steps or conditions is similar to the relationship form in the entity relationship triple. For example, the relationship between the two entities "Patient No. 1" and "Ward 201" should be a "live" relationship, and this relationship has a clear direction from "Patient No. 1" to "Ward 201", and the direction is immutable.

[0093] The converted weight set W i Denoted as: in represents the set of directed edge weights after conversion, and in The text vector representation representing the weight of the first directed edge; The text vector representation representing the weight of the h-th directed edge; The text vector representation representing the weight of the k-th directed edge; represents the set of node weights after conversion, and in The text vector representation of the first node weight; The text vector representation representing the weight of the jth node; A text vector representation of the weight of the mth node.

[0094] Step 1.4: Use the text vector representation with semantic information to construct a set of weighted directed reasoning trees with semantic information and containing complete reasoning trajectories.

[0095] Step 1.4.1: Use the transformed node set N i , the converted directed edge set E i And the converted weight set W i Construct a weighted directed inference tree T for the i-th data sample i , denoted as T i =(N i ,E i ,W i ).

[0096] Step 1.4.2: Construct a weighted directed inference tree for each data sample in the data sample set, and use the weighted directed inference trees of all data samples to construct a set of weighted directed inference trees with semantic information and containing complete inference trajectories, denoted as T = {T1,…,T i ,…,T n}, where T1 and T n They respectively represent the first weighted directed inference tree and the nth weighted directed inference tree in the set of weighted directed inference trees.

[0097] In this embodiment, the process corresponding to the above step 1 is to take the historical text data collected according to the corresponding business as a sample, clean each historical text data in the sample and input it into a general information extraction model, capture the semantic dependencies within the data sample through the attention mechanism, and identify information such as entities and relationships related to reasoning, and then use the pre-trained model to convert the nodes, directed edges and weights into text vector representations with semantic information, and then construct a weighted directed reasoning tree, repeat the above operation until the weighted directed reasoning tree of all historical text data in the entire sample is obtained, and finally a set of weighted directed reasoning trees with semantic information and containing a complete reasoning trajectory is obtained.

[0098] Step 2: The weighted directed inference trees in the set of weighted directed inference trees that have semantic information and contain complete inference trajectories are converted into vector representations using the method of vector space mapping and inference path fusion.

[0099] Step 2.1: For the i-th weighted directed inference tree T in the set of weighted directed inference trees with semantic information and containing complete inference trajectories i , is T i The node set N in i Define a transfer matrix M n , is T i The set of directed edges E in i Define a transfer matrix M e ; wherein the transfer matrix M n and the transfer matrix M e Independent of each other;

[0100] In this embodiment, since the node set N of the weighted directed inference tree i and the directed edge set E i They are located in their own vector spaces, so nodes and edges have obvious semantic differences. Two independent transfer matrices are needed to map nodes and edges to the same vector space, so as to fully capture the reasoning and logical relationships between nodes and edges while retaining the textual semantic information of nodes and edges. And all nodes in the same weighted directed inference tree share a transfer matrix M n , all directed edges also share a transfer matrix M e This can not only reduce the number of parameters, improve the generalization ability of the model, and reduce the risk of overfitting, but also simplify the model structure, making it easier to understand and explain. In addition, the transfer matrix M n and M eThe initial value of is defined by random initialization, and its dimension is d×d, where d is the dimension of the vector representation of the node and the vector representation of the edge. The above transfer matrix is ​​one of the parameters that need to be learned in the model. It is continuously optimized during the training process so that the model can better capture the semantic relationship in the knowledge graph or tree structure.

[0101] Step 2.2: Define the projection function and use the projection function and transfer matrix M n and the transfer matrix M e , the node set N i and the directed edge set E i Project them into the same vector space to obtain the projected node vector representation and directed edge vector representation;

[0102] The projection function is expressed as:

[0103]

[0104] where n x is the node set N i The nodes participating in the projection; To use the transfer matrix M n For x The node vector representation obtained after projection; e y is the directed edge set E i The directed edges participating in the projection; To use the transfer matrix M e For y The directed edge vector representation obtained after projection; and is a projection into the same vector space.

[0105] Step 2.3: Based on the projected node vector representation and directed edge vector representation, calculate the node vector representation that integrates the node semantic information and the reasoning path information for all nodes in the weighted directed reasoning tree.

[0106] The calculation method of the node vector representation of the fused node semantic information and the reasoning path information is as follows: for an input node in a weighted directed reasoning tree, the node vector representation after the input node is projected is used as the node vector representation of the fused node semantic information and the reasoning path information of the input node; for an intermediate node or an output node in a weighted directed reasoning tree, the calculation method of the node vector representation of the fused node semantic information and the reasoning path information of the intermediate node or the output node is as follows:

[0107]

[0108] in is the node vector representation of the fusion node semantic information and reasoning path information of the intermediate node or output node; for node n x The node vector obtained after projection is represented as express The weight of semantic information in express The parent node of is represented by the node vector after projection; px Indicates from arrive The directed edges of Represents a directed edge e px Directed edge vector representation after projection; To represent a directed edge The weight of semantic information in .

[0109] In this embodiment, although the nodes and directed edges have been projected into the same vector space, they are still in a discrete isolated state. In order to represent the reasoning relationship between nodes and directed edges, each node is represented as a new node vector representation containing the reasoning path information in its corresponding reasoning tree, that is, a node vector representation that fuses the node semantic information and the reasoning path information. For each node in the weighted directed reasoning tree, a new node vector representation containing the information of all nodes and directed edges on the previous path to the node is calculated on the reasoning path of the node. Specifically, since the input node has no parent node and edges pointing to them, the new node vector representation of the input node is the same as the vector representation obtained after mapping; for non-input nodes, its new node vector representation is a vector representation obtained by reasoning the node vector representation of the parent node of the node after projection and the directed edges pointing to the node, and the obtained vector representation is weighted and summed with the vector representation of the node itself with semantic information to obtain a vector representation that fuses the reasoning path. In fact, the vector representation that fuses the reasoning path will contain information about all nodes and edges before the node in the reasoning path. Specifically, for the node and its parent node Introduce weights to balance nodes with only semantic information Parent Node With directed edges The contribution of this paper is to incorporate the semantic information of nodes and directed edges into the calculation in the form of weights.

[0110] Step 2.4: Convert the weighted directed inference tree T i The node vector representations of the fused node semantic information and reasoning path information of all nodes in are weighted and summed according to the weights to obtain the vector representation of the weighted directed reasoning tree.

[0111] The expression of the vector representation of the weighted directed inference tree is:

[0112]

[0113] in is the vector representation of the i-th weighted directed inference tree.

[0114] In this embodiment, the contribution of semantic information and reasoning path information is balanced through weights to capture the reasoning relationship and generate a more comprehensive representation.

[0115] Step 3: Use Large Language Model (LLM) as the policy model θ , a large model-based reasoning trajectory generation method is adopted, and the complete reasoning path is generated using the vector representation of the strategy model and the weighted directed reasoning tree; where θ is the parameter of the strategy model.

[0116] In this embodiment, based on the vector representation of the weighted directed inference tree, a method for generating inference trajectories based on LLM is designed, so that LLM generates a complete inference path according to the search terms and recommendation results under self-supervision, that is, a complete inference trajectory from the search terms to the final inference results, so as to determine the accurate search recommendation process and facilitate the subsequent construction of the preference data set. Since steps 1-2 are all for processing historical text data collected in specific business scenarios, specifically, in the process of search recommendation, the user input is one or more search terms, and the output obtained is only the final recommendation result, but lacks the intermediate inference path, and the cost of manual annotation is relatively high. If LLM itself is used for annotation, the effect is not good, and the data volume requirement of LLM training cannot be met. Therefore, it is necessary to perform data enhancement on the data containing only the search terms and recommendation results, and construct a preference data set for optimizing LLM.

[0117] Step 3.1: Get several groups of search terms x and the recommended results y corresponding to each group of search terms.

[0118] In this embodiment, the search terms input by the user and the recommendation results generated by the search recommendation system for each group of search terms are collected from the existing search recommendation system, wherein the group of search terms input by the user may be a single word or a paragraph containing multiple words.

[0119] Step 3.2: Clean the acquired search terms, use the pre-trained model to convert the cleaned search terms and the recommended results corresponding to each group of search terms into vector representations, and use the converted vector representations to construct a training set where x (α) represents the vector representation of the αth group of search terms after conversion; y (α) It represents the converted vector representation of the recommendation results corresponding to the αth group of search terms.

[0120] In this embodiment, data cleaning is performed on the collected one or more search terms, including format standardization, deduplication, missing data processing, outlier processing, data accuracy verification, and irrelevant data removal, etc., to ensure the accuracy and simplicity of the input text; in addition, the search terms and final recommendation results need to be converted into vector representation using a pre-trained model, and the conversion process is the same as step 1.3. Use the converted vector representation to construct a training set x (α) The vector representation after the conversion of the αth group of search terms is obtained. Specifically, if the group of search terms contains v search terms, the prompt of LLM is concatenated with multiple search terms, recorded as prompt+search term 1|search term 2|search term 3...search term v, and then the concatenated search terms are converted into vector representations. The prompt is used to guide LLM to output the answer. Generally, the prompts of different LLMs are different, and can also be specified manually, as long as it helps the model output better results. It is usually consistent with the prompt used when LLM itself is trained. (α) The vector representation of the recommendation results corresponding to the αth group of search terms is input into LLM. (α) The final recommendation result, i.e. the label, is obtained and used as the end point of the reasoning path.

[0121] Step 3.3: Train the training set x in (α) As the starting point of the reasoning path, y (α) As the end point of the reasoning path, the training set Input strategy model π θ , generating a complete reasoning path.

[0122] In this embodiment, if Figure 2 As shown, in order to generate a complete and effective reasoning trajectory to establish accurate reasoning associations, LLM is used as the strategy model π θ For example, models such as LLaMA and ChatGLM are used to explore the reasoning path from one or more input search terms to the final recommendation result in the weighted directed reasoning tree. Specifically, let LLM start from x (α)Start from the source and use it as the starting point of a complete reasoning path; then, explore and gradually generate the intermediate nodes of the reasoning path, hoping to find a reasoning path from the starting point to the end point. In the process of reasoning to the end point, several intermediate nodes will be experienced, but in the process of reasoning, it is impossible to judge whether the intermediate node to be generated is the correct reasoning process, and if the intermediate node is wrong during the reasoning process, it is very likely that the output node reached in the end will be wrong; this is a planning problem. In order to achieve this goal, it is necessary to explore around each current intermediate node, let LLM use the information before the current intermediate node to perform estimated reasoning, and generate a reasoning path from the current intermediate node to the predicted end point; repeat multiple groups of estimates, and select the solution with the highest expected reward as the next intermediate node of the current intermediate node, so as to select a suitable reasoning path to reach the final recommendation result of the end point.

[0123] Step 3.3.1: Generate an intermediate node on the reasoning path using the vector representation of the starting point of the reasoning path and the vector representation of the weight of the starting point of the reasoning path and use it as the current intermediate node.

[0124] Step 3.3.2: Determine whether the current intermediate node is the end point of the reasoning path; if so, generate a complete reasoning path; if not, execute step 3.3.3.

[0125] Step 3.3.3: Input the vector representations of all nodes, all directed edges, and all weights in the reasoning path from the starting point to the current intermediate node into the strategy model, use the strategy model to gradually infer the leaf nodes based on the known parts in the reasoning path, and generate an estimated reasoning path from the current intermediate node to the leaf node.

[0126] In the search recommendation task, a complete and effective reasoning path is crucial to establish accurate reasoning associations in the search recommendation process, because the starting point and end point of the reasoning path are already given. Here, we only need to generate intermediate nodes that are as consistent as possible with the actual recommendation results, and finally build a complete reasoning path. Specifically, for a certain intermediate node to be generated in the current reasoning path, assume that its previous node is the current intermediate node. Since the current intermediate node has been determined in the reasoning path, the vector representation of the current node and all its previous nodes, directed edges, and weights is used as the input of the LLM, and an advance estimate from the current node to the leaf node is performed. Finally, an estimated reasoning path from the current node to the final predicted leaf node is generated; this is a process of using step-by-step reasoning to generate each node on the estimated reasoning path. The leaf node here is the search recommendation result inferred by the LLM based on the current known conditions of the input, but the leaf node is not necessarily the end point y of the known reasoning path. (α) Consistent.

[0127] Step 3.3.4: Use the method of vector space mapping and reasoning path fusion to convert the estimated reasoning path into a vector representation to obtain the vector representation P of the estimated reasoning path.

[0128] In this embodiment, the same vector representation conversion process as step 2 is performed on the estimated reasoning path to obtain the vector representation P of the estimated reasoning path, and the nodes, directed edges and weights in the estimated reasoning path are converted into a branch in the vector representation of the weighted directed reasoning tree. Because a reasoning path only involves one branch, the vector representation of this branch is used to capture the semantic structure information of the path.

[0129] Step 3.3.5: Calculate the semantic structure similarity between the vector representation P of the estimated reasoning path and the vector representations of all weighted directed reasoning trees in the weighted directed reasoning tree set, and use the obtained semantic similarity as the expected reward of the current intermediate node.

[0130] The calculation method of the semantic structure similarity is:

[0131]

[0132] in The vector representation P of the estimated reasoning path and the vector representation of the i-th weighted directed reasoning tree The semantic structure similarity of The value range of is [-1,1], and The closer the value is to 1, the better the P and The more similar the semantic structures are, The closer the value is to -1, the better the P and The more dissimilar the semantic structures are; The vector representation P of the estimated reasoning path and the vector representation of the i-th weighted directed reasoning tree The dot product of ‖P‖ represents the vector of the estimated reasoning path and the modulus of P; The vector representation of the i-th weighted directed inference tree Model.

[0133] In this embodiment, if Figure 3 As shown, the semantic structural similarity between the vector representation of the estimated reasoning path and the vector representation of all weighted directed reasoning trees in the weighted directed reasoning tree set is calculated respectively, and the semantic structural similarity between the vector representation of the estimated reasoning path and each weighted directed reasoning tree is obtained. The semantic similarity is used as the expected reward of the intermediate node to evaluate the semantic coherence and correctness from the current node to the leaf node, that is, the value of the intermediate node in the entire reasoning path. The calculation of semantic similarity can use cosine similarity to measure the similarity between the vector representation of the estimated reasoning path and the vector representation of all weighted directed reasoning trees in the set.

[0134] Step 3.3.6: Determine whether the number of estimated reasoning paths is greater than the preset maximum number of estimated reasoning paths. If not, return to step 3.3.3; if so, select the next node of the current intermediate node in the estimated reasoning path with the highest expected reward as the child node of the current intermediate node, and then use the child node as the new current intermediate node and return to step 3.3.2.

[0135] In this embodiment, the maximum number of estimated reasoning paths is set to 20. The selection of intermediate nodes can be regarded as a heuristic search process. The goal is to select the optimal intermediate node, which is achieved by executing multiple groups of simulated reasoning. Each simulated reasoning will select the next possible intermediate node of the current intermediate node and calculate the expected reward of the current intermediate node. The expected reward of each current intermediate node is used as the evaluation indicator for selection, and the next node in the estimated reasoning path with the highest expected reward is selected as the next intermediate node of the current intermediate node.

[0136] Step 3.3.7: Build a set of possible reasoning paths using all estimated reasoning paths except the complete reasoning path

[0137] Step 3.4: For the training set All the search terms x and the recommended results y corresponding to the search terms x in each generate a complete reasoning path.

[0138] Step 4: Build a preference dataset based on the complete reasoning path

[0139] The preference dataset The construction method is: for the training set x is the starting point of the reasoning path (α) , and the resulting complete reasoning path is used as (α) The corresponding correct reasoning path At the same time, from the estimated reasoning path set Select at least one estimated reasoning path from (α) The corresponding incorrect reasoning path Using x (α) , and Construct a set of preference data, denoted as A set of preference data is constructed for each set of vector representations of search terms in the training set, and a preference data set is constructed using all the obtained preference data.

[0140] In this embodiment, the preference dataset is constructed based on the complete reasoning path generated in step 3. A set of preference data in is represented as in and All in the estimated reasoning path set in; and in They represent the 0th, 1st, 2nd and zth estimated reasoning paths respectively.

[0141] Step 5: Based on the preference dataset Use direct preference optimization algorithm to optimize the strategy model and obtain the optimized strategy model π * ;

[0142] The optimization objective function of the direct preference optimization algorithm is:

[0143]

[0144] in is the optimization objective function of the direct preference optimization algorithm; π ref is the reference strategy model; To represent the preference data set The preferred data (x, τ w ,τ l )The mathematical expectation of all possible values, τ w For the correct reasoning path, τ l is the incorrect inference path; σ is the hyperparameter used to represent the confidence interval; β is the hyperparameter in the optimization objective function; π θ (τ w |x) means that given the search term x, the strategy model π θ Take the correct reasoning path τ w The possibility of ref (τ w |x) means that given the search term x, the reference strategy model π ref Take the correct reasoning path τ w The possibility of θ (τ l |x) means that given the search term x, the strategy model π θ Taking incorrect reasoning path τ l The possibility of ref (τ l |x) means that given the search term x, the reference strategy model π ref Taking incorrect reasoning path τ l possibility.

[0145] In this embodiment, in order to obtain an optimized strategy model π that can provide search recommendation results with better logic and more in line with human preferences,* , which essentially solves a classification problem on preference data, is a simpler and more direct training method that does not rely on explicit reward modeling or reinforcement learning. The traditional method uses a preference model to train a reward model, and then trains a policy model based on the reward model. Unlike the traditional method, the direct preference optimization algorithm directly defines the preference loss according to the policy, that is, the optimization objective function of the direct preference optimization algorithm, and uses a simple binary cross entropy objective to optimize the policy model. When the value of the optimization objective function is as small as possible, the obtained policy model is better and can output more satisfactory recommendation results.

[0146] In reinforcement learning, the policy model is usually learned by maximizing the expected reward, while the reference policy model may be a simple fixed model. By comparing the target policy model and the reference policy model, the quality of the target policy model can be evaluated and the training direction of the target policy model can be guided. In the process of optimizing the policy model, the policy model is optimized by updating the parameter θ. The policy model to be optimized is used as the reference policy model, which is equivalent to a reference object in physics and is a benchmark in the model training process. That is to say, the reference policy model will not be updated during the optimization process and will be regarded as a fixed benchmark; the optimization objective function of the direct preference optimization algorithm Typically used in reinforcement learning, this optimization objective function compares the policy model π θ and the reference strategy model π ref In the preference dataset The performance of the policy model is evaluated by the performance on the policy model; the hyperparameter β is used to balance the policy model π θ and the reference strategy model π ref The importance of , in the optimization objective function, affects the difference between the target strategy model and the reference strategy model. Usually, the choice of β needs to be adjusted through experiments. From formula (6), it can be seen that the optimization objective function increases the correct reasoning path τ in the preference data. w The possibility of and reduces non-preferred data, that is, incorrect reasoning path τ l The possibility of; and use the optimization objective function to train the initial strategy model π θ .

[0147] Step 6: Obtain the search terms provided by the user and input the optimized strategy model π * In the above example, we use the optimized strategy model π * Get the final recommended results for the search term.

[0148] In this embodiment, the optimized strategy model is applied to a real search recommendation system, so that the strategy model generates a complete reasoning path based on one or more search terms input by the user to achieve a more complete reasoning process, and obtains search recommendation results that are in line with human preferences and more efficient. The purpose is to use the optimized strategy model to build a complete search recommendation system model, generate a complete reasoning path for the input search terms to achieve better search recommendations.

[0149] Step 6.1: Get the search term q provided by the user and perform data cleaning, and use the pre-trained model to vectorize the cleaned search term, and concatenate the obtained vector representation with the prompt prompt in the optimized strategy model to obtain the normalized search term vector representation q′.

[0150] In this embodiment, the method of performing data cleaning and vector representation operations of the pre-trained model on the search term q is the same as step 1.3. The prompt of the LLM and the vector representation of the search term are concatenated to obtain the vector representation q′ of the normalized search term. q′ is mainly used to remind the model to gradually generate an inference path.

[0151] Step 6.2: Input the normalized retrieval term vector representation q′ into the optimized strategy model π * Starting from q′, generate u candidate reasoning paths to the output nodes of each weighted directed reasoning tree in the set of weighted directed reasoning trees, and construct a set of candidate reasoning paths O = {o1, o2, ..., o u}; where o1, o2, ..., o u They are the 1st, 2nd and uth candidate reasoning paths in the candidate reasoning path set respectively.

[0152] Step 6.3: Calculate the conditional probability scores of all candidate reasoning paths in the candidate reasoning path set O, and sort all candidate reasoning paths in descending order according to the conditional probability scores to obtain an ordered candidate path set. in They are the 1st, 2nd and uth ordered candidate paths in the ordered candidate path set respectively.

[0153] In this embodiment, all candidate reasoning paths in the candidate reasoning path set O are calculated in the optimized strategy model π * The normalized retrieval term vector represents the conditional probability score under q′, and the conditional probability score is used to feedback the quality of the candidate reasoning path.

[0154] Step 6.4: From the ordered candidate path set O * Select the first S ordered candidate paths from the query, take the endpoints of the first S ordered candidate paths as the S recommended results for the search term q, and construct a recommended result set Where S is the preset maximum number of recommendations; These are the recommendation results corresponding to the 1st, 2nd and Sth ordered candidate paths respectively.

[0155] In this embodiment, the obtained S recommendation results constitute the final search recommendation scheme for the search term q, which is used for direct recommendation to the user.

[0156] Step 6.5: Send the recommendation result set R to the user, and the user selects a recommendation result from the recommendation result set R as the final recommendation result, and adds the search term q and the final recommendation result to the training set. Used to continuously optimize the strategy model.

[0157] In this embodiment, the user selects a recommendation result from the recommendation result set R as the final recommendation result according to personal needs, and uses the search term provided by the user and the final recommendation result selected by the user as new training set data to train the strategy model, thereby updating the preference data set. Continuously optimize the strategy model to form a closed-loop optimization process. The process of this optimization process is consistent with steps 3-5 to continuously improve the performance of the strategy model and the accuracy of recommendations during use.

[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope defined by the claims of the present invention.

Claims

1. A search recommendation method based on a weighted directed inference tree set generated based on inference trajectories, characterized in that: The method comprises the following steps: Step 1: Collect historical text data in specific business scenarios according to user needs, extract semantic information from the historical text data, and use the extracted semantic information to build a set of weighted directed reasoning trees with semantic information and complete reasoning trajectories; Step 2: Using the method of vector space mapping and reasoning path fusion, the weighted directed reasoning tree in the set of weighted directed reasoning trees with semantic information and containing complete reasoning trajectories is converted into a vector representation; Step 3: Use the big model as the policy model π θ , adopts the reasoning trajectory generation method based on the large model, and uses the strategy model and the vector representation of the weighted directed reasoning tree to generate a complete reasoning path; where θ is the parameter of the strategy model; Step 4: Build a preference dataset based on the complete reasoning path Step 5: Based on the preference dataset Use the direct preference optimization algorithm to optimize the strategy model and obtain the optimized strategy model π * ; Step 6: Obtain the search terms provided by the user and input the optimized strategy model π * In the above example, we use the optimized strategy model π * Get the final recommended results for the search term.

2. The search recommendation method for a weighted directed inference tree set generated based on inference trajectories according to claim 1 is characterized in that: The step 1 further comprises: Step 1.1: Collect several historical text data in specific business scenarios according to user needs; Step 1.2: Clean the collected historical text data, take each cleaned historical text data as a data sample and construct a data sample set; Step 1.3: Use the information extraction model UIE to extract information from all data samples in the data sample set, and use the pre-trained model to convert the extracted information into a text vector representation with semantic information; Step 1.4: Use the text vector representation with semantic information to construct a set of weighted directed reasoning trees with semantic information and containing complete reasoning trajectories.

3. The search recommendation method for a weighted directed inference tree set generated based on inference trajectories according to claim 2 is characterized in that: The step 1.3 further comprises: Step 1.3.1: For the i-th data sample in the data sample set, use the information extraction model UIE to extract entities, relationships between entities, and key information used to judge the importance of entities and the importance of relationships between entities from the data sample; where i = {1,…,n}, n represents the number of data samples in the data sample set; Step 1.3.2: Take each extracted entity as a node and use the extracted entities to construct a node set N; take the relationship between each extracted entity as a directed edge and use the relationship between the extracted entities to construct a directed edge set E; use the extracted key information to set a weight in the range of [0,1] for each node and each directed edge and construct a weight set W; The nodes are divided into: input nodes, intermediate nodes and output nodes; Step 1.3.3: Use the pre-trained model to convert the node set N, the directed edge set E, and the weight set W from text representation to a text vector representation containing semantic information, and obtain the converted node set N i , the converted directed edge set E i And the converted weight set W i ; The converted node set N i Denoted as: N i ={n1,…,n j ,…,n m }, where n1 represents the text vector representation of the first node; n j Represents the text vector representation of the jth node; n m Represents the text vector representation of the mth node; The converted directed edge set is recorded as: E i ={e1,…,e h ,…,e k }, where e1 represents the text vector representation of the first directed edge; e h The text vector representation of the h-th directed edge; e k The text vector representation of the k-th directed edge; The converted weight set W i Denoted as: W i = {W i e ,W i n }; where W i e represents the set of directed edge weights after conversion, and in The text vector representation representing the weight of the first directed edge; The text vector representation representing the weight of the h-th directed edge; The text vector representation of the weight of the k-th directed edge; W i n represents the set of node weights after conversion, and in The text vector representation of the first node weight; The text vector representation representing the weight of the jth node; A text vector representation of the weight of the mth node.

4. The search recommendation method for a weighted directed inference tree set generated based on inference trajectories according to claim 3 is characterized in that: The step 1.4 further comprises: Step 1.4.1: Use the transformed node set N i , the converted directed edge set E i And the converted weight set W i Construct a weighted directed inference tree T for the i-th data sample i , denoted as T i =(N i ,E i ,W i ); Step 1.4.2: Construct a weighted directed inference tree for each data sample in the data sample set, and use the weighted directed inference trees of all data samples to construct a set of weighted directed inference trees with semantic information and containing complete inference trajectories, denoted as T = {T1,…,T i ,…,T n }, where T1 and T n They respectively represent the first weighted directed inference tree and the nth weighted directed inference tree in the set of weighted directed inference trees.

5. The search recommendation method for a weighted directed inference tree set generated based on inference trajectories according to claim 4 is characterized in that: The step 2 further comprises: Step 2.1: For the i-th weighted directed inference tree T in the set of weighted directed inference trees with semantic information and containing complete inference trajectories i , is T i The node set N in i Define a transfer matrix M n , is T i The directed edge set E in i Define a transfer matrix M e ; wherein the transfer matrix M n and the transfer matrix M e Independent of each other; Step 2.2: Define the projection function and use the projection function and transfer matrix M n and the transfer matrix M e , the node set N i and the directed edge set E i Project them into the same vector space to obtain the projected node vector representation and directed edge vector representation; The projection function is expressed as: where n x is the node set N i The nodes participating in the projection; To use the transfer matrix M n For x The node vector representation obtained after projection; y is the directed edge set E i The directed edges participating in the projection; To use the transfer matrix M e For y The directed edge vector representation obtained after projection; and In the same vector space; Step 2.3: Based on the projected node vector representation and directed edge vector representation, calculate the node vector representation of all nodes in the weighted directed reasoning tree that integrates the node semantic information and the reasoning path information; The calculation method of the node vector representation of the fused node semantic information and the reasoning path information is as follows: for an input node in a weighted directed reasoning tree, the node vector representation after the input node is projected is used as the node vector representation of the fused node semantic information and the reasoning path information of the input node; for an intermediate node or an output node in a weighted directed reasoning tree, the calculation method of the node vector representation of the fused node semantic information and the reasoning path information of the intermediate node or the output node is as follows: in It is the node vector representation of the fusion node semantic information and reasoning path information of the intermediate node or output node; for node n x The node vector obtained after projection is represented by express The weight of semantic information in express The parent node of is represented by the node vector after projection; px Indicates from arrive ; Represents a directed edge e px Directed edge vector representation after projection; To represent a directed edge The weight of semantic information in Step 2.4: Convert the weighted directed inference tree T i The node vector representations of the fused node semantic information and reasoning path information of all nodes in are weighted and summed according to the weights to obtain the vector representation of the weighted directed reasoning tree.

6. The search recommendation method for a weighted directed inference tree set generated based on inference trajectories according to claim 5, characterized in that: The step 3 further comprises: Step 3.1: Obtain several groups of search terms x and the recommended results y corresponding to each group of search terms; Step 3.2: Clean the acquired search terms, use the pre-trained model to convert the cleaned search terms and the recommended results corresponding to each group of search terms into vector representations, and use the converted vector representations to construct a training set where x (α) represents the vector representation of the αth group of search terms after conversion; y (α) The vector representation after the conversion of the recommendation results corresponding to the αth group of search terms is represented; Step 3.3: Train the training set x in (α) As the starting point of the reasoning path, y (α) As the end point of the reasoning path, the training set Input strategy model π θ , generate a complete reasoning path; Step 3.4: For the training set All the search terms x and the recommended results y corresponding to the search terms x in each generate a complete reasoning path.

7. The search recommendation method for a weighted directed inference tree set generated based on inference trajectories according to claim 6 is characterized in that: The step 3.3 further comprises: Step 3.3.1: Generate an intermediate node on the reasoning path using the vector representation of the starting point of the reasoning path and the vector representation of the weight of the starting point of the reasoning path and use it as the current intermediate node; Step 3.3.2: Determine whether the current intermediate node is the end point of the reasoning path; if so, generate a complete reasoning path; if not, execute step 3.3.3; Step 3.3.3: Input the vector representations of all nodes, all directed edges, and all weights in the reasoning path from the starting point to the current intermediate node into the strategy model, use the strategy model to gradually infer the leaf nodes based on the known parts of the reasoning path, and generate an estimated reasoning path from the current intermediate node to the leaf node; Step 3.3.4: Use the method of vector space mapping and reasoning path fusion to convert the estimated reasoning path into a vector representation, and obtain the vector representation P of the estimated reasoning path; Step 3.3.5: Calculate the semantic structure similarity between the vector representation P of the estimated reasoning path and the vector representations of all weighted directed reasoning trees in the weighted directed reasoning tree set, and use the obtained semantic similarity as the expected reward of the current intermediate node; Step 3.3.6: Determine whether the number of estimated reasoning paths is greater than the preset maximum number of estimated reasoning paths. If not, return to step 3.3.3; if so, select the next node of the current intermediate node in the estimated reasoning path with the highest expected reward as the child node of the current intermediate node, and then use the child node as the new current intermediate node and return to step 3.3.2; Step 3.3.7: Build a set of possible reasoning paths using all estimated reasoning paths except the complete reasoning path 8. The search recommendation method for a weighted directed inference tree set generated based on inference trajectories according to claim 7 is characterized in that: The preferred dataset described in step 4 The construction method is: for the training set x is the starting point of the reasoning path (α) , and the resulting complete reasoning path is used as (α) The corresponding correct reasoning path At the same time, from the estimated reasoning path set Select at least one estimated reasoning path from (α) The corresponding incorrect reasoning path Using x (α) , and Construct a set of preference data, denoted as A set of preference data is constructed for each set of vector representations of search terms in the training set, and a preference data set is constructed using all the obtained preference data.

9. The search recommendation method for a weighted directed inference tree set generated based on inference trajectories according to claim 8, characterized in that: The optimization objective function of the direct preference optimization algorithm described in step 5 is: in is the optimization objective function of the direct preference optimization algorithm; π ref is the reference strategy model; To represent the preference data set The preferred data (x, τ w ,τ l )The mathematical expectation of all possible values, τ w For the correct reasoning path, τ l is the incorrect inference path; σ is the hyperparameter used to represent the confidence interval; β is the hyperparameter in the optimization objective function; π θ (τ w |x) means that given the search term x, the strategy model π θ Take the correct reasoning path τ w The possibility of ref (τ w |x) means that given the search term x, the reference strategy model π ref Take the correct reasoning path τ w The possibility of θ (τ l |x) means that given the search term x, the strategy model π θ Taking incorrect reasoning path τ l The possibility of ref (τ l |x) means that given the search term x, the reference strategy model π ref Taking incorrect reasoning path τ l possibility.

10. The search recommendation method for a weighted directed inference tree set generated based on inference trajectories according to claim 9, characterized in that: The step 6 further comprises: Step 6.1: Get the search term q provided by the user and perform data cleaning, and use the pre-trained model to vectorize the cleaned search term, and then concatenate the obtained vector representation with the prompt in the optimized strategy model to obtain the normalized search term vector representation q′; Step 6.2: Input the normalized retrieval term vector representation q′ into the optimized strategy model π * Starting from q′, generate u candidate reasoning paths to the output nodes of each weighted directed reasoning tree in the set of weighted directed reasoning trees, and construct a set of candidate reasoning paths O = {o1, o2, ..., o u }; where o1, o2, ..., o u They are the 1st, 2nd and uth candidate reasoning paths in the candidate reasoning path set respectively; Step 6.3: Calculate the conditional probability scores of all candidate reasoning paths in the candidate reasoning path set O, and sort all candidate reasoning paths in descending order according to the conditional probability scores to obtain an ordered candidate path set. in They are the 1st, 2nd and uth ordered candidate paths in the ordered candidate path set respectively; Step 6.4: From the ordered candidate path set O * Select the first S ordered candidate paths from the query, take the endpoints of the first S ordered candidate paths as the S recommended results for the search term q, and construct a recommended result set Where S is the preset maximum number of recommendations; These are the recommendation results corresponding to the 1st, 2nd and Sth ordered candidate paths respectively; Step 6.5: Send the recommendation result set R to the user, and the user selects a recommendation result from the recommendation result set R as the final recommendation result. At the same time, the search term q and the final recommendation result are added to the training set D for continuous optimization of the strategy model.

Citation Information

Patent Citations

  • Continuous pedestrian trajectory prediction method based on memory enhancement network

    CN114707722A

  • Managing and measuring semantic coverage in knowledge discovery process

    CN116982037A

  • Selective proposition reasoning system and method

    CN117852652A

  • Intelligent decision support system

    US20200334580A1

Cited By

  • Network hotspot sniffing method and system based on user preference

    CN119760252A

  • Big language model reasoning method and big language model training method

    CN120450050A