GNN-based task graph construction retrieval method, apparatus and device, and medium

By constructing a retrieval method based on a task graph using GNN, the structural defects of large language models in complex task decomposition and path selection are solved, achieving efficient and accurate task planning, adapting to different application scenarios and reducing resource costs.

CN121597684APending Publication Date: 2026-03-03BEIJING GUODIAN ZHISHEN CONTROL TONGDY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511609778.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-05
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing task planning systems based on large language models have structural defects in complex task decomposition and path selection. In particular, they are inefficient in training and inference when dealing with large-scale graph data, and their performance is affected by the complexity of the graph structure and noise.

Method used

A task graph construction retrieval method based on graph neural networks (GNNs) is adopted. By constructing a text attribute task graph, the GNN is used for retrieval, and the task graph construction retrieval results are obtained by combining a preset search strategy. This includes initializing the task graph data structure, preprocessing task execution trajectory data, generating a structured task graph and a text similarity adjacency list, using a pre-trained large language model for encoding processing, and retrieval and matching by the GNN.

Benefits of technology

It significantly improves the accuracy and robustness of task planning, reduces inference latency and resource consumption, supports zero-training deployment and lightweight training, and is adaptable to different application scenarios. In particular, it demonstrates superior accuracy and efficiency compared to existing methods in large-scale task graphs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121597684A_ABST
    Figure CN121597684A_ABST
Patent Text Reader

Abstract

The invention discloses a GNN-based task graph construction and retrieval method, device and equipment and a medium, and relates to the technical field of task graph construction and retrieval, and the method comprises the following steps: constructing a text attribute task graph by using task execution track data; performing retrieval based on a graph neural network according to the text attribute task graph to obtain a graph neural network retrieval result; and obtaining a task graph construction retrieval result based on the graph neural network retrieval result in combination with a preset search strategy. The method can effectively adapt to scenes such as open domain task planning, tool calling path generation and multi-round complex task reasoning, is remarkably superior to existing methods such as large language model reasoning and graph searching on a plurality of task planning reference data sets, and improves the task planning efficiency by formalizing a task planning problem into a decision-making process on a graph structure. The GNN is used for modeling and reasoning the task dependency relationship, and the accuracy, robustness and expandability of task planning are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of task graph construction and retrieval technology, and particularly to a task graph construction and retrieval method, apparatus, device, and medium based on GNN. Background Technology

[0002] In recent years, with the development of Large Language Models (LLMs), task planning methods based on LLMs have gradually emerged. Task graph planning and retrieval, as an important research direction in the field of artificial intelligence, aims to decompose complex user requests into solvable subtasks and find the optimal task execution path through effective retrieval methods. Traditional task planning methods mainly rely on heuristic search algorithms and rule engines, which perform well in handling simple tasks but often struggle with complex multi-step tasks. LLMs can decompose user requests into subtasks through natural language understanding and guide task execution by generating task graphs. However, LLMs have limitations when processing graph-structured data, such as biases in attention mechanisms and the influence of autoregressive loss functions, which may lead to illusions and errors in task graph planning. Furthermore, LLMs typically flatten graph structures into sequential inputs, which may be inconsistent with the inductive bias of graph structures, thus reducing their expressive power.

[0003] Graph Neural Networks (GNNs), as a powerful tool for processing graph data, have gradually become an important branch of artificial intelligence. GNNs learn representations of nodes and edges in graph structures, enabling them to effectively process complex graph data, such as social networks, knowledge graphs, and molecular structures. Their core advantage lies in their ability to capture complex relationships between nodes and update node feature representations through message passing mechanisms. In recent years, GNN research has made significant progress, from early Recurrent Graph Neural Networks (RecGNNs) to Convolutional Graph Neural Networks (ConvGNNs), and then to Graph Autoencoders (GAEs) and Spatio-Temporal Graph Neural Networks (STGNNs), continuously expanding the application scope of GNNs. However, despite their excellent performance in graph data processing, GNNs still face some challenges and limitations in specific application scenarios such as task graph construction and task retrieval. For example, when processing large-scale graph data, the training and inference efficiency of GNNs may be limited, and in some cases, the performance of GNNs may be affected by the complexity of the graph structure and noise.

[0004] Therefore, there is an urgent need to construct retrieval methods, devices, equipment, and media based on the task graph of GNN to address the shortcomings of existing technologies. Summary of the Invention

[0005] The purpose of this invention is to propose a task graph construction and retrieval method, apparatus, device and medium based on GNN, which aims to solve the structural defects of existing task planning systems based on large language models in complex task decomposition and path selection.

[0006] Firstly, to achieve the above objectives, this invention provides a task graph construction and retrieval method based on GNN, comprising the following steps:

[0007] S1. Construct a text attribute task graph using task execution trajectory data;

[0008] S2. Based on the text attribute task graph, perform a search using a graph neural network to obtain the graph neural network search results;

[0009] S3. Based on the retrieval results of the graph neural network and combined with the preset search strategy, obtain the retrieval results of the task graph construction.

[0010] Optionally, S1, using task execution trajectory data, construct a text attribute task graph, including:

[0011] Initialize the task graph data structure, which includes a task link list, a deep-replicated task node list, and a task name list;

[0012] The task execution trajectory data is preprocessed according to the task graph data structure to obtain the initial topology of the task graph;

[0013] Based on the initial topology of the task graph, obtain the structured task graph and the text similarity adjacency table;

[0014] A text attribute task graph is constructed using the structured task graph and the text similarity adjacency list.

[0015] Optionally, based on the initial topology of the task graph, a structured task graph and a text similarity adjacency table are obtained, including:

[0016] Using the initial topology of the task graph, extract task trajectory data;

[0017] Based on the task trajectory and fixed task relationships, deduplication and relationship transformation are performed sequentially to construct a structured task graph;

[0018] Using the initial topological structure of the task graph, obtain a text similarity graph;

[0019] Based on the text similarity graph, a pre-trained large language model is used to obtain the tool text embedding matrix;

[0020] Based on the tool's text embedding matrix, a text similarity adjacency table is constructed using the K-nearest neighbor algorithm.

[0021] Optionally, S2, based on the text attribute task graph, a retrieval is performed using a graph neural network to obtain the graph neural network retrieval results, including:

[0022] Based on the text attribute task graph, obtain the user request;

[0023] The user request is decomposed using a pre-trained large language model to obtain a natural language step sequence;

[0024] Based on the natural language step sequence and the text attribute task graph, the pre-trained large language model is used for encoding to generate step feature matrix and task node feature matrix respectively.

[0025] Based on the feature matrix of the steps and the feature matrix of the task nodes, a retrieval is performed using a graph neural network to obtain the retrieval results.

[0026] Optionally, based on the step feature matrix and the task node feature matrix, a graph neural network is used to perform a search to obtain the graph neural network search results, including:

[0027] The task node feature matrix is ​​input into a graph neural network to obtain the task embedding with fused structural semantics.

[0028] Based on the user request, obtain the actual application scenario, which includes zero-sample scenario and non-zero-sample scenario;

[0029] Determine whether the actual application scenario is a zero-sample scenario. If so, use a simple graph convolution mode to perform global feature smoothing on the task embedding of the fused structural semantics to obtain a smooth task embedding. Calculate the similarity between the step embedding and the task embedding in combination with the step feature matrix and perform the second operation. Otherwise, input the task embedding of the fused structural semantics into a parameterized large language model and train it using a Bayesian personalized ranking loss function to obtain the trained parameterized large language model and perform the first operation.

[0030] The first operation is as follows: based on the task embedding of the step feature matrix and the fusion structure semantics, the similarity between the step embedding and the task embedding is obtained using the trained parameterized large language model, and then the second operation is performed.

[0031] The second operation is as follows: based on the similarity between the embedding in the step and the embedding in the task, obtain a list of candidate tools ranked by similarity as the retrieval result of the graph neural network.

[0032] Optionally, S3, based on the graph neural network retrieval results and a preset search strategy, obtain task graph construction retrieval results, including:

[0033] Based on the actual application scenario, a preset search strategy is obtained, which is either a greedy search strategy or a depth-first search strategy.

[0034] The graph neural network retrieval results are processed according to the preset search strategy to obtain a task list after processing by the preset search strategy;

[0035] The optimal task path is selected from the task list processed by the preset search strategy to obtain the task graph construction retrieval results.

[0036] Optionally, the graph neural network retrieval results are processed according to the preset search strategy to obtain a task list processed by the preset search strategy, including:

[0037] Determine whether the preset search strategy is a greedy search strategy. If so, use the graph neural network retrieval results to filter and obtain candidate tasks, and perform the third operation. Otherwise, according to the graph neural network retrieval results, obtain the starting task and perform the fifth operation.

[0038] The third operation is as follows: based on the text attribute task graph and the candidate tasks, obtain the optimal task and perform the fourth operation;

[0039] The fourth operation is: based on the optimal task and the graph neural network retrieval result, obtain the task list processed by the greedy strategy as the task list processed by the preset search strategy;

[0040] The fifth operation: Based on the initial task and the pre-trained language model, obtain the candidate task score and perform the sixth operation;

[0041] The sixth operation is: based on the candidate task scores, recursively explore and filter according to preset standards to obtain a task list processed by a deep optimization strategy as a task list processed by a preset search strategy.

[0042] Secondly, to achieve the above objectives, the present invention provides a task graph construction and retrieval device based on GNN, comprising: a task graph construction module, a graph neural network module, and a task graph retrieval module;

[0043] The task graph construction module is used to construct a text attribute task graph using task execution trajectory data;

[0044] The graph neural network module is used to perform retrieval based on the graph neural network according to the text attribute task graph, and obtain the graph neural network retrieval result;

[0045] The task graph retrieval module is used to obtain task graph construction retrieval results based on the retrieval results of the graph neural network and a preset search strategy.

[0046] Thirdly, to achieve the above objectives, the present invention provides an electronic device, comprising: one or more processors; and a storage device having stored one or more programs thereon, which, when executed by the one or more processors, cause the one or more processors to implement the method described in any implementation of the first aspect.

[0047] Fourthly, to achieve the above objectives, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by one or more processors, implements the method as described in any implementation of the first aspect.

[0048] Compared with the closest existing technology, the present invention has the following advantages:

[0049] This invention formalizes the task planning problem as a decision-making process on a graph structure, and uses graph neural networks to model and reason about task dependencies. It not only clearly reveals the inherent limitations of large language models in graph structure cognition, but also presents outstanding technical effects in multiple dimensions.

[0050] (1) Significantly improved task planning accuracy: In large-scale task graphs such as super tools, the simple graph convolution zero-shot mode can improve the task planning accuracy of the GPT-4 enhanced version from 68.6% to 77.8%, and the graph sampling aggregation training mode further improves the accuracy to 78.4%, effectively suppressing the illusion problem of large language models;

[0051] (2) Low inference latency: Simple graph convolution can complete graph convolution calculation with only one forward propagation. The time taken for a single request is comparable to directly calling a large language model (<3 seconds). Compared with beam search, it saves an average of 5 to 10 times the time, and the inference latency is extremely low.

[0052] (3) Flexible deployment: It supports both simple graph convolution schemes with zero parameters and zero training, and lightweight training with 3,000 samples to complete graph sampling aggregation in 3 to 5 minutes, which can be put into operation without a graphics processor;

[0053] (4) Low resource consumption: The number of parameters of graph convolutional networks is only 1 to 4 megabytes. Compared with the 10 to 20 hours of training time required to fine-tune large language models, the system can complete the adaptation in minutes on a single A100 graphics processor, which significantly reduces the computing cost.

[0054] Furthermore, as the scale of the task graph increases, the performance improvement of this invention becomes increasingly significant. It can effectively adapt to scenarios such as open-domain task planning, tool call path generation, and multi-round complex task reasoning. On multiple task planning benchmark datasets, it significantly outperforms existing methods such as directly using large language model reasoning and graph search, fully demonstrating its good practical value and technical competitiveness. Simultaneously, by formalizing the task planning problem as a decision process on a graph structure and utilizing GNNs to model and reason about task dependencies, this invention significantly improves the accuracy, robustness, and scalability of task planning. Attached Figure Description

[0055] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0056] Figure 1 This is a flowchart of a task graph construction retrieval method based on GNN, as described in an embodiment of the present invention.

[0057] Figure 2 This is a schematic diagram of the structure of the retrieval device based on the task graph construction of GNN according to an embodiment of the present invention;

[0058] Figure 3 This is a schematic diagram of the structure of the electronic device proposed in an embodiment of the present invention. Detailed Implementation

[0059] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions in the embodiments of this invention will be clearly and completely described below with reference to specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0060] The terminology used in the embodiments section of this invention is for the purpose of explaining specific embodiments of the invention only, and is not intended to limit the invention.

[0061] like Figure 1 As shown, embodiments of the present invention provide a task graph construction and retrieval method based on GNN, including:

[0062] S1. Construct a text attribute task graph using task execution trajectory data;

[0063] This step provides high-quality task nodes for subsequent graph construction. The core is to filter valid tasks from the raw trajectory data and unify task identifiers. First, high-frequency tasks are selected from large-scale task execution data, and low-confidence nodes are removed to ensure the representativeness of the graph nodes. Then, directed edges are constructed based on the task invocation order in real user requests to represent the dependencies between tasks. To compensate for the structural deficiencies caused by data sparsity, manual rules are further introduced to supplement key paths such as "create document → write file," thereby enhancing the connectivity and semantic consistency of the graph.

[0064] The task graph construction process in this procedure integrates real task execution trajectories with manually added rules, effectively characterizing the topological structure of the task space. Its construction mechanism boasts advantages in its high interpretability and scalability. On one hand, the graph structure clearly depicts the data and control flows between tasks, facilitating human understanding and debugging. On the other hand, the graph construction process requires no manual annotation, relying entirely on real execution data and rule combinations, thus possessing a high degree of automation. More importantly, this graph structure provides a unified input interface for subsequent GNN inference, enabling the task planning problem to be formalized as a path selection problem on a graph, thereby overcoming the inherent bottleneck of LLM in structured decision-making.

[0065] S2. Based on the text attribute task graph, perform a search using a graph neural network to obtain the graph neural network search results;

[0066] After the task graph is constructed, semantic alignment and path selection between tasks and steps are achieved through a Generative Neural Network (GNN). This mechanism consists of two stages: step embedding and task matching. First, a pre-trained language model (such as e5-335M) is used to decompose the user request into a series of natural language steps, and each step is encoded as a dense vector. Subsequently, the text description of each node in the task graph is also encoded as a vector, forming node features. Based on this, the GNN aggregates the information of neighboring nodes through a message passing mechanism to generate task embeddings with fused structural semantics, thereby achieving contextual enhancement of task semantics. In the retrieval stage, two types of GNN-enhanced task retrieval mechanisms are designed to adapt to different deployment requirements. One type is the Simple Graph Convolution (SGC) mode, which does not require parameter training. It uses SGC as a graph convolution operator and achieves smooth updates of task embeddings through a graph propagation mechanism, thus supporting efficient task matching in zero-shot scenarios. The other type is a trainable mode, which uses parameterized GNN structures such as GraphSAGE and GAT, combined with the Bayesian Personalized Ranking (BPR) loss function, to learn the matching relationship between tasks and steps from a small amount of labeled data.

[0067] S3. Based on the retrieval results of the graph neural network and combined with a preset search strategy, obtain the retrieval results for the task graph construction;

[0068] During the inference phase, a greedy or bundle search strategy is employed. Based on the task graph, the most matching task node is selected from the retrieval results, and the path is gradually expanded along the graph structure. This process is implemented by the core function responsible for rapid local optimization in the task graph retrieval and tool selection phase, and the core function responsible for global task path optimization. The former performs local optimization based on adjacency relationships, while the latter combines LLM scoring and graph structure for global path optimization, balancing efficiency and accuracy.

[0069] In summary, this invention addresses the logic and resource issues in actual execution through pre-defined strategies, ensuring that the final result not only possesses semantic and structural matching but also directly adapts to real-world execution scenarios. This significantly improves the feasibility of task planning and reduces conflicts and adjustment costs during subsequent execution. Furthermore, this invention significantly outperforms existing methods such as LLM direct inference and GraphSearch on multiple task planning benchmark datasets, with performance improvements becoming increasingly significant as the task graph size increases, demonstrating good scalability and practical value. Moreover, by formalizing the task planning problem as a decision-making process on a graph structure and utilizing GNNs to model and infer task dependencies, it significantly improves the accuracy, robustness, and scalability of task planning.

[0070] As one possible implementation, in the above embodiments, step S1 may specifically include the following steps:

[0071] S1-1. Initialize the task graph data structure, which includes a task link list, a deep-copy task node list, and a task name list.

[0072] The core data structure that constitutes the task graph consists of three key parts: a task link list, used to store the relationships between different tasks; a deeply copied task node list, which ensures that the original information of each task node is not modified by subsequent operations and fully preserves the various attributes of the task by deeply copying the existing task data; and a task name list, which extracts the name information used to identify tasks from all tasks to form a unified set of task identifiers, providing a unified reference standard for subsequent task association and matching, thereby building the basic data framework of the task graph.

[0073] S1-2. Preprocess the task execution trajectory data according to the task graph data structure to obtain the initial topology of the task graph;

[0074] Using the initialized task graph data structure as a reference, preprocessing operations are performed on large-scale task execution trajectory data. First, high-frequency tasks that match the task identifiers in the task name list and appear frequently (≥5 times) in actual execution are selected from the large-scale task execution trajectory data (such as tool call logs). Tasks that do not appear in the task name list, have extremely low execution frequency, or lack credibility are removed to ensure that the selected tasks can be adapted to the task node list. Next, invalid task records with non-standard formats and no actual execution significance are removed from the trajectory data to reduce the interference of data noise on subsequent processing. Finally, task relationships are extracted from the original data trajectory. "Source task → Target task" relationship pairs are generated for adjacent tool combinations. Using a task renaming mapping mechanism, tasks with inconsistent or special names in the trajectory data are standardized and adjusted. For example, "Document Creation" and "New Document" are uniformly mapped to "create_document", so that all task names are completely consistent with the descriptions in the task name list. Finally, an initial task graph topology structure that reflects the basic relationships between tasks is formed.

[0075] S1-3. Based on the initial topology of the task graph, obtain the structured task graph and the text similarity adjacency table;

[0076] Based on the initial topology of the task graph, on the one hand, predefined fixed task relationships (i.e., manually linked rules) are added to the initial topology to compensate for data sparsity. Duplicate task relationships are then removed, and the task relationship format is standardized into a structured dictionary containing source and target task fields. Data storage is then completed, resulting in a structured task graph. On the other hand, the textual descriptions of tasks in the initial topology are encoded into semantic vectors. The semantic similarity between tasks is calculated using a nearest neighbor algorithm, a connectivity adjacency matrix is ​​generated, and converted into an adjacency list format, resulting in a text similarity adjacency list. This step ensures the coherence of task dependency logic and the topological integrity of the graph structure in the structured task graph. The text similarity adjacency list uncovers semantic relationships between tasks to enrich the node connection dimensions. Together, they lay a high-quality structural and semantic foundation for subsequent fusion and construction of a text attribute task graph, supporting GNN's efficient task reasoning and retrieval.

[0077] S1-4. Construct a text attribute task graph using the structured task graph and the text similarity adjacency list;

[0078] This step integrates "trajectory-driven dependency relationships" and "semantic-driven similarity relationships" to construct a text attribute task graph that combines topological structure and textual semantics. Its nodes correspond to executable task units, and edges represent resource or temporal dependencies between tasks. The structured task graph serves as the basic framework for constructing the text attribute task graph. Task nodes in this framework correspond to actual executable task units, carrying attribute information such as task ID and text description. Edges between nodes clearly depict resource or temporal dependencies between tasks, accurately reflecting the logical flow of task execution and ensuring the topological integrity and interpretability of the graph structure. A text similarity adjacency list serves as a semantic supplement, integrating the task semantic similarity information contained in the text similarity adjacency list into this basic framework. By establishing implicit associations between semantically similar tasks, the semantic associations between task nodes are further enriched, enabling the task graph to not only reflect the dependency logic at the task execution level but also the semantic associations between tasks. After merging the two, a text attribute task graph is ultimately formed that combines the logical structure of task execution with semantic similarity information. This graph clearly depicts the data flow and control flow between tasks (derived from the structured task graph) and includes semantic similarity information of tasks (derived from the text similarity adjacency list), significantly improving interpretability and semantic expressiveness. It also provides a unified and rich input interface for subsequent message passing and task embedding generation in GNNs. In this graph, nodes correspond to executable task units, and edges represent resource or temporal dependencies between tasks.

[0079] In summary, steps S1-1 to S1-4 first initialize the task graph data structure, which includes a task link list, a deep-replicated task node list, and a task name list. Then, using this structure as a reference, the task execution trajectory data is preprocessed by filtering high-frequency and valid tasks, removing invalid records, and standardizing task names to obtain the initial topological structure of the task graph. Next, based on the initial topological structure, a structured task graph that characterizes the resource and temporal dependencies between tasks is constructed, as well as a text similarity adjacency list generated by task text embedding and the nearest neighbor algorithm. Finally, these two are merged to form a text attribute task graph that combines task execution logical topology and semantic association information. This process significantly improves task planning accuracy and effectively suppresses the illusion problem of large language models. For example, on relevant large-scale task graphs, both zero-shot mode and training mode outperform direct inference by large language models. On the other hand, it features low inference latency, short single request time, flexible deployment, and low resource consumption. It supports rapid application without training and lightweight training with a small number of samples. It can be deployed without high-performance computing equipment, significantly reducing computing costs. At the same time, it provides a unified, high-quality input interface for subsequent graph neural network task inference and retrieval, and has good practicality and scalability.

[0080] As one possible implementation, in the above embodiments, steps S1-3 may specifically include the following steps:

[0081] S1-3-1. Using the initial topology of the task graph, extract the task trajectory data;

[0082] The initial topology of the task graph clearly includes task node identifiers and a basic relationship framework. Based on this, task trajectory data is extracted from large-scale task execution records (such as tool call logs). During the selection process, it is necessary to ensure that the tasks involved in the extracted trajectory data all match the task nodes in the initial topology, while fully preserving the actual call order of tasks in the trajectory, forming a trajectory dataset that can reflect the actual execution process of the tasks, providing core data support for the subsequent construction of a structured task graph.

[0083] S1-3-2. Based on the task trajectory and fixed task relationships, perform deduplication and relationship transformation processes sequentially to construct a structured task graph;

[0084] First, the call relationships between adjacent tasks in the extracted task trajectory data are organized into directed edges of "source task - target task" to represent the temporal dependencies between tasks. Then, fixed task relationships defined in advance according to common task execution logic are added, such as "create document → write to file" and "view schedule → check room booking status", to make up for the problem of missing key associations that may exist if only trajectory data is relied upon. Subsequently, all integrated task relationships are deduplicated to remove duplicate association pairs and avoid redundant information affecting the accuracy of the graph structure. The original string format task relationships are converted into a structured dictionary format containing explicit fields of "source" and "target" to make the dependencies between tasks clear and identifiable. Finally, the number of task nodes and the number of relationship links are counted. Pure node data is stored in tool_desc.json and the complete graph structure (nodes + relationships) is stored in graph_desc.json to form a structured task graph with standardized nodes and relationships.

[0085] S1-3-3. Using the initial topological structure of the task graph, obtain a text similarity graph;

[0086] In the initial topology of the task graph, each task node carries corresponding textual description information. Based on these textual descriptions, the text content is first standardized (e.g., to unify the expression style) to ensure consistency. Then, by analyzing the semantic features and content associations of the text, text-level similarity associations are established between task nodes. According to the degree of text similarity, semantically similar task nodes are linked together to form a text similarity graph that reflects the semantic similarity of tasks, laying the foundation for obtaining the subsequent tool text embedding matrix.

[0087] S1-3-4. Based on the text similarity map, use a pre-trained large language model to obtain the tool text embedding matrix;

[0088] The text descriptions of all task nodes in the text similarity graph are taken as input and fed into a pre-trained large language model (such as the e5-335M class model). Leveraging the pre-trained model's ability to understand and encode natural language, the text description of each task is converted into a dense vector that accurately reflects its semantic features. These vectors are then organized according to the correspondence between task nodes, forming a matrix where each row corresponds to a task semantic vector—the tool text embedding matrix. This matrix quantifies the degree of semantic association between tasks.

[0089] S1-3-5. Based on the tool text embedding matrix, construct a text similarity adjacency table using the K-nearest neighbor algorithm;

[0090] Based on the tool text embedding matrix, default parameters are set: each node is connected to 5 nearest neighbors (k=5). Cosine similarity is used as the distance metric. The K-Nearest Neighbors (KNN) algorithm is used to calculate the k semantically similar tasks for each task, generating a connectivity adjacency matrix in 0 / 1 format, where 1 represents a connection and 0 represents no connection. Subsequently, an adjacency list dictionary is initialized with task names as keys and empty lists as values. The similar tasks corresponding to each task are added to their corresponding lists in sequence, forming an adjacency list format with task names as keys and similar task lists as values, with the structure {tool name: [similar task 1, similar task 2, ...]}. Finally, a text similarity adjacency list that can intuitively reflect the semantic similarity relationship between tasks is obtained.

[0091] In summary, steps S1-3-1 to S1-3-5 first construct a text attribute task graph that integrates real task execution trajectories with manually supplemented rules. Nodes correspond to executable task units, and edges represent dependencies between tasks. Then, two types of graph neural network-enhanced task retrieval mechanisms are designed. The specific implementation methods for task graph construction, graph neural network architecture, and graph search algorithms are also detailed. This process significantly improves the accuracy, robustness, and scalability of task planning, effectively suppresses the illusion of large language models in task graph planning, exhibits low inference latency and flexible deployment, and has relatively low resource consumption. Performance improvement is even more pronounced as the task graph size increases. It is suitable for scenarios such as open-domain task planning, tool call path generation, and multi-round complex task inference.

[0092] As one possible implementation, in the above embodiments, step S2 may specifically include the following steps:

[0093] S2-1. Obtain the user request based on the text attribute task graph;

[0094] The nodes of the text attribute task graph correspond to executable task units, and the edges represent resource or temporal dependencies between tasks. It is suitable for scenarios such as open-domain task planning, tool call path generation, and multi-round complex task reasoning. When obtaining user requests, it is necessary to collect user requests that fall within the processing scope of the graph structure from actual application scenarios, based on the applicable scenarios of this task graph. This ensures that the user requests belong to complex task types that can be solved through task graph decomposition and retrieval, providing clear processing objects for subsequent steps.

[0095] S2-2. Decompose the user request using a pre-trained large language model to obtain a natural language step sequence;

[0096] After receiving a user request, a pre-trained large language model is invoked to perform semantic understanding and decomposition of the request. Leveraging its powerful natural language processing capabilities, the pre-trained large language model can break down complex user requests into a series of logically coherent and executable natural language steps, forming an ordered sequence of natural language steps. This lays the foundation for subsequent matching with the text attribute task graph.

[0097] S2-3. Based on the natural language step sequence and the text attribute task graph, the pre-trained large language model is used for encoding to generate step feature matrix and task node feature matrix respectively.

[0098] Using the generated natural language step sequence and text attribute task graph as input, the pre-trained large language model described above is used again for encoding processing. On the one hand, each step in the natural language step sequence is encoded into a dense vector that can represent its semantic information. These vectors are arranged in the order of steps to form a step feature matrix. On the other hand, the text description (such as task name and function description) of each task node in the text attribute task graph is also encoded into a dense vector. The vectors of all nodes are integrated to form a task node feature matrix, so that both steps and task nodes exist in a unified vector form, which facilitates subsequent retrieval and calculation.

[0099] S2-4. Based on the feature matrix of the steps and the feature matrix of the task nodes, perform a search using a graph neural network to obtain the graph neural network search results;

[0100] The step feature matrix and task node feature matrix are input into the graph neural network (GNN). The GNN aggregates information from the task node's neighbors through a message passing mechanism to generate a task embedding with fused structural semantics, thereby enhancing the context of the task semantics. Subsequently, the corresponding retrieval mode is selected according to the actual deployment requirements: for zero-sample scenarios, the Simple Graph Convolution (SGC) mode without training is used, and the task embedding is smoothly updated through a graph propagation mechanism to achieve efficient matching; for trainable scenarios, parameterized GNN structures such as GraphSAGE and GAT are used, combined with a Bayesian personalized ranking loss function to optimize the matching relationship. Finally, by calculating the similarity between the step features and the task embedding, a task candidate list sorted by similarity is generated and passed to subsequent modules as the retrieval result of the graph neural network.

[0101] In summary, steps S2-1 to S2-1 first obtain suitable user requests based on the text attribute task graph, then decompose the requests into a natural language step sequence using a pre-trained large language model. Subsequently, the model encodes the step sequence and the task graph node text respectively, generating step feature matrices and task node feature matrices. Finally, a graph neural network is used for retrieval to match the optimal task execution path. This process not only significantly improves the accuracy and robustness of task planning and effectively suppresses the illusion problem of large language models in graph structure processing, but also has advantages such as low inference latency (short time per request), flexible deployment (supports zero-parameter or lightweight training), and low resource consumption (few parameters in graph convolutional networks). The performance improvement is more pronounced as the task graph scale increases, and it can significantly reduce computational costs.

[0102] As one possible implementation, in the above embodiments, step S2-4 may specifically include the following steps:

[0103] S2-4-1. Input the task node feature matrix into the graph neural network to obtain the task embedding with fused structural semantics;

[0104] The pre-constructed task node feature matrix is ​​fed into the graph neural network as input data. With the help of its own message passing mechanism, the graph neural network can fully explore the topological relationship between task nodes in the text attribute task graph. At the same time, it deeply integrates this structural information with the feature information of the task nodes themselves, and finally generates a task embedding that contains both the semantic features of task nodes and the structural relationship between tasks, laying the foundation for subsequent scenario-based processing.

[0105] S2-4-2. Based on the user request, obtain the actual application scenario, which includes zero-sample scenario and non-zero-sample scenario;

[0106] Based on current user requests, this study analyzes users' actual needs and resource conditions in task processing to identify corresponding practical application scenarios. These scenarios are mainly divided into two categories: zero-sample scenarios, which do not require pre-trained models and can be directly searched and matched; and trainable scenarios, which require model training to optimize search performance. Identifying these scenarios provides direction for selecting subsequent search processing methods.

[0107] S2-4-3. Determine whether the actual application scenario is a zero-sample scenario. If so, use a simple graph convolution mode to perform global feature smoothing on the task embedding of the fused structural semantics to obtain a smooth task embedding. Calculate the similarity between the step embedding and the task embedding in combination with the step feature matrix, and directly execute S2-4-5. Otherwise, input the task embedding of the fused structural semantics into the parameterized large language model and train it using the Bayesian personalized ranking loss function to obtain the trained parameterized large language model, and execute S2-4-4.

[0108] For the identified real-world application scenario, if it is determined to be a zero-sample scenario, the SGC mode is adopted. Utilizing the graph propagation mechanism of this mode, the task embedding with fused structural semantics undergoes global feature smoothing to eliminate interference from local feature differences, resulting in a smooth task embedding. Subsequently, the smoothed task embedding is combined with the step feature matrix, and the correlation between the two is established by calculating the similarity between them. If the scenario is determined to be a non-zero-sample scenario (i.e., a trainable scenario), the task embedding with fused structural semantics is input into a parameterized GNN such as GraphSAGE or GAT, and the BPR loss function is introduced to train the model. By continuously optimizing the model parameters, the accuracy of matching task embeddings and step features is improved, ultimately obtaining the trained parameterized large language model.

[0109] S2-4-4. Based on the step feature matrix and the fusion structure semantics, the task embedding is used to obtain the similarity between the step embedding and the task embedding using the trained parameterized large language model.

[0110] Once the scenario is trainable and a trained parameterized large language model is obtained, the step feature matrix and the task embedding with fused structural semantics are used as inputs to the trained parameterized large language model. Leveraging the matching patterns learned during training, the model performs deep correlation analysis on the step features and task embeddings, accurately calculating the similarity between them, thus providing data support for subsequent selection of the task candidate list.

[0111] S2-4-5. Based on the similarity between the embedding in the above steps and the task embedding, obtain a candidate tool list ranked by similarity as the graph neural network retrieval result;

[0112] After calculating the similarity between step embedding and task embedding, the task nodes corresponding to all task embeddings are sorted based on the similarity calculation results. Task nodes with higher similarity to step embeddings are selected first. These selected task nodes are organized into a task candidate list, which is the final graph neural network retrieval result and can be directly used for subsequent task planning and execution.

[0113] In summary, steps S2-4-1 to S2-4-5 first input the task node feature matrix into the graph neural network to generate task embeddings with fused structural semantics. Then, based on the user request, the actual application scenario (zero-shot scenario or trainable scenario) is determined, followed by scenario-specific processing. For zero-shot scenarios, the SGC mode is used to perform global feature smoothing on the task embeddings with fused structural semantics, and then the similarity between the step embeddings and task embeddings is calculated using the step feature matrix. For trainable scenarios, the task embeddings with fused structural semantics are input into a parameterized large language model and trained using the BPR loss function. The similarity between the step embeddings and task embeddings is then calculated using the trained model. Finally, a task candidate list is obtained based on the similarity results, serving as the retrieval result for the graph neural network. This process, through scenario-specific adaptation, achieves fast retrieval without training in zero-shot scenarios, improves task matching accuracy through model optimization in trainable scenarios, and effectively reduces matching bias by fusing task structural semantics and step features, enhancing the reliability of retrieval results. It also flexibly adapts to different application needs, lowers the threshold for scenario-based deployment, and provides accurate candidate support for subsequent task planning.

[0114] As one possible implementation, in the above embodiments, step S3 may specifically include the following steps:

[0115] S3-1. Based on the actual application scenario, obtain a preset search strategy, wherein the preset search strategy is a greedy search strategy or a depth-first search strategy;

[0116] In practical applications, zero-shot scenarios, lacking training data, require rapid output of basic feasible paths, such as temporary tool calls. The core requirements are "low latency and lightweight processing," making a greedy search strategy suitable. This strategy requires no complex parameter training; it quickly constructs paths by "selecting the most similar and conflict-free tasks step-by-step." Non-zero-shot scenarios, possessing some training data, prioritize path constraint adaptability, such as prioritizing high-priority resources in complex processes or requiring prerequisite tasks to be executed first. The core requirements are "meeting scenario constraints and improving path reliability," making a depth-first search strategy suitable. This strategy filters tasks according to preset priorities (such as resource priority and temporal dependency priority) and then constructs paths based on similarity matching. This step, through precise matching between scenarios and strategies, avoids excessive validation delays caused by using depth-first search in zero-shot scenarios and avoids constraint mismatch problems caused by greedy search in non-zero-shot scenarios. It significantly improves the adaptability of strategy selection and reduces ineffective computational overhead caused by strategy mismatch.

[0117] S3-2. Process the graph neural network retrieval results according to the preset search strategy to obtain a task list after processing by the preset search strategy;

[0118] The graph neural network retrieval results are a list of candidate tasks, including the similarity between each task and the user's request steps, task attributes (such as resource requirements and temporal dependencies), and structural relationships. If a greedy search strategy is preset, the processing is implemented using a sequence-greedy tool selection function: first, the similarity (dot product or Euclidean distance) between the steps encoded by the pre-trained language model and the task features is calculated, filtering out the candidate tasks with the highest similarity. Then, referring to the neighbor nodes of previously selected tasks (based on the adjacency relationship of the task graph), only the task with the highest similarity and that meets the dependency rules is added to the list each time, skipping duplicate tools to ensure the continuity of data flow and control flow between tasks. This processing can quickly construct continuous task sequences without complex calculations, with extremely low inference latency. The time consumed by a single request is comparable to directly calling a large language model, saving a significant amount of time on average compared to beam search.

[0119] If a depth-first search strategy is preset, the process starts from the candidate tasks output by the graph neural network, recursively explores the child tasks of each task, and combines the scoring of candidate tools by a large language model (obtained by prompting the large language model to obtain tool scores). Candidate tasks are then filtered using greedy, bundle search, or adaptive strategies (e.g., bundle search selects candidate tools with higher scores, while adaptive strategies select tools with scores reaching a threshold), avoiding loops and recording all valid task sequences. This approach fully utilizes the graph neural network's ability to model task dependencies, combined with the semantic evaluation of a large language model, reducing the generation of invalid paths, improving the rationality of the task list, and providing more high-quality candidates for subsequent selection of the optimal path.

[0120] S3-3. Verify the task list processed according to the preset search strategy, and obtain the optimal task path as the retrieval result for task graph construction.

[0121] Based on the task list processed by the preset strategy, the optimal path is further filtered to finally form a task graph construction retrieval result containing an ordered tool list and tool transfer relationships. If a greedy search strategy was previously used, the dependency coherence between tasks in the task list needs to be verified first (e.g., whether the output of a previous task can be used as the input of a subsequent task, and whether it conforms to the data flow and control flow in the task graph). After confirming that there are no logical gaps, the list is directly used as an ordered tool list, and the relationship between adjacent tasks (e.g., "current task → next task") is extracted as a tool transfer relationship. If a depth-first search strategy is used, the optimal solution needs to be selected from multiple valid task paths through a large language model with prompts. The evaluation dimensions include the degree of fit between the path and the user's original needs, the tightness of the dependencies between tasks, and logical coherence. Paths with logical contradictions or deviations from the needs are eliminated, and the optimal path is transformed into an ordered tool list and tool transfer relationships.

[0122] In zero-shot scenarios, the SGC mode, combining two strategies, effectively improves the task planning accuracy of large language models and suppresses their illusion problem. In non-zero-shot scenarios, parameterized GNN combined with strategy selection can further optimize accuracy performance. Simultaneously, the final output is highly interpretable (clearly depicting the topological structure of task execution), and the graph convolutional network has extremely small parameters, requiring no high-performance computing equipment for deployment. Lightweight training can be completed with only a small number of samples, significantly reducing computational costs. As the task graph scales, the performance improvement becomes increasingly significant, demonstrating excellent scalability and practical value, perfectly aligning with the description of the method's performance advantages in the documentation.

[0123] In summary, steps S3-1 to S3-3 select appropriate preset search strategies based on the actual application scenario (zero-sample or non-zero-sample). For zero-sample scenarios, a greedy search strategy is used to quickly construct paths; for non-zero-sample scenarios, a priority search strategy is used to ensure the paths meet core constraints. Then, the task candidate list retrieved by the graph neural network is processed according to the selected strategy. Finally, the processed task list is verified (the greedy strategy verifies coherence, while the depth-first strategy uses a large language model to select the optimal path), and the optimal task path containing the ordered tool list and tool transition relationships is obtained as the result. This process significantly improves strategy adaptability, avoids excessive delays or constraint mismatches caused by mismatches, and reduces invalid computation. In the zero-sample scenario, SGC combined with the strategy improves task planning accuracy and suppresses the illusion of large language models; in the non-zero-sample scenario, parameterized GNN optimizes accuracy. The results are highly interpretable, the graph convolutional network has a small parameter count, reduces computational costs, and the performance improvement is more significant when the task graph scale increases, demonstrating excellent scalability and practical value.

[0124] As one possible implementation, in the above embodiments, step S3-2 may specifically include the following steps:

[0125] S3-2-1. Determine whether the preset search strategy is a greedy search strategy. If so, use the graph neural network retrieval results to filter and obtain candidate tasks, and execute S3-2-2. Otherwise, according to the graph neural network retrieval results, obtain the starting task and directly execute S3-2-4.

[0126] First, clarify the currently determined preset search strategy type (greedy search strategy or depth-first search strategy), and use this type as the criterion: If it is determined to be a greedy search strategy, first determine the steps to be processed from the natural language step sequence decomposed from the user request, and then select the candidate task with the highest global similarity from the graph neural network retrieval results (including the task-step matching similarity, task attributes, and task-relationship list) to prepare for subsequent precise screening; if it is determined to be a non-greedy search strategy (i.e., depth-first search strategy), then select the task with the highest matching degree with the first step of the user request and that conforms to the basic execution logic (such as no missing prerequisite dependencies) from the graph neural network retrieval results as the starting task (the matching basis is the similarity data between steps and tasks), providing a starting point for subsequent path exploration.

[0127] S3-2-2. Based on the text attribute task graph and the candidate tasks, obtain the optimal task;

[0128] Based on the text attribute task graph (including topological dependencies between tasks, data flow and control flow relationships), the adjacency relationships between candidate tasks and previous selected tasks (if they exist) are retrieved from the text attribute task graph. Combined with the dependency rules determined by the topological logic of the task graph (such as the logic that "the output of task A must be used as the input of task B"), the candidate task with the "highest similarity, no dependency conflict with the previous task, and no duplicate tool use" is selected as the optimal task, ensuring that the task meets the requirements in terms of semantic matching and structural association.

[0129] S3-2-3. Based on the optimal task and the graph neural network retrieval result, obtain the task list processed by the greedy strategy as the task list processed by the preset search strategy.

[0130] The optimal task is added to the initial task list. At the same time, based on the attributes of the optimal task (such as tool type and execution result), candidate tasks that conflict with the task or have semantic overlap with it are removed from the graph neural network retrieval results, and the candidate task pool is updated. Then, the process of "filtering candidate tasks → selecting the optimal task by combining text attribute task graph → adding to the list and updating the candidate pool" is repeated until the task list covers all steps of the user request. Finally, a task list with ordered tasks and no logical gaps between tasks is formed, which is the task list after processing by the greedy strategy and serves as the task list after processing by the preset search strategy.

[0131] S3-2-4. Based on the initial task and the pre-trained language model, obtain the candidate task score;

[0132] Starting with a defined initial task, the initial task and its downstream related tasks (sub-node tasks retrieved from the text attribute task graph) in the graph neural network retrieval results are taken as the objects to be scored and input into the pre-trained language model. The pre-trained language model analyzes the overall fit between the task to be scored and the user request, its execution feasibility (such as tool adaptability), and its logical coherence with the initial task to generate a quantitative candidate task score for each task to be scored (the higher the score, the stronger the task adaptability), providing a quantitative basis for subsequent screening.

[0133] S3-2-5. Based on the candidate task scores, perform recursive exploration and screening according to preset standards to obtain a task list processed by a deep optimization strategy as a task list processed by a preset search strategy.

[0134] Using the obtained candidate task scores as the core screening criterion, combined with preset criteria such as the bundle width of the bundle search (retaining the top N tasks by score) and the scoring threshold of the adaptive strategy (screening tasks with scores higher than the threshold), tasks that meet the criteria are selected from the downstream related tasks of the starting task. Then, using the selected tasks as the new starting point, its downstream child node tasks are recursively explored (retrieving child node relationships from the text attribute task graph), repeating the "scoring → screening" process, while recording the visited tasks to avoid loop generation. Finally, all non-loop, logically coherent, and valid task sequences are integrated to form a task list processed by the depth-first strategy, which serves as the task list processed by the preset search strategy.

[0135] In summary, steps S3-2-1 to S3-2-5 first determine the type of the preset search strategy: if it is a greedy search strategy, candidate tasks are selected from the graph neural network retrieval results, and then the optimal task is selected by combining the text attribute task graph. The task is gradually added to the list and the candidate pool is updated, and finally the task list after the greedy strategy is processed is generated; if it is a depth-first search strategy, the starting task is determined from the graph neural network retrieval results, and the downstream related tasks of the starting task are scored by the pre-trained language model. The effective task sequence without loops is recursively explored and screened according to preset standards (such as bundle width and scoring threshold) to form the task list after the depth-first strategy is processed. The greedy strategy in this process can quickly generate a logically coherent task list without resource conflicts, with low inference latency, meeting the "lightweight and fast response" requirements of zero-shot scenarios. The depth-first strategy can make full use of graph structure modeling and semantic scoring to reduce invalid paths and provide more high-quality candidate sequences, adapting to the "constraint fit and high reliability" requirements of non-zero-shot scenarios. The entire process effectively suppresses the illusion problem of pre-trained models through structural constraints of the text attribute task graph and semantic verification of the pre-trained language model, improving the rationality and executability of the task list, and providing solid support for subsequent selection of the optimal task path.

[0136] Further reference Figure 2 As an implementation of the methods shown in the above figures, this disclosure provides an embodiment of a task graph construction retrieval device based on GNN, which is similar to... Figure 1 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.

[0137] like Figure 2 As shown, the task graph construction and retrieval device based on GNN in this embodiment includes: a task graph construction module, a graph neural network module, and a task graph retrieval module;

[0138] The task graph construction module is used to construct a text attribute task graph using task execution trajectory data;

[0139] This module uses "trajectory-driven + rule-supplemented" as its core strategy, aiming to construct a text attribute task graph with complete structure and consistent semantics. First, the task graph data structure is initialized, creating three core components by default: a task link list, a deeply replicated task node list, and a task name list. Then, based on the initialized task graph data structure, large-scale task execution trajectory data is preprocessed. Operations such as frequency filtering (retaining tasks with ≥5 occurrences), low-confidence node removal, and task name standardization ensure the validity and consistency of task nodes. Next, the relationships between adjacent tasks are extracted from the preprocessed trajectories, generating directed edges representing temporal or resource dependencies, thus initially constructing the graph's topology. Subsequently, to address the structural gaps caused by data sparsity, predefined manually defined link rules are automatically loaded to supplement key task paths and enhance graph connectivity. Simultaneously, a pre-trained model is used to encode task text, combined with the k-nearest neighbor algorithm, to construct a text similarity adjacency list to enrich the semantic relationships of the graph. Finally, the task node data and the complete graph structure (nodes + edges + similarity adjacency list) are persistently stored, outputting a text attribute task graph where nodes are executable task units and edges represent task dependencies, providing structured input for subsequent retrieval.

[0140] The graph neural network module is used to perform retrieval based on the graph neural network according to the text attribute task graph, and obtain the graph neural network retrieval result;

[0141] This module is responsible for task retrieval based on text attribute task graphs, mainly comprising two core components: embedding encoding and GNN retrieval. In the embedding encoding stage, it first calls a large language model to decompose the user request into a natural language step sequence. Then, a pre-trained model encodes the step sequence and the task node text descriptions (such as task names and function descriptions) in the text attribute task graph into dense vectors, generating step feature matrices and task node feature matrices. This achieves numerical representation of text information, laying the foundation for subsequent semantic matching. In the GNN retrieval stage, it provides two retrieval mechanisms adapted to different scenarios: one is the SGC mechanism for zero-shot scenarios, which requires no parameter training. It calculates neighbor aggregation features through sparse matrix multiplication and combines a learnable parameter alpha (initial value of 1.0, controlling the proportion of original features retained) to achieve... The module employs a weighted fusion of original node features and neighbor aggregation features to generate a smooth task embedding. Secondly, it utilizes a supervised parameterized GNN mechanism, supporting model architectures such as GraphSAGE (Graph Sampling and Aggregation) and GAT (Graph Attention Network). A 1-2 layer GNN network is constructed, and feature propagation is optimized through batch normalization, LeakyReLU activation, and Dropout. The mean output of each layer is used as the final task embedding, and the BPR loss function is combined to learn the alignment relationship between the task and steps using a small amount of labeled data. Finally, this module calculates the similarity between the step embedding and the task embedding, generating a task candidate list sorted by similarity, which is then passed to subsequent modules as the retrieval result of the graph neural network.

[0142] The task graph retrieval module is used to obtain task graph construction retrieval results based on the graph neural network retrieval results and a preset search strategy;

[0143] This module is responsible for generating the final task graph based on the graph neural network retrieval results (task candidate list) output by the graph neural network module, combined with a preset search strategy. Its core functions focus on "strategy execution - path filtering - result output". First, it loads auxiliary data such as the tool ID mapping table and the task graph adjacency list. Depending on the application scenario, it selects either a greedy or depth-first search (DFS) strategy: When using a greedy strategy, the module first selects the task with the highest global similarity from the candidate list. Subsequent steps select the task with the best similarity from the neighbors of the predecessor task based on the task graph adjacency relationship, while avoiding duplicate tasks without suitable neighbors, quickly generating a locally optimal task sequence. When using a DFS strategy, the module uses the solutions list (storing all valid paths) and the current_tools list (recording the current path), calls a large language model to score candidate tasks, and filters candidates according to sub-strategies (greedy / bundle search / adaptive). It traverses all possible paths through a backtracking mechanism, and finally calls the large language model to select the globally optimal path from the valid paths. Ultimately, the module outputs retrieval results containing an ordered list of task nodes and a list of transition relationships between tasks, achieving optimal execution path planning for complex tasks while balancing retrieval efficiency and accuracy.

[0144] In summary, this device addresses the structural deficiencies of existing LLM-based task planning systems in complex task decomposition and path selection through the collaborative work of a task graph construction module, a graph neural network module, and a task graph retrieval module. The task graph construction module builds and persistently stores a task graph with textual attributes representing task dependencies, based on task execution trajectory data, providing a structured data carrier for subsequent processing. The graph neural network module encodes user request steps and task nodes into dense vectors, then generates a task candidate list using either a training-free SGC mode or a trainable parameterized GNN mode. The task graph retrieval module combines a preset search strategy to select the optimal task path. This device significantly improves the accuracy and robustness of task planning, effectively suppresses the illusion problem of large language models, and features low inference latency. It supports rapid deployment with zero training and can be further optimized through lightweight training, while also having low resource consumption, significantly reducing computational costs. It is suitable for scenarios such as open-domain task planning, tool call path generation, and multi-round complex task inference.

[0145] In this embodiment, the specific processing of the retrieval device based on the task graph of GNN and the resulting technical effects can be referred to respectively. Figure 1 The relevant descriptions of steps S1, S2 and S3 in the corresponding embodiments will not be repeated here.

[0146] It should be noted that the implementation details and technical effects of each module and unit in the device provided in the embodiments of this disclosure can be referred to the description of other embodiments in this disclosure, and will not be repeated here.

[0147] The following is for reference. Figure 3 It shows a schematic diagram of the structure of a computer system 500 suitable for implementing the electronic device of the present disclosure. Figure 3 The computer system 500 shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of this disclosure.

[0148] like Figure 3 As shown, the computer system 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the computer system 500. The processing device 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0149] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows computer system 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 3 A computer system 500 with various electronic devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0150] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.

[0151] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0152] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0153] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the following functions: Figure 1 The embodiments shown and their alternative implementations illustrate a task graph construction and retrieval method based on GNNs.

[0154] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0155] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0156] The units or modules described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units or modules do not necessarily limit the unit itself; for example, an acquisition module can also be described as "acquiring preset prompts, including modality fusion prompts, attention mechanism prompts, and / or time-related prompts."

[0157] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

Claims

1. A task graph construction retrieval method based on GNN, characterized in that, include: S1. Construct a text attribute task graph using task execution trajectory data; S2. Based on the text attribute task graph, perform a search using a graph neural network to obtain the graph neural network search results; S3. Based on the retrieval results of the graph neural network and combined with the preset search strategy, obtain the retrieval results of the task graph construction.

2. The task graph construction and retrieval method based on GNN according to claim 1, characterized in that, S1. Using task execution trajectory data, construct a text attribute task graph, including: Initialize the task graph data structure, which includes a task link list, a deep-replicated task node list, and a task name list; The task execution trajectory data is preprocessed according to the task graph data structure to obtain the initial topology of the task graph; Based on the initial topology of the task graph, obtain the structured task graph and the text similarity adjacency table; A text attribute task graph is constructed using the structured task graph and the text similarity adjacency list.

3. The task graph construction and retrieval method based on GNN according to claim 2, characterized in that, Based on the initial topology of the task graph, a structured task graph and a text similarity adjacency list are obtained, including: Using the initial topology of the task graph, extract task trajectory data; Based on the task trajectory and fixed task relationships, deduplication and relationship transformation are performed sequentially to construct a structured task graph; Using the initial topological structure of the task graph, obtain a text similarity graph; Based on the text similarity graph, a pre-trained large language model is used to obtain the tool text embedding matrix; Based on the tool's text embedding matrix, a text similarity adjacency table is constructed using the K-nearest neighbor algorithm.

4. The task graph construction and retrieval method based on GNN according to claim 1, characterized in that, S2. Based on the text attribute task graph, perform a search using a graph neural network to obtain the graph neural network search results, including: Based on the text attribute task graph, obtain the user request; The user request is decomposed using a pre-trained large language model to obtain a natural language step sequence; Based on the natural language step sequence and the text attribute task graph, the pre-trained large language model is used for encoding to generate step feature matrix and task node feature matrix respectively. Based on the feature matrix of the steps and the feature matrix of the task nodes, a retrieval is performed using a graph neural network to obtain the retrieval results.

5. The task graph construction and retrieval method based on GNN according to claim 4, characterized in that, Based on the feature matrix of the steps and the feature matrix of the task nodes, a graph neural network is used for retrieval to obtain the graph neural network retrieval results, including: The task node feature matrix is ​​input into a graph neural network to obtain the task embedding with fused structural semantics. Based on the user request, obtain the actual application scenario, which includes zero-sample scenario and non-zero-sample scenario; Determine whether the actual application scenario is a zero-sample scenario. If so, use a simple graph convolution mode to perform global feature smoothing on the task embedding of the fused structural semantics to obtain a smooth task embedding. Calculate the similarity between the step embedding and the task embedding in combination with the step feature matrix and perform the second operation. Otherwise, input the task embedding of the fused structural semantics into a parameterized large language model and train it using a Bayesian personalized ranking loss function to obtain the trained parameterized large language model and perform the first operation. The first operation is as follows: based on the task embedding of the step feature matrix and the fusion structure semantics, the similarity between the step embedding and the task embedding is obtained using the trained parameterized large language model, and then the second operation is performed. The second operation is as follows: based on the similarity between the embedding in the step and the embedding in the task, obtain a list of candidate tools ranked by similarity as the retrieval result of the graph neural network.

6. The task graph construction and retrieval method based on GNN according to claim 5, characterized in that, S3. Based on the retrieval results of the graph neural network and a preset search strategy, obtain the task graph construction retrieval results, including: Based on the actual application scenario, a preset search strategy is obtained, which is either a greedy search strategy or a depth-first search strategy. The graph neural network retrieval results are processed according to the preset search strategy to obtain a task list after processing by the preset search strategy; The optimal task path is selected from the task list processed by the preset search strategy to obtain the task graph construction retrieval results.

7. The task graph construction and retrieval method based on GNN according to claim 6, characterized in that, The graph neural network retrieval results are processed according to the preset search strategy to obtain a task list after processing by the preset search strategy, including: Determine whether the preset search strategy is a greedy search strategy. If so, use the graph neural network retrieval results to filter and obtain candidate tasks, and perform the third operation. Otherwise, according to the graph neural network retrieval results, obtain the starting task and perform the fifth operation. The third operation is as follows: based on the text attribute task graph and the candidate tasks, obtain the optimal task and perform the fourth operation; The fourth operation is: based on the optimal task and the graph neural network retrieval result, obtain the task list processed by the greedy strategy as the task list processed by the preset search strategy; The fifth operation: Based on the initial task and the pre-trained language model, obtain the candidate task score and perform the sixth operation; The sixth operation is: based on the candidate task scores, recursively explore and filter according to preset standards to obtain a task list processed by a deep optimization strategy as a task list processed by a preset search strategy.

8. A retrieval device for constructing a task graph based on a GNN, using the method described in any one of claims 1-7, characterized in that, include: Task graph construction module, graph neural network module, and task graph retrieval module; The task graph construction module is used to construct a text attribute task graph using task execution trajectory data; The graph neural network module is used to perform retrieval based on the graph neural network according to the text attribute task graph, and obtain the graph neural network retrieval result; The task graph retrieval module is used to obtain task graph construction retrieval results based on the retrieval results of the graph neural network and a preset search strategy.

9. An electronic device, characterized in that, include: One or more processors; Storage device, on which one or more programs are stored, When the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, It stores a computer program thereon, wherein the computer program, when executed by one or more processors, implements the method as described in any one of claims 1-7.