Task processing method and device, electronic equipment, computer readable storage medium and computer program product
By dividing tasks into multiple subtasks using complexity metrics in a language model and constructing a task tree, the problem of blind task decomposition in existing technologies is solved, thereby improving task processing efficiency and result accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2026-01-13
- Publication Date
- 2026-04-14
AI Technical Summary
Existing technologies cannot effectively perceive task characteristics during task decomposition, leading to blind partitioning operations, affecting the efficiency and rationality of task decomposition, and consequently resulting in low efficiency in generating language model results.
By acquiring natural language instructions, converting them into tasks to be processed by a pre-trained language model, dividing the task into multiple subtasks using a complexity index, and then recursively dividing the task until atomic tasks with a complexity less than a threshold are obtained, and finally constructing a task tree to call the language model to execute the task.
It achieves intelligent adaptability in the task decomposition process, improves the rationality of task decomposition and the efficiency of resource utilization, ensures high quality in the task tree execution process, and enhances the accuracy of responses to natural language commands.
Smart Images

Figure CN121858296A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information processing technology, and in particular to a task processing method, apparatus, electronic device, computer-readable storage medium, and computer program product. Background Technology
[0002] Currently, large-scale language models are widely used to process various natural language instructions. To cope with increasingly complex processing needs, such as integrating multiple information sources and processing long documents, the tasks to be processed by the language model can be decomposed. However, when performing partitioning operations on a task, related technologies typically rely on fixed rules. The width and granularity of the partitions cannot match the actual difficulty of the task, resulting in the partitioning operation being unable to perceive the characteristics of the task itself, exhibiting a degree of randomness, affecting the efficiency and rationality of the entire task decomposition, and further leading to low efficiency in the language model's result generation. Summary of the Invention
[0003] This application provides a task processing method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can improve the processing efficiency of language models for tasks.
[0004] The technical solution of this application embodiment is implemented as follows: This application provides a task processing method, the method comprising: Obtain natural language instructions and convert the natural language instructions into a task to be processed by a pre-trained language model; The task to be processed is divided into multiple first subtasks, and the multiple first subtasks are used as tasks to be divided. For each task to be partitioned, the following partitioning operation is performed: The complexity of the task to be partitioned is determined based on at least one preset complexity index; the target number of task levels to be partitioned for the task to be partitioned is determined based on the complexity of the task to be partitioned; and... The task to be divided is divided into the target number of second sub-tasks; For each second subtask, if the complexity of the second subtask is greater than or equal to a preset complexity threshold, then the second subtask is taken as a new task to be divided, and the division operation is recursively executed until an atomic task with a complexity less than the complexity threshold is obtained. A task tree is constructed based on the hierarchical relationship between the task to be processed, each first subtask, each second subtask, and the atomic tasks. The language model is then invoked to execute the task tree, and the result of responding to the natural language instruction is obtained.
[0005] This application provides a task processing device, the device comprising: The instruction conversion module is used to acquire natural language instructions and convert the natural language instructions into a task to be processed by a pre-trained language model. The first partitioning module is used to partition the task to be processed into multiple first subtasks, and the multiple first subtasks are used as tasks to be partitioned. The second partitioning module is used to perform the following partitioning operations for each of the tasks to be partitioned: determining the complexity of the task to be partitioned according to at least one preset complexity index, determining the target number of task levels to be partitioned for the task to be partitioned based on the complexity of the task to be partitioned, and partitioning the task to be partitioned into the target number of second subtasks. The recursive partitioning module is used to, for each second subtask, if the complexity of the second subtask is greater than or equal to a preset complexity threshold, treat the second subtask as a new task to be partitioned, and recursively execute the partitioning operation until an atomic task with a complexity less than the complexity threshold is obtained. The task execution module is used to construct a task tree based on the hierarchical relationship between the task to be processed, each first subtask, each second subtask, and the atomic tasks, and to call the language model to execute the task tree to obtain the result of responding to the natural language instruction.
[0006] This application provides an electronic device, the electronic device comprising: Memory is used to store executable instructions or computer programs. The processor, when executing computer-executable instructions or computer programs stored in the memory, implements the task processing method provided in the embodiments of this application.
[0007] This application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the task processing method provided in this application when executed by a processor.
[0008] This application provides a computer program product, including a computer program or computer executable instructions. When the computer program or computer executable instructions are executed by a processor, they implement the task processing method provided in this application.
[0009] The embodiments of this application have the following beneficial effects: The task to be processed is divided into multiple first subtasks using a language model. The complexity of each subtask is determined based on a preset complexity metric. The target number of second subtasks to be decomposed is then determined based on this complexity. A complexity threshold controls the termination of the recursive decomposition operation, constructing a task tree through multiple levels of tasks. The language model is then invoked to execute the task tree and obtain the result. By introducing at least one complexity metric and determining the target number of second subtasks based on it, the task decomposition process can intelligently adapt to tasks of varying difficulty. For complex tasks, it can automatically perform deeper and broader decompositions; for simple tasks, it can converge quickly. This adaptive capability ensures that each decomposition operation is efficient and targeted, improving the rationality of task decomposition and resource utilization efficiency. By setting a clear complexity threshold as the condition for recursive termination, it avoids the language model from handling unsuitable, highly complex tasks due to improper task decomposition, thus ensuring the high quality of the entire task tree execution process and ultimately improving the accuracy of responses to user natural language commands. Attached Figure Description
[0010] Figure 1 This is a schematic diagram of the architecture of the task processing system 100 provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of the server 200 provided in the embodiments of this application; Figure 3A This is a first flowchart illustrating the task processing method provided in the embodiments of this application; Figure 3B This is a second flowchart illustrating the task processing method provided in the embodiments of this application; Figure 3C This is a third flowchart illustrating the task processing method provided in the embodiments of this application; Figure 3D This is a fourth flowchart illustrating the task processing method provided in the embodiments of this application; Figure 3E This is a fifth flowchart illustrating the task processing method provided in the embodiments of this application; Figure 3F This is a sixth flowchart illustrating the task processing method provided in the embodiments of this application; Figure 3G This is a seventh flowchart illustrating the task processing method provided in the embodiments of this application; Figure 3H This is the eighth flowchart of the task processing method provided in the embodiments of this application; Figure 3I This is a ninth flowchart illustrating the task processing method provided in the embodiments of this application; Figure 3JThis is a schematic diagram of the tenth process of the task processing method provided in the embodiments of this application; Figure 3K This is a schematic diagram of the eleventh step of the task processing method provided in the embodiments of this application; Figure 3L This is a schematic diagram of the twelfth step of the task processing method provided in the embodiments of this application; Figure 3M This is a schematic diagram of the thirteenth step of the task processing method provided in the embodiments of this application; Figure 3N This is a schematic diagram of the fourteenth process of the task processing method provided in the embodiments of this application; Figure 3O This is a schematic diagram of the fifteenth process of the task processing method provided in the embodiments of this application; Figure 4 This is a schematic diagram illustrating the principle of multiple complexity indicators jointly determining complexity provided in the embodiments of this application; Figure 5 This is a flowchart illustrating the process of recursively dividing the task to be divided into atomic tasks, as provided in an embodiment of this application. Figure 6 This is a schematic diagram of the task tree structure provided in an embodiment of this application; Figure 7 This is a schematic diagram of the process for extracting auxiliary information through memory entries associated with other tasks, provided in an embodiment of this application. Figure 8 This is a schematic diagram illustrating the storage, updating, and use of the working memory unit provided in the embodiments of this application; Figure 9 This is a schematic diagram illustrating reasoning and question answering using an optimized language model, as provided in an embodiment of this application.
[0011] It should be noted that the terms "first" and "second" mentioned above are only used to distinguish between different options and do not represent the degree of superiority or inferiority of the options or their priority in the implementation process. Detailed Implementation
[0012] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0013] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0014] In the following description, the terms "first / second / third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first / second / third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0015] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0016] Unless otherwise specified, "at least one" as used below refers to one or more cases, and "multiple" can refer to two or more cases.
[0017] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application.
[0018] In the implementation of this application, the collection and processing of relevant data should strictly comply with the requirements of relevant laws and regulations, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.
[0019] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0020] 1) Human-computer interaction interface, which is an interface used to provide human-computer interaction functions / an interface to display natural language commands and results.
[0021] For example, graphical user interfaces (GUIs) include augmented reality (AR) interfaces, virtual reality (VR) interfaces, voice user interfaces (VUIs), interactive projection interfaces (using projection technology to display information on a flat surface), eye-tracking interfaces (interfaces controlled by detecting the user's gaze), holographic interfaces (three-dimensional holograms formed by projecting images using holographic projection technology, allowing users to see stereoscopic images without wearing special glasses), multimodal interfaces (interfaces that combine multiple interaction methods, such as tactile, visual, and auditory interaction), and brain-machine interfaces (BMIs).
[0022] 3) Atomic tasks refer to task units in task processing methods that, after recursively performing partitioning operations on the task to be partitioned, have a final complexity less than a preset complexity threshold. These task units are the smallest execution entities that cannot be further divided into smaller subtasks and are directly invoked and executed by the pre-trained language model to generate the corresponding task results. The role of atomic tasks is to serve as the basic building blocks after decomposing complex natural language instructions, ensuring that the language model focuses on simple and controllable operations during processing, thereby avoiding excessive computational burden and improving overall response efficiency. For example, in the process of building a task tree, when the complexity of a second subtask is lower than the complexity threshold, it will be considered an atomic task and included in the leaf node position of the task tree.
[0023] 4) Depth refers to the level of logical reasoning involved in the task to be partitioned. It is determined by identifying multiple specific syntactic nodes representing logical relationships in the syntax tree obtained from syntactic analysis of the instruction text, and using the sum of the levels of these nodes in the syntax tree as a semantic abstraction index. This index quantifies the logical complexity of the task, helping to determine the target number of task levels to be partitioned based on complexity. Its role is to guide the recursive process of task partitioning, enabling the system to perform more detailed decomposition of highly abstract tasks, thereby optimizing the execution path of the language model.
[0024] 5) Density refers to the degree of concentration of entities within the text information associated with the task to be segmented. Entity density is calculated by dividing the text information into predefined categories and using the ratio of the number of entities in each category to the text length. Information entropy is then determined based on the frequency of occurrence of entities after the text information is segmented into multiple words, resulting in a comprehensive information density index. This index, as part of complexity assessment, reflects the concentration and richness of task-related information, thus influencing the decision to determine the number of targets based on complexity. Density helps the system identify information-intensive tasks, preventing the language model from losing accuracy due to information overload.
[0025] 6) Pre-determined variables refer to multiple variables that depend on operations performed based on external interface calls. These variables need to be checked for values before task execution to identify target variables without values and count their number, which is used to calculate the external dependency coupling degree metric. This metric is determined based on the number of interfaces and variables and is used to assess the complexity of the task's dependency on external resources, thereby guiding the partitioning of operations. The role of pre-determined variables is to reveal potential execution obstacles, ensuring that the system can handle dependencies in advance when building the task tree, and improving the success rate of language model calls.
[0026] 7) The working memory unit is an initial storage structure built in the task processing method. It is used to parse the initial context information obtained from natural language instructions, including global constraints and instruction intent, and write structured data associated with task results generated from executed tasks and node identifiers. It also retrieves associated data as auxiliary information to aid language model reasoning when executing other tasks in the task tree. It supports dynamic updating and deletion of redundant fragments to maintain optimization when memory usage efficiency indicators fall below a preset efficiency threshold. The role of the working memory unit is to provide persistent context management, support cross-level information transfer and reuse, thereby improving the accuracy and efficiency of reasoning for complex tasks.
[0027] 8) Memory entries are structured data obtained by associating task results generated based on a task with the node identifier of that task in the task tree. After execution, these entries are written to the storage structure. This includes historical data or updated data obtained through semantic fusion with historical data, as well as parent node data obtained by aggregating task results when other nodes at the same level and belonging to the same parent node have been executed. It supports dividing the data into multiple segments to determine the first relevance and deleting redundant segments below a preset relevance threshold to obtain new data. The purpose of memory entries is to record execution history and support retrieval as auxiliary information through second relevance during reasoning in other tasks, thereby achieving dynamic management and sharing of information.
[0028] 9) Memory summary refers to the final answer or summary generated by the current task's reasoning. Representing high-level semantics, it is part of a pruned, structured fusion, obtained by refining the task results, and used for efficient storage and retrieval of key conclusions. As a major component of the final task memory, it supports rapid access to core content in cross-level reuse mechanisms to reduce redundant computation. The role of memory summary is to simplify the representation of complex information, facilitating the provision of concise support in higher-level tasks, thereby improving reasoning efficiency.
[0029] 10) Memory evidence refers to the necessary factual data that supports conclusions and is selected and retained from the memories of sub-tasks. It represents underlying details and is part of a pruned, structured fusion. It is obtained by comparing the current required context with existing contexts and selectively retaining relevant content. It supports reasoning in the reuse mechanism in conjunction with the current context to provide supporting evidence for conclusions. The role of memory evidence is to ensure the traceability and accuracy of reasoning, avoid excessive reduction of important information, and thus enhance the coordination of multi-level tasks.
[0030] When performing partitioning operations on a task to be partitioned, related technologies typically rely on fixed rules. The width and granularity of the partitions cannot match the actual difficulty of the task, resulting in the partitioning operation being unable to perceive the characteristics of the task itself. This leads to a lack of awareness and is considered blind, affecting the efficiency and rationality of the entire task decomposition, which in turn results in low efficiency in language model generation.
[0031] Based on the above analysis, the applicant found that the task processing methods of related technologies cannot efficiently divide and process tasks in language models. In order to address the above problems, this application provides a task processing method that can improve the processing efficiency of language models for tasks.
[0032] The following describes exemplary applications of the electronic devices provided in the embodiments of this application. These electronic devices can be implemented as various types of terminals such as laptops, tablets, desktop computers, set-top boxes, smartphones, smart speakers, smartwatches, smart TVs, and in-vehicle terminals, or as servers. The following will describe exemplary applications when the electronic device is implemented as a server.
[0033] See Figure 1 , Figure 1 This is a schematic diagram of the architecture of the task processing system 100 provided in the embodiments of this application. In order to support a task processing application, the terminal 400 connects to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.
[0034] Terminal 400 is used to respond to input operations for natural language commands by displaying the natural language commands on the human-computer interaction interface 410 and sending them to server 200. Server 200 is used to convert the natural language commands into tasks to be processed by a pre-trained language model, divide the tasks to construct a task tree, call the language model to execute the task tree, obtain the results in response to the natural language commands, and send the results to terminal 400 for display on the human-computer interaction interface 410.
[0035] In some embodiments, server 200 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Terminals and servers can be connected directly or indirectly via wired or wireless communication, which is not limited in this embodiment.
[0036] See Figure 2 , Figure 2 This is a schematic diagram of the structure of the server 200 provided in the embodiments of this application. Figure 2 The server 200 shown includes at least one processor 210, memory 230, and at least one network interface 220. The various components of server 200 are coupled together via a bus system 240. It is understood that the bus system 240 is used to implement communication between these components. In addition to a data bus, the bus system 240 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 2 The general labeled all buses as Bus System 240.
[0037] Processor 210 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0038] The memory 230 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 230 may optionally include one or more storage devices physically located away from the processor 210.
[0039] The memory 230 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 230 described in this application embodiment is intended to include any suitable type of memory.
[0040] In some embodiments, memory 230 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0041] Operating system 231 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks; The network communication module 232 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 220, exemplary network interfaces 220 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc. In some embodiments, the apparatus provided in this application can be implemented in software. Figure 2 A task processing device 233 stored in memory 230 is shown. This device can be software in the form of programs and plug-ins, and includes the following software modules: instruction conversion module 2331, first partitioning module 2332, second partitioning module 2333, recursive partitioning module 2334, and task execution module 2335. These modules are logically related and can therefore be arbitrarily combined or further divided according to their implemented functions. The functions of each module will be described below.
[0042] In some embodiments, the terminal or server can implement the task processing method provided in this application by running various computer-executable instructions or computer programs. For example, computer-executable instructions can be microprogram-level commands, machine instructions, or software instructions. Computer programs can be native programs or software modules in an operating system; they can be native applications (APPs), i.e., programs that need to be installed in the operating system to run, such as a question-and-answer APP; or they can be applets that can be embedded in any APP, i.e., programs that only need to be downloaded to a browser environment to run. In summary, the aforementioned computer-executable instructions can be any form of instruction, and the aforementioned computer programs can be any form of application, module, or plugin.
[0043] The task processing method provided in this application will be described in conjunction with exemplary applications and implementations of the server provided in the embodiments of this application.
[0044] See Figure 3A , Figure 3A This is a first flowchart illustrating the task processing method provided in this application embodiment, with the server as the main component, and combining... Figure 3A The steps shown are explained.
[0045] In step 101, natural language instructions are obtained and converted into a task to be processed by a pre-trained language model.
[0046] In some embodiments, the system receives natural language instructions in text form input from the user, or receives voice input from the user and converts the voice into natural language instructions in text form. Preliminary syntactic and semantic analysis is performed on the natural language instructions to identify structured elements, such as core verbs, key nouns, and various constraints. These analyzed structured elements are then encapsulated into a predefined, machine-readable data format, such as a JavaScript Object Notation (JSON) object containing task type, target parameters, and constraints; this object serves as the task to be processed by the pre-trained language model. Before converting the natural language instructions into the task to be processed by the pre-trained language model, the following processing can also be performed: a lightweight classification model is used to determine the intent category of the natural language instructions, such as information query, content generation, or complex logical reasoning; based on the determined intent category, a priority label is attached to the generated task to be processed. This label can be used to dynamically allocate computing resources and prioritize high-priority tasks during subsequent task tree execution.
[0047] For example, a natural language instruction might be: "Compare the camera configurations and battery life of smartphones A and B, and summarize them in a table." This instruction would be converted into a task with the following data structure: {Task type: "Comparative Analysis", Target objects: ["Phone A", "Phone B"], Comparison dimensions: ["Camera configuration", "Battery life"], Output format: "Table"}.
[0048] In step 102, the task to be processed is divided into multiple first subtasks, and the multiple first subtasks are used as tasks to be divided.
[0049] In some embodiments, the logical structure within the task to be processed is analyzed, particularly the parallel relationships or implicit sequence of steps contained therein. For example, by identifying conjunctions (such as "and") or verb phrases in the instructions, a complex request is decomposed into multiple single action units. Each action unit is constructed as a first subtask, forming an initial list containing multiple first subtasks. Each first subtask in the initial list will serve as a task to be partitioned in the subsequent processing flow. During partitioning, not only are multiple action units identified, but the execution dependencies between them can also be analyzed. For example, if one task depends on the result of another task to begin, a directed acyclic graph can be constructed to represent these dependencies. The first subtasks thus partitioned not only represent the decomposition of actions but also contain a preliminary plan of the execution logic, providing richer information for the subsequent construction of the task tree.
[0050] Following the example of step 101 above, the task to be processed can be divided into three first sub-tasks. For example, first sub-task 1: "Query the camera configuration and battery life information of smartphone A"; first sub-task 2: "Query the camera configuration and battery life information of smartphone B"; first sub-task 3: "Compare the obtained information and summarize it in tabular form". These three first sub-tasks are used as the tasks to be divided.
[0051] In step 103, the following partitioning operation is performed for each task to be partitioned: the complexity of the task to be partitioned is determined according to at least one preset complexity index; the target number of task levels to be partitioned is determined based on the complexity of the task to be partitioned; and the task to be partitioned is divided into the target number of second subtasks.
[0052] In some embodiments, an instruction input is constructed to guide the partitioning operation. This instruction input combines the text content of the task to be partitioned with a clear, structured instruction. This instruction explicitly instructs the pre-trained language model to perform a decomposition task and emphasizes that the number of second subtasks generated must be strictly equal to the given target number. The instruction also requires the model to attach a unique numerical code to each generated second subtask for subsequent processing. This constructed instruction input is passed to the pre-trained language model. Upon receiving the instruction input, the language model uses its internal knowledge and understanding of high-level instructions to perform semantic analysis and logical decomposition of the input task to be partitioned. It identifies multiple separable execution steps or processing objects within the task and, based on the target number requirement, summarizes or subdivides these steps or objects, ultimately generating a text describing the second subtasks that conforms to the instruction requirements and contains multiple numbers. The text output generated by the language model is then received. Since the preceding instruction already includes formatting requirements, a simple parsing program can segment and extract the content based on the numerical codes in the text. The parsing program identifies each code and recognizes all text content from one code to the next as an independent second subtask.
[0053] For example, if the target number of task levels to be divided is determined to be 2 based on the complexity of the task to be divided, "querying the camera configuration and battery life information of smartphone A", then the task to be divided is divided into two second subtasks, namely: "querying the camera configuration of smartphone A" and "querying the battery life information of smartphone A".
[0054] In some embodiments, see Figure 3B , Figure 3B This is a second flowchart illustrating the task processing method provided in the embodiments of this application. Figure 3A Step 103, "Determine the complexity of the task to be divided based on at least one preset complexity index," can be achieved through... Figure 3B Steps 1031 to 1035 are implemented, and the details are explained below.
[0055] In step 1031, the number of characters in the text information associated with the task to be divided is determined, and the ratio of the number of characters to the upper limit of the processing window preset by the language model is used as the context length index.
[0056] In some embodiments, all text information directly related to the current task to be divided is located and obtained, including the description text of the task itself and the background information text that must be relied upon to execute the task; a standard character counting function is called to accurately count the total number of characters in this text information. At the same time, a preset value is read from the configuration, which represents the maximum number of characters that the language model used can effectively process, i.e., the character limit of the processing window; the total number of characters counted is divided by this character limit, and the calculated ratio is the context length index.
[0057] For example, a task to be partitioned is "to summarize a 6000-character review report on mobile phone A". The language model's default processing window has a character limit of 8000 characters. The calculated context length metric is 6000 / 8000 = 0.75.
[0058] In step 1032, the depth of logical reasoning for the task to be divided is determined as an indicator of semantic abstraction.
[0059] Here, the depth of logical reasoning measures the number of sequentially executed, dependent logical reasoning steps required to complete a task. Tasks with lower depth values have linear and direct execution paths, typically corresponding to single operations or simple information retrieval, without requiring intermediate state derivations. Tasks with higher depth values, on the other hand, require the construction of a complex execution plan internally, containing multiple interconnected reasoning nodes. For example, a task that requires first performing conditional judgments, then executing different branch operations based on different judgment results, and finally aggregating the branch results. The depth value quantifies the length of the longest logical chain that must be traversed from the initial state to the final result in this execution plan.
[0060] In some embodiments, see Figure 3C , Figure 3C This is a schematic diagram of the third process of the task processing method provided in the embodiments of this application. Figure 3B Step 1032, "Determining the depth of logical reasoning for the task to be divided," can be achieved through... Figure 3C Steps 10321 to 10323 are implemented, and the details are explained below.
[0061] In step 10321, the instruction text of the task to be divided is subjected to syntactic analysis to obtain a syntax tree representing the syntactic structure of the task to be divided.
[0062] In some embodiments, the instruction text of the task to be segmented is taken as input and passed to a dependency parser. The parser contains a pre-trained deep learning model that has learned the grammatical structure rules of a large number of texts. The parser segments the input instruction text and identifies the part of speech of each word. The deep learning model analyzes the grammatical dependencies between words, such as which word is the core verb, which word is the subject or object of the verb, and which word modifies another word. The parser outputs a structured data, which clearly represents the hierarchy and dependencies between all words in the instruction text in the form of a graph or nested list. This structured data is the syntax tree that represents the grammatical structure of the task to be segmented.
[0063] For example, the instruction text for the task to be divided is: "Compare the camera configuration and battery life of smartphones A and B, and summarize them in a table." After processing by the dependency parser, a syntax tree is obtained, with the core verbs "compare" and "summarize" as the main nodes. The syntax tree clearly shows that "smartphones A and B" is the object of "compare," and "camera configuration and battery life" is another parallel object. At the same time, "summarize" and "compare" are parallel predicates.
[0064] In step 10322, multiple specific syntax nodes representing logical relations are identified from the syntax tree.
[0065] In some embodiments, a rule base is maintained, which defines the feature patterns of specific grammatical nodes to be identified. These patterns include: the part of speech of the node (e.g., conjunctions, conditional adverbs), the word itself of the node (e.g., "and", "or", "if"), or specific dependencies between nodes (e.g., parallel relationships, conditional clause relationships). The entire syntax tree is traversed using a depth-first or breadth-first strategy, examining the attributes and relationships of each node and its child nodes. When a node's features match a pattern in the rule base, the node is identified as a specific grammatical node representing a logical relationship and added to a results list. Alternatively, a graph neural network model trained on a large number of labeled syntax trees can be utilized. This model can learn more complex and generalized structural patterns representing logical relationships. The syntax tree is input into the graph neural network model as a graph structure. The model automatically calculates the probability that each node belongs to a logical relationship node, sets a probability threshold, and identifies all nodes with probabilities higher than the threshold as specific grammatical nodes. This method can discover more subtle expressions of logical relationships that are difficult to cover with hard-coded rules, improving the accuracy and generalization ability of identification.
[0066] For example, in the syntax tree of “comparing the camera configuration and battery life of smartphones A and B and summarizing them in a table”, the following specific syntax nodes will be identified through rule matching: the conjunction “and” connecting “A” and “B”, which represents a parallel relationship; the conjunction “and” connecting “camera configuration” and “battery life”, which also represents a parallel relationship; and the conjunction “and” connecting the two core actions of “comparing” and “summarizing”, which represents a sequential or parallel logical relationship.
[0067] In step 10323, the level of each specific syntax node in the syntax tree is determined, and the sum of the levels of at least one specific syntax node is used as the depth of logical reasoning for the task to be divided.
[0068] In some embodiments, a level calculation standard is defined for the syntax tree. Typically, the level of the root node is defined as 1, the level of its direct child nodes is 2, and so on. All specific syntax nodes are traversed, and according to this standard, the depth of each specific syntax node in the syntax tree is determined, i.e., its level. The level values of all these identified specific syntax nodes are summed to obtain the depth of logical reasoning for the task to be divided.
[0069] For example, suppose that in the example syntax tree, the root node level is 1, the conjunction "and" connecting "comparison" and "summary" is at level 2, the conjunction "and" connecting "Type A" and "Type B" is at level 3, and the conjunction "and" connecting "camera configuration" and "battery life" is also at level 3. Summing up the levels of these specific syntax nodes, that is, 2+3+3=8, the final depth of logical reasoning for the task to be divided is determined to be 8.
[0070] This application's embodiments, through in-depth syntactic structural analysis of instruction text, can understand the inherent logical relationships at the skeletal level of sentences. This syntax tree-based analysis can accurately distinguish instructions with different syntactic structures but similar surface words, such as the logical difference between "search for A and B" and "search for B in A." This ensures that the assessment of logical depth is based on a structured understanding of the true intent of the instruction, rather than a fuzzy match of surface text, making the assessment results extremely reliable. It transforms an abstract concept of logical complexity into a completely objective and quantifiable computational process. From generating the syntax tree to identifying specific nodes and calculating hierarchical summation, each step is deterministic and reproducible. The computational process of the final output depth can be clearly traced and explained. For example, it can be clearly identified which logical connectors and their positions in the sentence structure jointly lead to the increased complexity. This quantitative interpretability provides precise data input and transparent decision-making basis for subsequent task partitioning strategies.
[0071] See also Figure 3BIn step 1033, the text information associated with the task to be divided is parsed to obtain multiple entities in the text information, the density of the entities in the text information is determined, and the information density index is determined based on the density.
[0072] In some embodiments, all text information associated with the task to be divided is integrated to form a complete text to be parsed. This text is then input into a named entity recognition model, which has been pre-trained with a large amount of labeled data to identify words or phrases in the text that belong to different preset categories. These preset categories may include product names, performance parameters, technical standards, organizations, etc. The named entity recognition model performs sequence labeling on the input text to be parsed, analyzes the words in the text one by one, and assigns a corresponding category label to each word that is identified as an entity. For example, the model will label "A model smartphone" as the "product name" category and "5000mAh" as the "performance parameter" category. All words or phrases that have been categorized are collected and output as the parsed results to obtain all entities that conform to the preset categories extracted from the original text information.
[0073] Here, the text information associated with the task to be partitioned refers to the sum of all text content necessary for a complete and accurate understanding, evaluation, or execution of a specific task. This mainly includes the task's own descriptive text and the contextual information required to execute the task. The task's own descriptive text is the natural language string contained within the task itself, describing its objectives, operations, and constraints. For example, in the task "Summarize the evaluation report of model A mobile phone," the phrase "Summarize the evaluation report of model A mobile phone" is itself part of its associated text information. The contextual information required to execute the task refers to the background information or input data acquired before executing the current task, which is necessary to complete the current task. This information also exists in text form. For example, for the task "Summarize the evaluation report of model A mobile phone," if a previous step has obtained a long evaluation report of several thousand words, then the entire content of this report belongs to the text information associated with the task "summarize." Entity density in text information measures the density of structured information units that need to be accurately identified and understood within a unit length of text information. Low-density text primarily consists of unstructured natural language descriptions, with key information units distributed relatively discretely. High-density text, on the other hand, is characterized by a high concentration of proper nouns, technical specifications, parameter values, or other predefined key information categories within a limited space. A higher density value indicates that the language model needs to perform more frequent entity linking, knowledge base queries, and information relationship construction when processing this text, resulting in a corresponding increase in cognitive and computational load.
[0074] For example, the task to be segmented is "querying the camera configuration of smartphone A". The associated text information could be a product description: "Smartphone A uses xx sensor as its main camera, with a resolution of 50 million pixels, and is equipped with a 12-megapixel ultra-wide-angle lens and a 32-megapixel front-facing camera." This descriptive text is input into a named entity recognition model. The named entity recognition model performs sequence labeling on the text and identifies the following content: for example, "Smartphone A" is categorized as "product name", "xx" as "technical specifications", "main camera" as "component name", "50 million" as "performance parameters", "12 million pixels" as "performance parameters", "ultra-wide-angle lens" as "component name", "32 million pixels" as "performance parameters", and "front-facing camera" as "component name". Collecting these labeled contents yields multiple entities in the text information.
[0075] In some embodiments, see Figure 3D , Figure 3DThis is a schematic diagram of the fourth process of the task processing method provided in the embodiments of this application. Figure 3B Step 1033, "Determine the density of entities in text information and determine the information density index based on the density," can be achieved through... Figure 3D Steps 10331 to 10334 are implemented, and the details are explained below.
[0076] In step 10331, the number of entities of the preset categories included in the text information is counted.
[0077] In some embodiments, a pre-trained named entity recognition model is loaded, which has defined a series of preset categories, such as "product name", "technical specifications", "performance parameters", etc. The text information to be processed is passed to the named entity recognition model as input. The named entity recognition model segments the text into words and analyzes each word or phrase to determine whether it belongs to any preset category. For each identified entity, the named entity recognition model labels it with the corresponding category tag. The output results of the named entity recognition model are traversed, and all entities successfully labeled as any preset category are counted to obtain the number of entities.
[0078] For example, the associated text information is: "Smartphone A is equipped with a 5000mAh battery and 65W fast charging technology, and its main camera is 50 megapixels." Using a named entity recognition model, entities belonging to preset categories are identified, such as Smartphone A (product name), 5000mAh (performance parameter), battery (component name), 65W (performance parameter), fast charging technology (technical specifications), main camera (component name), and 50 megapixels (performance parameter). The number of entities in the preset categories is counted, resulting in 7 entities.
[0079] In step 10332, the ratio of the number of entities to the length of the text information is determined as the entity density.
[0080] In some embodiments, a standard text processing function is used to calculate the total length of the same text information. This length can be calculated according to a preset standard, such as the total number of characters, words, or tokens. The number of entities is used as the dividend, and the length of the text information is used as the divisor. A division operation is performed, and the quotient, a floating-point number representing the average number of entities per unit length, is determined as the entity density. Before directly calculating the ratio, the length of the text information can be normalized. For example, a standard text unit length (e.g., 100 words) can be defined. When calculating the ratio, the denominator is no longer the absolute length of the text information, but rather the number of standard text units contained in that text information. This normalization process can eliminate density value fluctuations caused by large differences in the absolute length of the text, making the entity densities calculated from texts of different lengths more comparable and more stably reflecting the density of information.
[0081] For example, the number of entities is 7. Assuming the length of the text is calculated to be 30 words, the ratio of the number of entities to the length of the text is approximately 7 / 30 ≈ 0.233, and the final entity density of the text is determined to be approximately 0.233.
[0082] In step 10333, the text information is divided into multiple words, the frequency of each word in the text information is determined, and the information entropy of the text information is determined based on the frequency of occurrence.
[0083] In some embodiments, a word segmentation tool is invoked to precisely divide the input text information into a list consisting of multiple words; the list is processed to count the number of occurrences of each unique word, and the count is divided by the total number of words to obtain the frequency of each word in the text information; for each unique word, its frequency is calculated as the product of its frequency and the logarithm of that frequency to base 2; the products calculated for all unique words are summed, and the sum is negative to obtain the information entropy of the text information. Information entropy can be corrected by performing the following steps: Vectorize all words in the text to obtain word vectors for each word, and calculate the mean cosine distance of these word vectors in the vector space. This calculation result reflects the semantic dispersion of the words in the text. The mean cosine distance is weighted and combined with the information entropy to obtain the corrected information entropy. The corrected information entropy is used together with entity density to determine the information density index. The corrected information entropy can distinguish between two texts with similar word frequency distributions but large differences in semantic connotation. For example, a text that repeatedly uses synonyms (low semantic diversity) and a text that uses vocabulary from different domains (high semantic diversity) will have different corrected information entropies.
[0084] For example, in the sample text "Model A smartphone is equipped with a 5000mAh battery and 65W fast charging technology, and its main camera is 50 megapixels", there are approximately 30 words in total. Assuming that there are 25 unique words after word segmentation, the frequency of each unique word is calculated. For example, the frequency of "Model A smartphone" is 1 / 30, the frequency of "equipped with" is 1 / 30, etc. Based on these frequencies, a value is calculated using the Shannon entropy formula, for example, 3.8. This value is the information entropy of the text information.
[0085] In step 10334, the information density index is determined based on entity density and information entropy.
[0086] In some embodiments, two preset, fixed weighting coefficients are obtained, one for entity density and the other for information entropy. The sum of these two weighting coefficients is usually 1. The first product of the entity density value and its corresponding weighting coefficient is determined, and the second product of the information entropy value and its corresponding weighting coefficient is determined. The sum of the first product and the second product is used as the final information density index.
[0087] For example, the entity density is 0.233, the information entropy is 3.8, and in the system configuration, the weight of entity density is 0.6, the weight of information entropy is 0.4, the first product of the entity density value and its corresponding weight coefficient is 0.233 * 0.6 = 0.1398, the second product of the information entropy value and its corresponding weight coefficient is 3.8 * 0.4 = 1.52, and the sum of the first and second products is 0.1398 + 1.52 = 1.6598, that is, the information density index is 1.6598.
[0088] This application's embodiments accurately capture the number of structured, directly identifiable key knowledge points in a text through the dimension of entity density, reflecting the concentration of information. Simultaneously, it measures the diversity and uncertainty of the text's vocabulary through the dimension of information entropy, reflecting the breadth of information and the complexity of expression. Considering both orthogonal dimensions allows for a more comprehensive and profound assessment of the text's information content. By combining entity density and information entropy, higher robustness and discriminability are achieved. For example, this method can clearly distinguish the information complexity of a technical manual (high entity density, information entropy may be moderate due to standardized terminology) and a literary review (low entity density, but high information entropy), a discriminatory ability that is difficult to achieve with a single-dimensional indicator.
[0089] See also Figure 3B In step 1034, the number of external interfaces to be called for executing the tasks to be divided is counted, and the external dependency coupling index is determined based on the number of interfaces.
[0090] In some embodiments, a mapping rule base is pre-built and maintained. This mapping rule base defines various text patterns of object intents and their corresponding external interface identifiers that need to be called. For example, it includes text patterns such as "query... price" and "... how much is the price of...", and maps them uniformly to a price query interface. The description text of the task to be divided is taken as input, and all text patterns in the mapping rule base are used to scan and match it. It is checked whether the text content of the task to be divided conforms to any one or more patterns defined in the mapping rule base. Whenever the text content of the task to be divided successfully matches a text pattern in the mapping rule base, the external interface identifier mapped to that pattern is found, and this identifier is recorded in a temporary interface set. To avoid duplicate counting, if a task to be divided matches a pattern pointing to the same external interface identifier multiple times, it is recorded only once in this set. After completing the scanning and matching of all patterns, the total number of non-duplicate external interface identifiers contained in this temporary interface set is counted, which is the number of external interfaces expected to be called to execute the task to be divided.
[0091] Here, an external interface is a data request and response process initiated during task execution to obtain data from an independent external information system in order to access non-local knowledge bases or non-static data. It defines the task's dependency on dynamic, real-time, or domain-specific data sources. The knowledge within the language model is a static snapshot up to its training date, while the external interface provides the ability to access information beyond these snapshots. Each external interface call represents an interruption and wait in the main processing flow, requiring the system to engage in a complete, network-protocol-based data interaction with an external Application Programming Interface (API) that provides specific functionality (such as real-time data querying or third-party service calls). The number of external interfaces required by a task directly reflects the degree of coupling between its execution flow and the external environment, as well as the number of dependencies on external data sources.
[0092] For example, the task to be divided is "to query the real-time price of smartphone A on platform A and platform B, and summarize its latest user reviews". Using a mapping rule base, the task description is scanned. "Query...price on platform A" matches a pattern in the rule base pointing to "e-commerce platform price query interface", and "e-commerce platform price query interface" is recorded in the temporary interface set. "Query...price on platform B" again matches a pattern pointing to "e-commerce platform price query interface". Since this interface identifier already exists in the set, it does not need to be queried again. "Summarize its latest user reviews" matches a pattern in the rule base pointing to "user review aggregation interface", and "user review aggregation interface" is recorded in the temporary interface set. After the scan, the number of members in the temporary interface set is counted, resulting in a set {"e-commerce platform price query interface", "user review aggregation interface"}, totaling 2. Therefore, the number of external interfaces to be called for this task is determined to be 2.
[0093] In some embodiments, see Figure 3E , Figure 3E This is a fifth flowchart illustrating the task processing method provided in the embodiments of this application. Figure 3B Step 1034, "Determining the external dependency coupling index based on the number of interfaces," can be achieved through... Figure 3E Steps 10341 to 10344 are implemented, and the details are explained below.
[0094] In step 10341, the task to be divided is parsed to obtain multiple pre-variables that the operation based on calling external interfaces depends on.
[0095] In some embodiments, a series of operation templates related to external interface calls are predefined. Each template contains several slots, which represent the information necessary to perform the operation, i.e., pre-defined variables. The instruction text of the task to be divided is input into a semantic slot filling model. The model analyzes the semantics of the instruction text, aligns it with the best-matching operation template, and extracts the corresponding information from the text to fill the slots in the template. All slots that are successfully filled or identified by the model as needing to be filled but whose text does not provide information are used as multiple pre-defined variables on which the operation depends. Pre-defined variables refer to a set of structured, parameterized information units that must be obtained and provided in advance to successfully execute an operation related to an external interface call. "The state of a pre-defined variable is characterized as 'no value obtained'" means that after checking a pre-defined variable in the current task execution context, it is impossible to associate the pre-defined variable with a specific, valid value that can be directly used to execute the external interface call.
[0096] For example, the task to be divided is: "Help me check the latest price of smartphone A in region A". The operation template of "price query interface" can include the following pre-variable slots: {product name}, {query region}. After the semantic slot filling model parses the instruction text, it successfully fills the slots, that is, {product name} = "smartphone A" and {query region} = "region A". Therefore, the pre-variables obtained are "product name" and "query region".
[0097] In step 10342, a state detection is performed on each preceding variable to obtain the state of each preceding variable.
[0098] In some embodiments, a task execution context manager is maintained. This manager acts as a temporary in-memory database, storing all variables in the current task session that have been explicitly assigned or have their values retrieved, along with their corresponding values. When multiple prerequisite variables are obtained, they are iterated through one by one. For each prerequisite variable, a query is performed in the task execution context manager to check if there exists an entry with the same name as the prerequisite variable that has already been assigned a value. If the query is successful and a corresponding value is found, the status of the prerequisite variable is marked as "value retrieved"; if the query fails, i.e., the variable is not found in the manager or its value is empty, its status is marked as "value not retrieved".
[0099] For example, when performing a status check on the pre-variable "product name", it finds that the instruction explicitly provides "model A smartphone", and its status is "value obtained"; when performing a status check on the pre-variable "query region", it finds that the instruction explicitly provides "area A", and its status is "value obtained"; if the instruction is "help me check the price of model A smartphone here", when checking "query region", it will find the user's location "city A" from the context, and its status is also "value obtained".
[0100] In step 10343, if the state of the preceding variable is characterized as no value has been obtained, then the preceding variable is used as the target variable, and the number of variables of the target variable is counted.
[0101] In some embodiments, a temporary target variable list is created; all preceding variables that have undergone state checks are traversed. During the traversal, the state of each preceding variable is judged. If the state of a preceding variable is "no value obtained", this preceding variable is used as the target variable, and its name is added to the target variable list; if the state is "value obtained", no operation is performed; after the traversal is completed, the number of members in this target variable list is counted, and the final total count is the number of target variables.
[0102] For example, the task to be divided is: "Find recommended mobile phone repair shops nearby". The parsed pre-variables are: {service type} and {current location}. The status detection finds that: {service type} is filled with "mobile phone repair" and the status is "value obtained"; {current location} is not found in the context and the status is "value not obtained". The system takes {current location} with the status "value not obtained" as the target variable, counts the members in the target variable list, and finds that the number of variables is 1.
[0103] In step 10344, the external dependency coupling index is determined based on the number of interfaces and the number of variables.
[0104] In some embodiments, two preset weight coefficients are read from the configuration, one for the number of interfaces and the other for the number of variables. These two weight coefficients reflect the relative importance of "how many external systems need to be interacted with" and "how much information needs to be supplemented to the user for the purpose of interaction" when evaluating external dependencies. The third product of the number of interfaces and their corresponding weights is determined, and the fourth product of the number of variables and their corresponding weights is determined. The sum of the third and fourth products is used as the external dependency coupling index.
[0105] For example, a task to be partitioned, after analysis, is found to require calling 2 external interfaces (number of interfaces = 2), and there is 1 pre-defined variable whose value has not been obtained (number of variables = 1). Assuming the weight of the number of interfaces is 1.0 and the weight of the number of variables is 1.5, the third product of the number of interfaces and their corresponding weights is 2 * 1.0 = 2, the fourth product of the number of variables and their corresponding weights is 1 * 1.5 = 1.5, and the sum of the third and fourth products is 2 + 1.5 = 3.5, that is, the external dependency coupling index is 3.5.
[0106] This application's embodiments, by introducing pre-defined variables and their state detection, profoundly reveal two levels of external dependency: dependency on external systems (reflected by the number of interfaces) and dependency on external information (usually referring to users) (reflected by the number of unobtained variables). Because both levels of dependency are measured simultaneously, the evaluation results are more comprehensive and accurate, accurately distinguishing the actual processing difficulty difference between a multi-interface call task with complete information and a single-interface call task with missing information. By statistically analyzing the number of target variables, this method proactively predicts how many additional rounds of interaction the system might need with the user to complete the information in order to successfully complete the task. This predictive ability is not available by simply counting the number of interfaces. It makes the external dependency coupling index not only a measure of complexity but also an estimate of future interaction costs. Based on this estimate, the system can make more intelligent decisions, such as whether to start execution directly or initiate a clarifying dialogue first, thereby optimizing the task execution path and user experience.
[0107] See also Figure 3B In step 1035, the complexity of the task to be partitioned is determined based on at least one of the context length index, semantic abstraction index, information density index, and external dependency coupling index.
[0108] In some embodiments, if there is only one complexity metric, the value of that complexity metric is used as the complexity of the task to be partitioned; if there are at least two complexity metrics among context length, semantic abstraction, information density, and external dependency coupling, the at least two complexity metrics are weighted and summed to obtain the complexity of the task to be partitioned. For example, a set of preset weight coefficients is read from the configuration, each weight coefficient corresponding to a complexity metric, representing the importance of that complexity metric in the comprehensive complexity evaluation. The product of the value of each complexity metric and its corresponding weight coefficient is determined, and all products are summed to obtain the complexity of the task to be partitioned.
[0109] For example, see Figure 4 , Figure 4 This is a schematic diagram illustrating the principle by which multiple complexity metrics, provided in the embodiments of this application, jointly determine complexity. Figure 4 In this complexity calculation, the metrics include context length, semantic abstraction, information density, and external dependency coupling. These metrics are weighted and summed using a complexity calculation unit to obtain the complexity of the task to be divided. Assume that the scores for each metric of the task summarizing for phone A are: context length = 0.75, semantic abstraction = 2, information density = 0.8, and external dependency coupling = 0. The corresponding weights are 0.5, 1.5, 1.0, and 1.0, respectively. Then the final complexity is (0.75 * 0.5) + (2 * 1.5) + (0.8 * 1.0) + (0 * 1.0) = 0.375 + 3 + 0.8 + 0 = 4.175.
[0110] This application's embodiments abandon a single, vague complexity assessment method. Instead, it comprehensively deconstructs the task from four mutually orthogonal key dimensions: text length, logical depth, information density, and external dependencies. This multi-dimensional measurement system transforms complexity assessment from a subjective judgment into a data-driven, quantifiable, and interpretable refined process, providing an extremely reliable and robust decision-making basis for subsequent task partitioning. The calculation of each complexity indicator is an independent part, facilitating the introduction of new complexity indicators (e.g., sentiment complexity, multilingual complexity, etc.) or the dynamic adjustment of the weights of various indicators for specific application scenarios. This high degree of scalability and adaptability ensures that this method can flexibly cope with more diverse and complex task requirements in the future without reconstructing the entire system.
[0111] In some embodiments, see Figure 3F , Figure 3F This is a sixth flowchart illustrating the task processing method provided in this application embodiment. After step 102, "taking multiple first subtasks as tasks to be divided", for each task to be divided, it can be executed... Figure 3F Steps 201 to 203 determine the complexity of the task to be divided, which are explained in detail below.
[0112] In step 201, prompt words are constructed based on the task to be divided, wherein the prompt words are used to suggest the complexity of the task to be divided.
[0113] In some embodiments, one or more prompt word templates are predefined. These templates are designed text frames containing fixed guiding statements and multiple placeholders for inserting dynamic content. The description text of the task to be divided and related contextual information are used as dynamic content to fill the corresponding placeholders in the templates. The guiding statements in the templates explicitly instruct the language model receiving the prompt word that its goal is not to perform the task, but to analyze the task itself and output evaluation parameters related to complexity. The completed text is a structurally complete and clearly intended prompt word.
[0114] For example, the task to be divided is: "Compare the camera configuration and battery life of smartphones A and B, and summarize them into a table." Select a prompt word template for an analysis-type task, and fill in the task content. The resulting prompt word could be: "[System Instruction] You are a task complexity analysis assistant. Please do not perform the following task, but instead conduct an in-depth analysis of the task itself. [Task to be Analyzed] Compare the camera configuration and battery life of smartphones A and B, and summarize them into a table. [Analysis Dimensions] Please provide your evaluation from the following dimensions: number of logical reasoning steps, amount of background knowledge, and task completeness. [Output Format] Please strictly follow the above format and only output the evaluation parameters for each dimension."
[0115] In step 202, the language model is invoked based on the prompt words to perform multi-dimensional analysis of the prompt words and obtain the evaluation parameters for each dimension.
[0116] In some embodiments, see Figure 3G , Figure 3G This is a schematic diagram of the seventh process of the task processing method provided in the embodiments of this application. Figure 3F Step 202, "Based on the prompt words, call the language model to perform multi-dimensional analysis of the prompt words and obtain the evaluation parameters for each dimension," can be achieved through... Figure 3G Steps 2021 to 2023 will be implemented, as detailed below.
[0117] In step 2021, the language model is invoked based on the prompt words to perform inference operations on the task to be divided, and the inference path is obtained. The number of inference nodes included in the inference path is counted as an evaluation parameter for the inference step.
[0118] Here, after obtaining the reasoning path, which is an ordered text sequence consisting of multiple reasoning nodes representing independent thinking steps, a text parser is applied to process this sequence. The parser segments the entire text according to a predefined node separator (such as a newline character or a specific numbering format), decomposing the reasoning path into a list containing multiple string elements, where each string element corresponds to a reasoning node. The total number of elements in this list is calculated, and this total number is the number of reasoning nodes, which is directly used as an evaluation parameter for the reasoning steps.
[0119] For example, the language model performs inference operations on the task to be divided, "compare the camera configuration and battery life of smartphones A and B, and summarize them into a table." The resulting inference path can be: "Identify the task objective: compare the specific configurations of the two phones; decompose the comparison dimensions: camera configuration and battery life; obtain the camera and battery information of phone A; obtain the camera and battery information of phone B; compare on the camera dimension; compare on the battery life dimension; generate a table structure; fill the comparison results into the table." Analyzing the above inference path, 8 independent inference nodes are identified. Therefore, the total number of nodes is 8, and the inference step evaluation parameter is 8.
[0120] In some embodiments, see Figure 3H , Figure 3H This is the eighth flowchart of the task processing method provided in the embodiments of this application. Figure 3G Step 2021, "Based on prompt words, call the language model to perform inference operations on the task to be divided, and obtain the inference path," can be achieved through... Figure 3H Steps 20211 to 20213 are implemented, and the details are explained below.
[0121] In step 20211, the language model is invoked based on the prompt words to generate text, resulting in the first text unit, which is then used as the inference node to be generated.
[0122] In some embodiments, a cue word specifically designed to initiate inference path generation is constructed. This cue word not only contains a complete description of the task to be divided, but also includes an explicit guiding instruction at the end, such as "Step 1:" or "Task decomposition step 1:". This constructed cue word is used as input to call the language model, which is instructed to generate only one short text. After receiving the cue word containing the guiding instruction, the language model predicts and generates the first execution step or thinking unit after the guiding instruction based on its understanding of the task. This generated text, usually a phrase or sentence, is the first text unit, and the first text unit is used as the first inference node to be generated in the inference path.
[0123] For example, the constructed prompt is: "[Task]: Compare the camera configurations and battery life of smartphones A and B, and summarize them in a table.\n[Instruction]: Please list the logical reasoning steps to complete this task.\nStep 1:". After receiving this prompt, the language model generates text, and the first text unit obtained is: "Identify the core task as comparison operation and information summary". This text is captured and used as the first reasoning node to be generated.
[0124] In step 20212, the following logical reasoning is performed for each inference node to be generated: based on the generated inference node and the prompt word, the language model is called to perform text prediction to obtain a new inference node, and the new inference node is used as the inference node to be generated, and the logical reasoning is recursively executed until the language model generates the end marker.
[0125] In some embodiments, a continuously growing sequence of generated inference nodes is maintained. In each recursive loop, the original prompt word is concatenated with all currently generated inference node sequences to form a new, longer context input. This new context input is then passed to the language model, which is asked to make a new text prediction. Based on the current inference steps, the language model predicts the next step that logically conforms to standard grammatical logic. This newly predicted text is the new inference node. This new inference node is appended to the end of the sequence of generated inference nodes and used as the inference node to be generated in the next recursive loop. This process is repeated until the language model generates a preset, special end marker (e.g., a string like " " or "task planning completed"), at which point the recursive logical inference terminates.
[0126] Here, as the generated inference node sequence grows longer, using all historical nodes as context input each time increases computational cost and may exceed the model's processing window. To address this, before each recursive generation of a new inference node, a summarizing model is invoked to compress the currently generated inference node sequence, generating a concise summary that encapsulates the core content of the historical steps. In the next call to the language model for text prediction, the original prompts, the historical summary, and a few recent unsummarized inference nodes are used to form the context input. This method effectively controls the input length of each recursive call while preserving key historical logic, improving the efficiency and capability of generating long inference paths.
[0127] For example, the first recursion: Taking "...Step 1: Identify the core tasks as comparison operations and information summarization" as part of the context, the language model is invoked for text prediction, resulting in a new inference node: "Step 2: Determine the key dimensions of the comparison, namely the camera and the battery." The second recursion: Taking the longer text containing Step 1 and Step 2 as part of the context, the model is invoked again, resulting in a new inference node: "Step 3: Plan the order of information acquisition, A first, then B." This process continues until, in a certain recursion, the text generated by the language model is a preset end marker, such as " ".
[0128] In step 20213, multiple generated inference nodes are combined in the order of their generation to obtain an inference path.
[0129] In some embodiments, during the entire recursive execution of logical reasoning, each newly generated, non-terminal inference node is stored sequentially in an ordered data structure, such as a list or array, according to the order in which they were generated. When the recursive process terminates, this list completely preserves all the contents from the first text unit to the last valid inference node, and maintains their original generation order. This list is traversed, and each element in the list (i.e., each inference node) is connected with a preset delimiter (such as a newline character plus a number) to form a single, formatted string, which is the inference path.
[0130] For example, after the recursive process, the resulting ordered list is: ["Identify the core tasks as comparison operations and information summarization", "Determine the key dimensions of comparison, namely camera and battery", "Plan the order of information acquisition, A before B", ...]. Combining the elements in this list with newlines and numbers yields a string-based reasoning path: "1. Identify the core tasks as comparison operations and information summarization; 2. Determine the key dimensions of comparison, namely camera and battery; 3. Plan the order of information acquisition, A before B...".
[0131] This application's embodiments utilize an autoregressive recursive mechanism, where each step is generated based on the results of the previous step. This chain-like reasoning process improves the performance of language models on complex logical planning tasks because it decomposes a complex multi-step reasoning problem into a series of simple single-step prediction problems, thereby reducing the task's difficulty and making the generated reasoning path more logically coherent and reasonable. It explicitly and step-by-step externalizes a thought process that was originally implicit within the language model into an observable reasoning path. This output reasoning path makes the task planning process no longer something that cannot be explicitly displayed; developers or the system can clearly see each step the model designs to complete the task, which provides possibilities for subsequent analysis, debugging, optimization, and even manual intervention.
[0132] See also Figure 3G In step 2022, specific types of target words are identified from the tasks to be divided, and the number of target words is used as a knowledge quantity evaluation parameter.
[0133] In some embodiments, one or more dictionaries are maintained, which contain a large number of target words belonging to specific types, such as a "proper noun dictionary" (containing brand names, product models, etc.) and a "domain terminology dictionary" (containing technical specifications, industry terms, etc.). The instruction text of the task to be divided is taken as input and scanned using these dictionaries. Each word or phrase in the instruction text is checked to see if it exists in any of the predefined dictionaries. Whenever a word in a dictionary is matched in the text, it is identified as a target word. All identified target words are counted, and the total number is used as a knowledge quantity evaluation parameter.
[0134] For example, the task to be segmented is: "Compare the camera configuration and battery life of smartphones A and B, and summarize them in a table." Using an internal dictionary of proper nouns and domain terms, the following specific types of target words are identified: "Smartphone A" (proper noun), "Smartphone B" (proper noun), "Camera configuration" (domain term), and "Battery life" (domain term). The number of target words identified is 4, so the knowledge evaluation parameter is 4.
[0135] In step 2023, the number of missing local constraints in the task to be divided is counted, and the ratio of the number of conditions to the total number of preset reference conditions is determined as an integrity assessment parameter.
[0136] In some embodiments, corresponding task templates are predefined for different types of tasks. Each template contains a series of local constraints that are generally considered necessary to complete that type of task; these are called reference conditions. When a task to be partitioned is received, it is first aligned with the best-matching task template. Then, each reference condition defined in the template is checked one by one to see if it is explicitly mentioned or assigned a value in the instruction text of the task to be partitioned. Next, the number of all reference conditions for which no corresponding information can be found in the instruction text is counted; this number is the number of missing local constraints. The ratio obtained by dividing this number of conditions by the total number of preset reference conditions in the template is used as the integrity evaluation parameter.
[0137] For example, the task to be divided is: "Compare smartphones A and B". A "Comparison Task" template is matched, which has three preset reference conditions: {Comparison Object}, {Comparison Dimension}, and {Output Format}. Checking {Comparison Object}, "Smartphones A and B" is found in the task, so this condition is not missing. Checking {Comparison Dimension}, no specific comparison dimension (such as camera, battery, etc.) is found in the task, so this condition is missing. Checking {Output Format}, no specific output format (such as table, list, etc.) is found in the task, so this condition is missing. The number of missing local constraints is 2. The ratio of the number of conditions to the total number of preset reference conditions is 2 / 3 ≈ 0.67, which is used as a completeness assessment parameter.
[0138] This application's embodiments deconstruct task complexity from three independent yet complementary perspectives: reasoning steps, knowledge volume, and completeness. Reasoning steps focus on the procedural complexity of the task, knowledge volume on the content complexity, and completeness on the informational completeness. Because these three dimensions are highly orthogonal, they can capture the potential difficulty of the task from different levels, avoiding the one-sidedness of a single-dimensional evaluation. The abstract evaluation dimensions are transformed into very concrete and operable computational processes. Whether it's counting the number of reasoning nodes, matching the number of target words, or verifying missing conditions in the template, each step is clear, explicit, and easy to implement. This concrete implementation method transforms the complexity evaluation process from a vague process dependent on the uninterpretable internal state of the model into a transparent model composed of multiple observable and measurable parameters. This not only enhances the reliability and stability of the evaluation results but also provides a clear focus for subsequent analysis and optimization.
[0139] See also Figure 3F In step 203, the complexity of the task to be divided is determined based on evaluation parameters of multiple dimensions.
[0140] In some embodiments, the evaluation parameters of multiple dimensions are standardized. For example, qualitative evaluations (such as "high", "medium", "low") are mapped to corresponding numerical values (such as 3, 2, 1), and numerical evaluations (such as the number of steps) are normalized. A weight coefficient is preset for each dimension, which represents the importance of the dimension in the comprehensive complexity evaluation. The fifth product of the standardized evaluation parameter of each dimension and its corresponding weight coefficient is determined, and the fifth products corresponding to multiple evaluation parameters are added together to obtain the final complexity of the task to be divided.
[0141] For example, the parsed evaluation parameters are: reasoning step evaluation parameter is 4, knowledge amount evaluation parameter is high (mapped to 3), and integrity evaluation parameter is medium (mapped to 2). Assuming the weight coefficient corresponding to the reasoning step evaluation parameter is 1.0, the weight coefficient corresponding to the knowledge amount evaluation parameter is 1.5, and the weight coefficient corresponding to the integrity evaluation parameter is 0.8, the fifth product of the reasoning step evaluation parameter and its corresponding weight coefficient is 4 * 1.0 = 4, the fifth product of the knowledge amount evaluation parameter and its corresponding weight coefficient is 3 * 1.5 = 4.5, and the fifth product of the integrity evaluation parameter and its corresponding weight coefficient is 2 * 0.8 = 1.6. The sum of the fifth products corresponding to the multiple evaluation parameters is 4 + 4.5 + 1.6 = 10.1, which means the complexity of the task to be divided is 10.1.
[0142] This application transforms the language model from a task executor into a task analyst. It no longer relies on external analysis tools based on fixed rules or statistical features, but directly utilizes the language model's own language sense and world knowledge, honed through data training. Based on its understanding of the deep meaning of language, the language model can assess dimensions that are difficult to quantify using external tools, such as the breadth of background knowledge required for a task or the implicit steps of its internal logic. By defining the dimensions of analysis through cue word engineering, developers can flexibly add, delete, or modify the dimensions of analysis in the cue words according to the needs of the application scenario, without rewriting complex code or training new models. This allows the complexity assessment method to quickly adapt to various types and domains of tasks, exhibiting strong versatility and scalability.
[0143] In some embodiments, see Figure 3I , Figure 3I This is the ninth flowchart of the task processing method provided in the embodiments of this application. Figure 3A Step 103, "Determine the number of target levels for the tasks to be divided based on the complexity of the tasks to be divided," can be achieved through... Figure 3I Steps 1036 to 1038 are implemented, and the details are explained below.
[0144] In step 1036, the target complexity interval to which the complexity belongs in a preset set of multiple complexity intervals is determined, wherein different complexity intervals are configured with different numbers of task levels.
[0145] In some embodiments, multiple consecutive and non-overlapping complexity intervals are obtained, each complexity interval is defined by a lower limit and an upper limit, and is bound to a specific integer value (i.e., the number of task levels); the total complexity score of the task to be divided is compared with the multiple preset complexity intervals one by one to determine which interval the complexity belongs to, and the complexity interval to which the complexity belongs is taken as the target complexity interval.
[0146] For example, suppose the preset complexity range and the number of configured levels are as follows: complexity range [0, 5) corresponds to level 1, complexity range [5, 15) corresponds to level 2, complexity range [15, 30) corresponds to level 3, complexity range [30, ∞) corresponds to level 4. A task to be divided, such as "compare smartphones A and B...", has a calculated complexity of 10.1. Comparing 10.1 with the above complexity ranges, it is found that it belongs to the range [5, 15). Therefore, the target complexity range is determined to be [5, 15), and the number of levels corresponding to this range is 2.
[0147] In step 1037, the target complexity range is adjusted based on the highest complexity index to obtain the adjusted target complexity range.
[0148] In some embodiments, scores of each independent complexity metric constituting the complexity are obtained, and these scores are compared to identify the metric with the highest value as the highest complexity metric. Preset correction rules are obtained, which bind the type of the highest complexity metric (e.g., context length metric or semantic abstraction metric) to a specific adjustment action (e.g., raising the interval by one level, lowering the interval by one level, or keeping it unchanged). The type of the identified highest complexity metric is matched with these rules, and the target complexity interval is moved accordingly in a preset interval sequence based on the adjustment action defined by the matched rule to obtain the adjusted target complexity interval.
[0149] For example, in a smartphone comparison task, suppose the scores for each metric are: semantic abstraction index = 4.5, information density index = 4.0, context length index = 1.6, and the highest complexity metric is the "semantic abstraction index," which has a score of 4.5. The correction rule can be defined as: "If the highest complexity metric is the semantic abstraction index, then increase the target complexity range by one level." The original target complexity range is [5, 15), and according to the rule, it is adjusted up one level, resulting in an adjusted target complexity range of [15, 30].
[0150] In step 1038, based on the adjustment range between the target complexity range and the adjusted target complexity range, the number of levels corresponding to the target complexity range is adjusted to obtain the target number of task levels to be divided for the task to be divided.
[0151] Here, a mapping table can be pre-built and maintained. The key of this mapping table is the adjustment range (an integer representing the number of levels to be adjusted within the range), and the value is a preset increment of the number of levels (also an integer). This mapping table can be designed to be non-linear. For example, when the adjustment range is 1, the increment of the number of levels is 1; but when the adjustment range is 2, the increment of the number of levels may be set to 3 to reflect a more drastic change. After determining the target complexity range and the adjusted target complexity range, the adjustment range between the two is calculated. Using this calculated adjustment range as the key, a lookup is performed in the preset mapping table to find its corresponding increment of the number of levels. The retrieved increment of the number of levels is then mathematically operated on (e.g., by addition) with the number of levels originally configured in the target complexity range. The result of the operation is the final target number of task levels to be divided into for the task to be partitioned.
[0152] In some embodiments, see Figure 3J , Figure 3J This is the tenth flowchart of the task processing method provided in the embodiments of this application. Figure 3I Step 1038, "Based on the adjustment range between the target complexity interval and the adjusted target complexity interval, adjust the number of levels corresponding to the target complexity interval to obtain the target number of task levels to be divided," can be achieved through... Figure 3J Steps 10381 to 10383 are implemented, and the details are explained below.
[0153] In step 10381, the level difference between the target complexity interval and the adjusted target complexity interval in the preset interval sequence is determined.
[0154] In some embodiments, the preset interval sequence itself is given an ordered index structure, such as an array or list, in which each complexity interval occupies a unique and incremental index position (e.g., the index of the first interval is 0, the second is 1, and so on); the index positions of the target complexity interval and the adjusted target complexity interval in the ordered index structure are queried respectively; the integer difference obtained by subtracting the index value of the target complexity interval from the index value of the adjusted target complexity interval is determined as the level difference.
[0155] For example, the preset interval sequence and its index are as follows: [0, 5) corresponds to index 0, [5, 15) corresponds to index 1, [15, 30) corresponds to index 2, [30, ∞) corresponds to index 3, the target complexity interval is [5, 15), its index is 1, the adjusted target complexity interval is [15, 30), its index is 2, the difference between the index value of the adjusted target complexity interval and the index value of the target complexity interval is 2-1=1, that is, the level difference is 1.
[0156] In step 10382, the product of the level difference and the preset adjustment coefficient is determined as the correction value for the number of levels corresponding to the target complexity range.
[0157] In some embodiments, a preset, globally uniform floating-point number or integer is read from the internal configuration. This value is the adjustment coefficient, which represents the amount of change in the number of levels corresponding to each level of interval adjustment. The level difference is multiplied by this preset adjustment coefficient, and the resulting product is a specific value representing whether the number of levels needs to be increased or decreased. This product is determined as the correction value for the number of levels corresponding to the target complexity interval.
[0158] For example, the level difference is 1, the preset adjustment coefficient is 1.0, the product of the level difference and the preset adjustment coefficient is 1 * 1.0 = 1.0, and the final correction value for the number of levels corresponding to the target complexity range is 1.0.
[0159] In step 10383, the number of levels corresponding to the target complexity range is adjusted based on the correction value to obtain the target number of task levels to be divided for the task to be divided.
[0160] In some embodiments, the number of levels configured in the original target complexity range and the correction value for the number of levels are added (if the level difference is positive) or subtracted (if the level difference is negative). Since the calculation result may be a floating-point number, while the number of levels must be an integer, the result is rounded (e.g., rounded up or rounded to the nearest integer). The rounded integer value is determined as the target number of task levels to be divided for the task to be partitioned. Before performing the adjustment calculation, the original number of levels and the calculated correction value can be checked, and a global maximum upper limit and a minimum lower limit for the number of levels can be preset. If the number of levels calculated after adjustment based on the correction value exceeds this preset range (e.g., higher than the upper limit or lower than the lower limit), the calculated value will not be used. Instead, the corresponding boundary value (upper limit or lower limit) will be directly used as the final target number. This saturation mechanism ensures that no matter how drastic the adjustment process is, the final number of task decompositions will be controlled within a reasonable and controllable range, preventing the system from generating too many or too few subtasks due to extreme cases.
[0161] For example, the original target complexity interval [5, 15) corresponds to 2 levels, with a correction value of 1.0. The sum of the original target complexity interval's configured level number and the correction value for the level number is 2 + 1.0 = 3.0. The result is rounded down to 3. Finally, the target number of task levels to be divided for this task is determined to be 3.
[0162] This application's embodiments abstract and simplify a complex adjustment logic into an adjustment coefficient, decoupling the adjustment strength from the adjustment behavior itself. Developers or system administrators do not need to modify complex code logic; they can easily control the sensitivity of the entire dynamic adjustment model simply by adjusting this single, easily understood coefficient value. Through level differences, an adjustment based on the non-numerical concept of an interval is transformed into a purely numerical calculation process. Regardless of how complex the original complexity interval is divided or how different the sizes of each interval are, level differences normalize them into simple integer step sizes. This normalization process simplifies and standardizes subsequent adjustment calculations (multiplication by the coefficient, summation), making the upper-level adjustment logic clear, stable, and easy to verify, thus enhancing the robustness and maintainability of the entire algorithm.
[0163] See also Figure 3AIn step 104, for each second subtask, if the complexity of the second subtask is greater than or equal to a preset complexity threshold, the second subtask is treated as a new task to be partitioned, and the partitioning operation is recursively performed until an atomic task with a complexity less than the complexity threshold is obtained.
[0164] In some embodiments, each newly generated second subtask is placed in a processing queue. A second subtask is retrieved from the queue, and its complexity is calculated. This calculated complexity is compared with a preset, fixed complexity threshold. This threshold is a specific numerical value representing the critical point at which the system determines whether a task is simple enough and does not need further decomposition. A conditional judgment is performed: if the complexity of the second subtask is greater than or equal to the complexity threshold, then the second subtask is considered to be overly complex. In this case, the second subtask is remarked as a new task to be divided and sent back to the process entry point responsible for performing the division operation, thus forming a recursive call. If the complexity of the second subtask is less than the complexity threshold, then the second subtask is considered to be simple enough, and the recursive process terminates on this branch. For second subtasks with complexity less than the threshold, an atomic task identifier can be attached. This identifier indicates that the task is a leaf node in the task decomposition hierarchy and is the smallest unit that can be directly executed by the language model.
[0165] Here, an independent, variable complexity threshold can be maintained for each task's recursive partitioning process, rather than a fixed one. Before recursion begins, this complexity threshold is initialized to a preset baseline value. During each recursive partitioning operation, the recursion depth of the current task branch is recorded, i.e., how many decompositions the task went through from the initial first subtask to the current state. The complexity threshold of the branch is dynamically adjusted based on the recorded recursion depth, following a preset adjustment strategy. For example, for each increase in recursion depth, the complexity threshold is reduced by a certain proportion or a fixed value. When comparing complexity, this dynamically calculated, rather than fixed, complexity threshold based on recursion depth is used. This mechanism allows for coarser-grained partitioning in the initial stages of task decomposition (when the recursion depth is shallow), tolerating higher complexity. As the decomposition deepens (recursion depth increases), the complexity threshold becomes increasingly stringent, resulting in finer-grained partitioning and ensuring that the final atomic tasks are sufficiently simple. This mechanism can more intelligently control the granularity of decomposition, avoiding the generation of too many unnecessary fragmented tasks in the early stages of decomposition.
[0166] For example, see Figure 5 , Figure 5 This is a flowchart illustrating the process of recursively dividing a task into atomic tasks, as provided in an embodiment of this application. Figure 5 In this process, for each task to be partitioned, the target number of task levels to be partitioned is determined based on the complexity of the task. The task is then divided into the target number of second subtasks. If the complexity of a second subtask is greater than or equal to a preset complexity threshold, it is treated as a new task to be partitioned, and the partitioning operation is performed recursively. If the complexity is less than the complexity threshold, it is treated as an atomic task, with each atomic task serving as a leaf node in the task tree. For example, suppose there is a second subtask in the queue: "Query the camera configuration of smartphone A," with a preset complexity threshold of 20. The second subtask "Query the camera configuration of smartphone A" is retrieved from the queue, and its complexity is determined to be 35. Comparing this complexity 35 with the preset complexity threshold of 20, we find that 35 is greater than or equal to 20. Therefore, this second subtask still needs to be partitioned and is sent back to the partitioning process as a new task to be partitioned. This task is further decomposed into two new second subtasks: "Query the rear camera configuration of smartphone A" and "Query the front camera configuration of smartphone A." These two new second subtasks are then placed in the queue. Next, the task "Query the rear camera configuration of smartphone A" is retrieved, and its complexity is determined to be 15. Comparing this complexity score of 15 with the complexity threshold of 20, we find that 15 is less than 20, so the recursion terminates at this branch, and the new second subtask "Query the rear camera configuration of smartphone A" is marked as an atomic task. Similarly, the complexity of the new second subtask "Query the front camera configuration of smartphone A" is also determined to be less than 20, and it is also marked as an atomic task.
[0167] In step 105, a task tree is constructed based on the hierarchical relationship between the task to be processed, each first subtask, each second subtask, and the atomic task. The language model is then invoked to execute the task tree and obtain the result of responding to the natural language instructions.
[0168] In some embodiments, the construction phase utilizes a hierarchical data structure to record parent-child relationships during task decomposition. During partitioning, each task (including the task to be processed, the first subtask, the second subtask, and atomic tasks) is assigned a unique node identifier. Simultaneously, whenever a task is divided into multiple subtasks, the mapping relationship between the parent task's node identifier and the node identifiers of all subtasks is recorded. After all recursive partitioning operations are completed, these recorded mapping relationships are traversed to create a tree-like data structure, with the initial node identifier of the task to be processed as the root node. Based on the parent-child mapping relationship, the node of the first subtask is added as a child node of the root node, then the node of the second subtask is added under its corresponding first subtask node, and so on, until all atomic task nodes are added as leaf nodes of the tree, resulting in a complete task tree reflecting the hierarchical relationships of all tasks. The execution phase employs a bottom-up recursive execution and result aggregation strategy. Execution begins at the leaf nodes of the task tree, i.e., the atomic tasks. The description text of one or more atomic tasks is taken as input, and the language model is invoked. The language model executes these atomic tasks and returns the results. The completion status of nodes in the task tree is then detected. When all direct child nodes (which may be atomic tasks or other deeper-level second sub-tasks) of a non-leaf node (e.g., a second sub-task node) have been completed, all results returned by these child nodes are collected. These collected child node results are combined, and the combined result, along with the task description of the non-leaf node itself, is used as the new input. The language model is invoked again, and the language model executes the parent node's task based on the child node's results. This process of "waiting for child nodes to complete - collecting results - executing parent nodes" recursively upwards from the bottom layer until the root node of the task tree is also completed. The final result returned by the root node is the final response to the initial natural language instruction.
[0169] As an example, see Figure 6 , Figure 6 This is a schematic diagram of the task tree structure provided in an embodiment of this application. The task to be processed is divided into multiple first subtasks. For each first subtask, the target number of task levels to be divided is determined based on the complexity of the first subtask, and the first task is divided into the target number of second subtasks. If the complexity of the second subtask is greater than or equal to a complexity threshold, the second subtask is taken as a new task to be divided, and the division operation is recursively performed until atomic tasks with a complexity less than the complexity threshold are obtained. A task tree is constructed based on the hierarchical relationship of multiple tasks.
[0170] For example, the language model is first invoked to execute all atomic tasks at the leaf nodes, such as "query the rear camera configuration of model A," which yields the result "50MP main camera, 12MP ultra-wide-angle lens." Simultaneously, all other atomic tasks related to the specific configurations of models A and B are executed. Once all atomic tasks related to the configuration of model A are completed, their results (such as rear camera configuration, front camera configuration, battery life information, etc.) are aggregated. These aggregated results, along with the description of their parent task (querying information about model A), are then invoked to the language model. The language model's task at this point may be to organize this scattered information into a complete description of model A. After complete descriptions of both models A and B are generated, their results are passed to the root node "compare models A and B and summarize in a table." Upon receiving these two complete descriptions, the language model performs the final comparison and tabulation operations, generating the results in response to the natural language command, as shown in Table 1. Table 1 displays the results in response to the natural language command.
[0171] Table 1 Results of responding to natural language commands
[0172] In some embodiments, see Figure 3K , Figure 3K This is a schematic diagram of the eleventh step of the task processing method provided in this application embodiment. After step 101 "obtaining natural language instructions" and before step 105 "calling the language model to execute the task tree and obtain the result of responding to the natural language instructions," the following steps are executed: Figure 3K Steps 301 to 304 are explained in detail below.
[0173] In step 301, an initial working memory unit is constructed.
[0174] In some embodiments, a working memory unit is a volatile storage mechanism dynamically built and maintained during a single task processing session for storing and managing fragments of structured information. When the task processing flow starts, an instance of a specific class is created; this object is the working memory unit. The core of this object is a hash table or dictionary, designed to efficiently access values using unique keys. During initialization, this hash table is created empty, containing no memory entries. Simultaneously, the working memory unit is assigned a series of predefined methods, such as interfaces for writing, retrieving, updating, and deleting memory entries, for subsequent process calls.
[0175] For example, when the smartphone comparison task begins, an object instance named working_memory_session_001 is created in memory. This instance contains an empty dictionary structure memory_items = {}. At this point, an initial working memory unit is constructed.
[0176] In step 302, the natural language instruction is parsed into initial context information including global constraints and instruction intent, and the initial context information is written into the working memory unit.
[0177] In some embodiments, the raw natural language instructions input by the user are passed to a natural language understanding model, which performs two tasks: first, it identifies the core intent of the instruction (e.g., "compare" or "query"); second, it extracts constraints applicable to the entire task (e.g., output format, language style, etc.) from the instruction; it encapsulates the identified instruction intent and the extracted global constraints into a structured data object, which is the initial context information; it generates a unique, predefined key for this initial context information, and uses the key and the initial context information as the value to call the write interface of the working memory unit to store it in the working memory unit.
[0178] For example, the original natural language instruction is: "Compare the camera configuration and battery life of smartphones A and B, and summarize them in a table." After parsing by the natural language understanding model, the instruction intent is "comparison and summary," with global constraints: {comparison objects: ["Smartphone A", "Smartphone B"], comparison dimensions: ["Camera configuration", "Battery life"], output format: "Table"}. This information is used to construct an initial context information object. The write interface is then called to write the initial context information into the working memory unit.
[0179] In step 303, for each executed atomic task, the task result generated based on the atomic task is associated with the node identifier of the atomic task in the task tree to obtain a structured memory entry, and the memory entry is written into the working memory unit.
[0180] In some embodiments, each atomic task node in the task tree has a unique node identifier. When an atomic task is executed by the language model and returns its task result (usually a piece of text or data), a new data object is created. This data object is designed to contain at least two fixed fields: node identifier (node_id) and task result (result). The node identifier of the atomic task is assigned to the "node_id" field, and the task result returned by the language model is assigned to the "result" field. This newly created associative data object containing the node identifier and the corresponding result is the structured memory entry.
[0181] For example, an executed atomic task, whose node identifier in the task tree is node_1_1_1, has the task content of "querying the configuration of the rear camera of model A". After the language model executes the task, the result returned is: "50-megapixel main camera, 12-megapixel ultra-wide-angle lens". A new data object is created, resulting in the structured memory entry: {"node_id": "node_1_1_1", "result": "50-megapixel main camera, 12-megapixel ultra-wide-angle lens"}.
[0182] In some embodiments, see Figure 3L , Figure 3L This is a schematic diagram of the twelfth step of the task processing method provided in the embodiments of this application. Figure 3K Step 303, "Writing memory entries into working memory units," can be done through... Figure 3L Steps 3031 to 3032 are implemented, and the details are explained below.
[0183] In step 3031, historical memory entries in the working memory unit are obtained, wherein the historical memory entries are memory entries stored in the working memory unit before the execution of the atomic task.
[0184] In some embodiments, before writing a new memory entry generated by a recently completed atomic task to the working memory unit, the write operation is not performed directly. Instead, a global read request is first sent to the working memory unit. After receiving the request, the working memory unit will copy or package all the contents currently stored inside, that is, all the memory entries that have been stored before this point in time and represent the results of all completed tasks in the past. This set of data that has been completely copied is the historical memory entry, thus obtaining a complete snapshot of the memory state before the current write operation occurs.
[0185] For example, suppose there are multiple historical memory entries about different aspects of phone A in the working memory, such as {"node_id": "...", "result": "Phone A has an OLED screen"}. An atomic task about "phone A's fast charging technology" has just finished executing and is about to write its result. Before writing, a fetch operation is first performed to completely copy all current memory entries about phone A from the working memory, forming a set of historical memory entries.
[0186] In step 3032, the task results generated based on the atomic task are semantically fused with the historical memory entries to obtain updated memory entries, and the updated memory entries are written into the working memory unit.
[0187] In some embodiments, a cue word specifically for semantic fusion is constructed. This cue word contains the content of all historical memory entries, as well as the newly generated task result of the current atomic task. The cue word explicitly instructs the language model that its task is to integrate these fragmented pieces of information, remove duplicates, resolve potential conflicts, and generate a single, coherent summary text containing the essence of all the information. Based on this cue word, the language model is invoked. Leveraging its natural language understanding and generation capabilities, the language model performs semantic fusion and outputs an integrated text. This newly generated text is used to create an updated memory entry, which then overwrites or replaces all related old memory entries in the working memory unit.
[0188] For example, the prompt word is constructed as follows: "[Background Information]: Phone A has an OLED screen and a 5000mAh battery. [New Information]: Phone A supports 65W wired fast charging. [Instruction]: Please combine the above scattered information about phone A into a coherent and complete descriptive text." After receiving the prompt word, the language model performs semantic fusion to generate the text: "Smartphone A is equipped with an OLED screen, has a 5000mAh battery, and supports 65W wired fast charging technology." Using this generated text, an updated memory entry is created, such as {"node_id": "summary_node_A", "result": "..."}, and written to the working memory unit. Simultaneously, older, scattered memory entries that have been merged may be deleted or archived.
[0189] This application transforms the working memory unit from a static, inbound-only data warehouse into a dynamic, continuously self-optimizing information system. Through periodic semantic fusion, it proactively integrates fragmented and redundant information into a more compact, higher-level knowledge summary. From an information theory perspective, this process continuously reduces the information entropy within the working memory unit, i.e., reducing disorder and uncertainty while maintaining or increasing the total amount of information. This dynamic evolutionary characteristic allows the quality and availability of memory to continuously improve as the task progresses. When the parent task is executed, there is no need to process a large number of raw, fragmented subtask results; instead, the updated, semantically coherent memory entry, which has already been preprocessed and digested by the language model, can be used directly. This reduces the reasoning burden on the parent task and improves the efficiency of the bottom-up aggregation execution of the entire task tree and the quality of the final result.
[0190] See also Figure 3K In step 304, when executing other tasks in the task tree, memory entries associated with other tasks are retrieved from the working memory unit based on the hierarchical relationship, as auxiliary information to assist the reasoning results obtained by the language model. The other tasks are any one of the task to be processed, the first subtask, and the second subtask.
[0191] Here, the retrieval process is no longer limited to searching only memory entries of direct child nodes; a parameter for retrieval depth or relational scope can be introduced. Based on this parameter, the retrieval logic can be extended to search for memory entries of all descendant nodes (including children of children), all sibling nodes (other nodes at the same level), and even all ancestor nodes (parent nodes, parent of parent nodes, etc.). The appropriate retrieval scope is dynamically selected based on the type of other tasks currently being performed. For example, a summary task might select to retrieve memory entries of all descendant nodes, while a task requiring context might need to retrieve memory entries of its ancestor nodes.
[0192] This application embodiment successfully persists the intermediate states (i.e., the results of each atomic task) generated during task execution by constructing a working memory unit independent of the execution logic. This decouples the information producers (atomic tasks) from the information consumers (other tasks). When a parent task is executed, it does not need to concern itself with how its child tasks are executed; it only needs to retrieve the results from the working memory unit by identifier. This decoupling improves the modularity and maintainability of the system. By associating task results with node identifiers in the task tree, information is given structure and context. When a parent task retrieves the memory of its child tasks based on hierarchical relationships, it is actually obtaining information within a structured context. This reasoning basis allows the language model to receive organized and filtered, highly relevant input when executing parent tasks, rather than a bunch of disordered raw data that needs to be sorted out manually. This reduces the execution difficulty of parent tasks and improves the accuracy and logical coherence of the final results.
[0193] In some embodiments, see Figure 3M , Figure 3M This is a schematic diagram of the thirteenth step of the task processing method provided in the embodiments of this application. Figure 3K Step 304, "Retrieving memory entries from working memory units that are associated with other tasks as auxiliary information to aid the results obtained from the language model reasoning," can be achieved through... Figure 3M Steps 3041 to 3044 are implemented, and the details are explained below.
[0194] In step 3041, a second relevance between other tasks and each memory entry is determined, and memory entries with a second relevance greater than a preset second relevance threshold are used as memory entries associated with other tasks.
[0195] In some embodiments, a pre-trained text vectorization model is loaded, and the descriptive text of other tasks is input into the text vectorization model to obtain a query vector that can represent its semantic core; each memory entry in the working memory unit is traversed, and its text content is also input into the text vectorization model to generate a memory vector for each memory entry; the cosine similarity between the query vector and each memory vector is calculated one by one, and this calculated similarity score is the second relevance; the second relevance of each memory entry is compared with a preset second relevance threshold, and only those memory entries with a second relevance greater than the second relevance threshold are retained as memory entries associated with other tasks.
[0196] For example, other tasks could be root node tasks, such as "compare the camera configurations and battery life of smartphones A and B, and summarize them in a table." The working memory unit contains multiple memory entries, such as "result": "Complete configuration summary of smartphone A..." (semantically highly relevant), "result": "Complete configuration summary of smartphone B..." (semantically highly relevant), and "result": "API call method for querying the weather..." (semantically irrelevant). The second relevance of other tasks to each memory entry is determined. The second relevance of memory entries 1 and 2 can be 0.92, while the second relevance of entry 3 can be 0.55. Assuming a second relevance threshold of 0.8, memory entries 1 and 2 are selected as memory entries associated with other tasks.
[0197] In step 3042, the memory entries associated with other tasks are parsed to obtain a memory summary representing semantic information.
[0198] In some embodiments, the text content of all memory entries associated with other tasks is aggregated and integrated into a single long text that may contain repetitive information. A cue word specifically for summary generation is constructed, which contains this aggregated long text and explicitly instructs the language model to extract, summarize, and deduplicate this information to generate a concise summary text that accurately captures all core semantic information. The language model is then invoked based on this cue word, and the text generated by the language model after performing the summary task is the memory summary representing the semantic information.
[0199] For example, the content of two selected memory entries associated with other tasks (a summary of the configurations of phones A and B) is combined. Then, a language model is used to summarize the memory, resulting in the following summary: "Smartphone A is equipped with a 5000mAh battery, 65W fast charging, and a dual rear camera system with a 50MP main camera at its core. Smartphone B has a 4800mAh battery, 100W fast charging, and a triple rear camera system including a 48MP main camera and a macro lens."
[0200] In step 3043, memory evidence corresponding to the memory summary is selected from memory entries associated with other tasks.
[0201] In some embodiments, the memory summary is broken down into sentences or fact points. For each decomposed fact point, a semantic comparison is performed one-to-one with the complete content of all original memory entries associated with other tasks. This comparison process can be accomplished using a natural language inference model that can determine whether a sentence can be inferred from another text. Original memory entries whose content directly supports or contains one or more fact points in the memory summary are selected. These selected original memory entries are considered as memory evidence corresponding to the memory summary. Memory evidence refers to one or more unmodified, structured memory entries selected from working memory units that provide direct, original source support for a specific fact assertion in a higher-level memory summary. In other words, the memory summary can be extracted from memory evidence; memory evidence is the source of the memory summary.
[0202] For example, a factual point in the memory summary, such as "Mobile phone A is equipped with a 5000mAh battery," is compared with two original associated memory entries. The comparison reveals that this factual point can be clearly and consistently described in the original memory entry "result: Complete configuration summary of Mobile phone A...". Therefore, the complete original memory entry "result: Complete configuration summary of Mobile phone A..." is selected as one piece of memory evidence. Similarly, the original memory entry about Mobile phone B will also be selected.
[0203] In step 3044, the memory summary and memory evidence are combined into auxiliary information to assist the reasoning results obtained by the language model.
[0204] In some embodiments, a new text structure is created containing two clearly defined, titled paragraphs. The first paragraph, titled "Core Summary," contains the memory summary obtained in the second step. The second paragraph, titled "Reference Evidence," lists the text content of all the memory evidence selected in the third step in a specific order. These two paragraphs are then combined into a single, well-structured text block, which serves as the final auxiliary information used to assist the language model in obtaining the results.
[0205] For example, by combining the memory summary and two selected memory pieces of evidence, the final auxiliary information generated is as follows: "Core Summary: Smartphone A is equipped with a 5000mAh battery, 65W fast charging, and a dual rear camera system with a 50MP main camera at its core; Smartphone B has a 4800mAh battery, 100W fast charging, and a triple rear camera system including a 48MP main camera and a macro lens. Reference Evidence: Complete configuration summary of phone A... (complete original memory entry content here), Complete configuration summary of phone B... (complete original memory entry content here)". This combined auxiliary information will be provided to the language model to assist it in completing the final comparison and tabulation tasks.
[0206] As an example, see Figure 7 , Figure 7 This is a schematic diagram illustrating the process of retrieving auxiliary information from memory entries associated with other tasks, as provided in an embodiment of this application. Figure 7 In this process, by considering the second relevance between other tasks and each memory entry, memory entries associated with other tasks are filtered out. Then, memory summaries are obtained from the memory entries associated with other tasks, and memory evidence is obtained by filtering. The memory summaries and memory evidence are combined into auxiliary information.
[0207] This application's embodiments achieve a high degree of information hierarchy through the process of extracting memory summaries and screening evidence. The memory summaries provide a highly generalized, concise summary for the subsequent language model, enabling it to quickly grasp core information and improve reasoning efficiency. Meanwhile, the memory evidence acts like a readily available reference, providing traceable, unmodified original support for each argument in the summary, ensuring the fidelity and credibility of the reasoning process. This separation mechanism perfectly balances the two key requirements of efficient reasoning and factual accuracy. Screening based on second relevance ensures that the information entering subsequent processing is semantically highly relevant, effectively eliminating interference from irrelevant information.
[0208] In some embodiments, see Figure 3N , Figure 3N This is a fourteenth flowchart illustrating the task processing method provided in this application embodiment. When executing other tasks in the task tree, for each of the other tasks being executed, the following can be performed: Figure 3N Steps 401 to 404 are explained in detail below.
[0209] In step 401, memory entries associated with other tasks are divided into multiple memory segments, and the first relevance of other tasks to each memory segment is determined.
[0210] In some embodiments, one or more memory entries associated with other tasks are obtained. For the text content of each memory entry, a text segmentation algorithm is applied to divide it into multiple finer-grained memory fragments that can independently express a complete semantic unit, such as segmentation according to sentences or natural paragraphs. The description text of other tasks is input into a pre-trained text vectorization model to obtain a query vector. Each memory fragment is traversed, and its text content is also input into the text vectorization model to generate a fragment vector for each memory fragment. The cosine similarity between the query vector and each fragment vector is calculated one by one. This calculated similarity score is the first relevance between other tasks and each memory fragment.
[0211] For example, a memory entry associated with the task "Compare the cameras of phones A and B" is: "Phone A is equipped with an OLED screen. Its rear main camera is 50MP, and its ultra-wide-angle camera is 12MP. Its battery capacity is 5000mAh." This memory entry is divided into three segments, such as segment 1: "Phone A is equipped with an OLED screen.", segment 2: "Its rear main camera is 50MP, and its ultra-wide-angle camera is 12MP.", and segment 3: "The battery capacity is 5000mAh." The first correlation coefficient between the task "Compare the cameras of phones A and B" and these three segments is calculated. The first correlation coefficient with segment 1 (screen) is 0.3, with segment 2 (camera) is 0.9, and with segment 3 (battery) is 0.2.
[0212] In step 402, memory segments with a first relevance lower than a preset relevance threshold are designated as redundant segments.
[0213] In some embodiments, a preset, fixed value is read from the configuration; this value is the relevance threshold, representing the minimum relevance standard by which the system determines whether an information fragment is worth retaining for the current task. Each memory fragment and its corresponding first relevance are traversed. During the traversal, the first relevance of each memory fragment is compared with this preset relevance threshold. If the first relevance value of a memory fragment is less than the threshold, the memory fragment is internally marked as a redundant fragment; if its first relevance is greater than or equal to the threshold, no marking is performed.
[0214] For example, assuming the preset relevance threshold is 0.5, comparing the first relevance of segment 1 (0.3) with the relevance threshold of 0.5, we find that 0.3 is lower than 0.5, so segment 1 "Model A mobile phone is equipped with an OLED screen." is considered a redundant segment; comparing the first relevance of segment 2 (0.9) with the relevance threshold of 0.5, we find that 0.9 is higher than 0.5, so this segment is retained; comparing the first relevance of segment 3 (0.2) with the relevance threshold of 0.5, we find that 0.2 is lower than 0.5, so segment 3 "The battery capacity is 5000mAh." is considered a redundant segment.
[0215] In step 403, redundant segments are removed from memory entries associated with other tasks to obtain new memory entries associated with other tasks.
[0216] In some embodiments, the original, complete text content of memory entries associated with other tasks is obtained. Redundant fragments are traversed, and for each redundant fragment, identical content is found and removed from the original memory entry text. After all redundant fragments are removed, the remaining content in the original memory entry text is combined into a new text string, the content of which is the new memory entry.
[0217] For example, the original memory entry reads: "Phone A is equipped with an OLED screen. Its rear main camera is 50 megapixels, and its ultra-wide-angle camera is 12 megapixels. The battery capacity is 5000mAh." After deleting segments 1 and 3, which were considered redundant, the new memory entry reads: "Its rear main camera is 50 megapixels, and its ultra-wide-angle camera is 12 megapixels." In some embodiments, see Figure 3O , Figure 3O This is the fifteenth flowchart of the task processing method provided in this application embodiment. Before step 403, "deleting redundant segments from memory entries associated with other tasks to obtain new memory entries associated with other tasks", the following steps are performed: Figure 3O Steps 501 to 503 are explained in detail below.
[0218] In step 501, the sum of the memory usage of the subtasks of multiple other tasks is determined.
[0219] In some embodiments, the node identifiers of other currently executing tasks in the task tree are obtained; the structure of the task tree is queried, and all subtasks with the other task as their direct parent node are traversed and identified. For each identified subtask, the memory entry corresponding to it in the working memory unit is queried; the space occupied by the text content of this memory entry in the computer memory is determined (e.g., in bytes or kilobytes); the memory occupancy of the memory entries corresponding to all these subtasks is summed, and the sum is the sum of the memory occupancy of the subtasks of multiple other tasks.
[0220] For example, another task is "query information about phone model A". Its subtasks include "query rear camera configuration of model A", "query front camera configuration of model A", and "query battery life information of model A". Assuming that all these subtasks have been completed and memory entries have been generated, the memory usage of these memory entries is calculated. For example, "rear camera information" occupies 2KB, "front camera information" occupies 1.5KB, and "battery life information" occupies 2.5KB. The sum of these values is 2 + 1.5 + 2.5 = 6KB. That is, the sum of the memory usage of the subtasks of the other tasks is 6KB.
[0221] In step 502, the ratio of the sum to the total memory usage is determined as an indicator of memory usage efficiency.
[0222] In some embodiments, a system-level detection interface is invoked to query the total memory size currently occupied by the entire working memory unit; this value is the total memory usage. This total memory usage includes not only the memory of the currently focused subtasks, but also the memory of all other stored memory entries (such as initial context information, results of other branch tasks, etc.); the ratio of the sum to the total memory usage is determined as a memory usage efficiency indicator.
[0223] For example, the entire working memory unit also stores information about the B model phone, initial context information, etc. After querying, its total memory usage is 20KB. The ratio of the sum to the total memory usage is 6 / 20 = 0.3, which means the memory usage efficiency index is 0.3.
[0224] In step 503, if the memory usage efficiency index is lower than a preset efficiency threshold, the process proceeds to the step of deleting redundant segments from memory entries associated with other tasks and obtaining new memory entries associated with other tasks.
[0225] In some embodiments, a preset, fixed value is read from the configuration; this value is the efficiency threshold. The efficiency threshold represents the minimum memory usage efficiency the system tolerates. If the value is lower than this threshold, it is considered that there is a lot of information in memory that is irrelevant to the current task cluster, and it needs to be cleaned up. The memory usage efficiency index calculated in the previous step is compared with this preset efficiency threshold, and a conditional judgment is performed: if the value of the memory usage efficiency index is less than the efficiency threshold, the process proceeds to the step of "deleting redundant fragments from memory entries associated with other tasks to obtain new memory entries associated with other tasks"; if the memory usage efficiency index is greater than or equal to the efficiency threshold, the step of deleting redundant fragments is skipped and not executed.
[0226] For example, assuming the preset efficiency threshold is 0.5 and the memory usage efficiency index is 0.3, since 0.3 is less than 0.5, it is determined that memory optimization is needed. Therefore, redundant segments are deleted from memory entries associated with other tasks, resulting in new memory entries associated with other tasks.
[0227] This application first dynamically evaluates the state of the current working memory unit using a memory usage efficiency index. Only when the evaluation shows that the proportion of memory usage of subtasks directly related to the current task focus in the total memory usage is lower than a preset efficiency threshold, is the subsequent pruning process initiated. This on-demand triggering mechanism avoids unnecessary pruning calculations when memory usage efficiency is already high, thereby saving system computing resources and improving the overall processing efficiency. The memory usage efficiency index provides a novel memory state measurement method oriented towards local task clusters. By calculating the ratio of the sum of memory usage of subtasks of other tasks to the total memory usage, it achieves a relative measurement closely related to the current task context. It can accurately reflect the degree of correlation between the overall content of the current working memory unit and the specific task branch being processed (i.e., a task cluster composed of other tasks and their subtasks). Based on this high-precision measurement result, decisions are made on whether to perform memory operations, ensuring that the triggering of pruning behavior is always highly related to the current task focus, thereby improving the accuracy and effectiveness of memory management decisions.
[0228] See also Figure 3N In step 404, the memory entries in the working memory unit that are associated with other tasks are updated to new memory entries.
[0229] In some embodiments, the unique key (typically its corresponding node identifier) of the memory entry currently being processed and associated with other tasks is determined in the working memory unit; a new memory entry is obtained, the update or write interface of the working memory unit is invoked, using the same key as the original memory entry, but updating the value to the content of this new memory entry. After receiving this instruction, the working memory unit will find the location of the corresponding key and overwrite the old, undressed content with the new content.
[0230] For example, in the working memory cell, the original memory entry is stored as {"node_id_A_summary": "Phone A is equipped with an OLED screen..."}. Using the same key node_id_A_summary, the update interface is called to update the value to the content of the new memory entry. After the update, the entry in the working memory cell becomes: {"node_id_A_summary": "Its rear main camera is 50 megapixels, and its ultra-wide-angle camera is 12 megapixels."}.
[0231] In this embodiment, the information in the working memory unit is no longer static and unchanging, but can dynamically adjust and refine itself according to the perspective of the currently executed task. Through filtering based on primary relevance, information that is noise or unimportant to the current task can be proactively pruned, retaining only the most core and relevant parts. Essentially, this process dynamically constructs a highly focused contextual environment with a very high signal-to-noise ratio for subsequent language model calls, improving the model's inference accuracy and efficiency on specific tasks. By first dividing memory entries into finer-grained memory fragments and then independently judging the relevance of each fragment, a content-aware, precise pruning is achieved. This fine-grained mechanism can accurately remove low-relevance parts while retaining highly relevant parts of a memory entry, achieving a balance between maintaining information integrity and reducing contextual redundancy, thus achieving optimal utilization of memory content.
[0232] In some embodiments, if other nodes in the task tree that are at the same level as the task nodes corresponding to other tasks and belong to the same parent node have all been executed, then the task results of other tasks and the task results of the tasks corresponding to other nodes are aggregated to obtain the memory entry of the parent node; and the memory entry of the parent node is written into the working memory unit.
[0233] For example, the execution status of nodes in the task tree is continuously monitored. Whenever another task completes and generates its result, the structural relationship of that task in the task tree is immediately queried to obtain its parent node, and then all child nodes under that parent node. The execution status of all other nodes except the currently completed other task is checked one by one. Aggregation only begins when all these sibling nodes are in the completed state. All child nodes under the parent node (i.e., the current other task and all other sibling nodes) are traversed, and their corresponding task results are retrieved from the working memory. The text content of all these task results is aggregated, and a cue word is constructed to guide the aggregation operation. This cue word contains all the aggregated task results and explicitly instructs the language model to synthesize and refine this information, generating a new text that summarizes the core content of all subtasks. Based on this cue word, the language model is invoked to generate the memory entry for the parent node. The process involves retrieving the unique identifier of the parent node in the task tree, calling the working memory unit's write interface, using the parent node's identifier as the key, and the content of the aggregated memory entry as the value. Upon receiving this write request, the working memory unit creates a new key-value pair entry in its internal data storage structure. Through this process, the memory entry representing a higher-level parent node that has successfully integrated the results of all subtasks is formally stored for retrieval and use by subsequent higher-level tasks or other related tasks. See also... Figure 8 , Figure 8 This is a schematic diagram illustrating the storage, updating, and use of the working memory unit provided in this application embodiment. The task results of atomic tasks are semantically fused with historical memory entries and written into the working memory unit. Simultaneously, the memory entries of parent nodes are also written into the working memory unit. The memory usage efficiency index of the working memory unit is calculated. If the memory usage efficiency index is less than an efficiency threshold, the memory entries associated with other tasks are divided into multiple memory segments. A first relevance between other tasks and each memory segment is determined. Memory segments with a first relevance lower than a preset relevance threshold are considered redundant segments and deleted. Simultaneously, memory entries associated with other tasks can be retrieved from the working memory unit as auxiliary information to assist the language model in reasoning.
[0234] As an example, in the task tree, the first subtask A (querying information about phone model A) and the first subtask B (querying information about phone model B) are sibling nodes at the same level, both belonging to the child nodes of the root node "compare phone models A and B...". When it is detected that both subtasks have been completed, the task results of each subtask are retrieved from the working memory unit. For example, result 1: "Smartphone A is equipped with an OLED screen, has a battery capacity of 5000mAh and supports 65W fast charging...", and result 2: "Smartphone B is equipped with an AMOLED screen, has a battery capacity of 4800mAh and supports 100W fast charging...". These two texts are combined and aggregated using a language model. After processing by the language model, a more generalized text is generated as the memory entry for the parent node: "Detailed configuration information of smartphones A and B has been obtained. Smartphone A has an advantage in battery capacity, while Smartphone B is superior in charging technology." The node identifier root_node of this parent node (i.e., the root node) is obtained, and the write interface is called to write the new key-value pair {"root_node": "Detailed configuration information of smartphones A and B has been obtained..."} into the working memory unit.
[0235] In this embodiment, after all sibling nodes at each level have completed their tasks, the results are actively aggregated upwards to form a higher-level, more abstract parent node memory. Essentially, this process is a bottom-up, layer-by-layer information compression and semantic dimensionality enhancement, continuously transforming low-level, detailed data into high-level, generalized knowledge, ensuring a high degree of consistency between the information structure in the working memory unit and the logical structure of the task tree. By generating parent node memory entries midway through task execution, a high-quality, high-density contextual environment is prepared in advance for subsequent higher-level task execution. When a complex, multi-stage task reaches its later stages, it no longer needs to backtrack and process massive amounts of low-level atomic task results; it only needs to directly retrieve and use the aggregated parent node memory entry representing the entire previous stage's work. This simplifies the information transfer between different stages of a complex task, improving the coherence of multi-step reasoning and the quality of the final result.
[0236] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario.
[0237] Large language models are increasingly being applied in fields such as natural language processing, information retrieval, and automatic recommendation. They are particularly effective in complex scenarios, handling large amounts of user-input text for understanding and reasoning. However, several challenges remain, especially when dealing with extremely long contexts, where model performance and efficiency often reach bottlenecks.
[0238] While language models in related technologies excel at understanding and processing short texts, their biggest challenge lies in the limitation of the context window. Most models can only handle input context of a fixed length; once the text length exceeds this limit, the excess portion cannot be directly referenced by the model. This means that when processing long documents or multiple information sources (such as web pages, reports, etc.), the model may fail to accurately integrate information, leading to reduced inference accuracy or even information omissions or errors. For example, when users need to retrieve and integrate information across multiple pages, the inference models of related technologies often fail to effectively maintain the relationships between these information, resulting in inaccurate or poor real-time performance. Furthermore, in complex multi-hop tool calls, the model may need to reload and process the previous context after each tool call, wasting significant computational resources and time, and potentially leading to inconsistent inference results at different stages. To avoid this, related technologies employ external memory or multi-model collaboration methods, dividing information into smaller chunks for step-by-step processing, or using multiple different models to handle different tasks. While these methods can alleviate the context length limitation to some extent, they often result in wasted computational resources, increased inference time, and place high demands on model coordination.
[0239] Furthermore, related technologies lack an efficient and unified framework for handling complex multi-task reasoning problems, especially multi-hop tool calls (such as querying databases or calling search engines). Most models require multiple stages of input-output interaction to complete a single task, increasing the complexity of information processing and posing significant challenges to context management and tool call integration. Therefore, a considerable gap remains in addressing the challenges of handling extremely long contexts, integrating multi-source information, and reasoning for complex tasks.
[0240] This application provides a novel method for processing extremely long contexts based on a recursive reasoning model. The core technology overcomes the bottleneck of traditional large language models in handling extremely long contexts by combining advanced reasoning models and strong memory mechanisms. This results in more efficient and intelligent information synthesis and reasoning capabilities, which are crucial in complex application scenarios involving multiple pages and information sources, enabling rapid acquisition and integration of information. By decomposing complex tasks (i.e., tasks to be processed) into multiple sub-tasks, the model can solve problems step-by-step according to a hierarchical structure. Each sub-task has an independent thought process, and the results of sub-tasks at different levels are summarized through a backtracking mechanism. Through recursive task decomposition and a reasoning tree structure, it ensures that each sub-task focuses on the current key information and is associated with other tasks when processing long contexts, avoiding information loss or misalignment problems caused by excessively long contexts in traditional methods. It also avoids interference from excessive irrelevant information. During multi-round inference and task decomposition, the model continuously updates its working memory. This memory not only preserves the most relevant contextual information for the current task but also dynamically prunes irrelevant or outdated content during inference, avoiding memory overflow or overload, reducing memory consumption and computational resource waste. Particularly in GPU memory management, it can dynamically release no longer needed contextual information and reuse location embeddings and computational resources, thereby improving inference speed and system responsiveness. By intelligently selecting and retaining the most important information, the model can quickly switch focus during inference, efficiently manage and reuse memory, ensuring the accuracy and comprehensiveness of inference results, and maintaining high inference speed and accuracy even when handling extremely long contexts.
[0241] In summary, the embodiments of this application not only overcome the contextual limitations of traditional large language models through reasoning trees and task decomposition, but also ensure efficient reasoning over long time spans through intelligent memory and efficient memory management. This innovative technical framework enables the rapid synthesis of content from different sources when processing multi-page information retrieved by users, providing accurate and personalized information.
[0242] This application provides a task processing method that, through proxy reasoning and context optimization, adjusts resource allocation in real time, avoiding resource waste while improving system response speed and the ability to understand long-context scripts. Precise algorithmic reasoning reduces unnecessary computation, lowers the server load, and thus reduces operating costs and improves overall performance. See also Figure 9 , Figure 9 This is a schematic diagram illustrating reasoning and question answering using an optimized language model, provided in an embodiment of this application. Figure 9In the process, the system receives natural language commands sent by the user, calls a pre-trained language model to perform inference based on the natural language commands, generates a result in response to the natural language commands, and sends it to the user.
[0243] This application proposes a method for handling extremely long contexts, aiming to address the bottlenecks of language models in related technologies when processing extremely long contexts and multi-task reasoning. Specifically, through technological innovations such as task decomposition, strong memory mechanisms, and intelligent memory management, the method improves the reasoning efficiency and accuracy of the model when processing complex information.
[0244] This application's embodiments decompose complex tasks (i.e., tasks to be processed) into multiple subtasks. Its unique feature lies in dynamically adjusting the hierarchical structure of the tasks recursively to handle reasoning tasks of varying complexity. The recursive reasoning tree structure adaptively determines the depth of each task decomposition based on the task's requirements and, combined with a dynamic memory management mechanism, effectively maintains and manages contextual information.
[0245] Each node in the recursion represents a reasoning task, which can be further decomposed into smaller subtasks as needed by the context. While inference models in related technologies often employ a fixed task structure, the recursive reasoning tree (i.e., task tree) structure allows for dynamic hierarchical adjustments based on task complexity during the reasoning process. The execution of each task depends not only on the input of the current node but also on the state of its parent node (i.e., the superior task), ensuring that the contextual information required by each task is passed down the tree structure. For a given overall task… (That is, the task to be processed) can be recursively decomposed into multiple subtasks. (That is, multiple first subtasks), each of which This can be further broken down into smaller tasks (i.e., multiple second subtasks), and this process can be represented by the following recursive formula (1): (1) At each level of the reasoning tree, the task is continuously subdivided into smaller subtasks until each subtask can be processed independently and produce a specific result. Each subtask... It can also be recursively broken down into more subtasks as needed. This recursive process continues until the task reaches its most basic execution unit (i.e., the atomic task), the subtask. The decomposition process can be found in formula (2): (2) in, Indicates the first Sub-tasks Subtasks The total number of decomposable subtasks. Subtasks The decomposition yielded the first Sub-tasks.
[0246] This recursive structure ensures that each task can be adaptively decomposed at different levels, and the computation process of each subtask can be performed independently while maintaining close connection with the upper-level tasks. The criteria for determining whether a task has reached the most basic execution unit can be: First, a complexity threshold determination: based on the logic of the adaptive task hierarchy, when the calculated task context complexity is lower than a set threshold, the system considers the current task simple enough, and the model can directly use the existing context to perform reasoning and output results without further decomposition; Second, atomic operation matching: when a task can be directly mapped to a single, indivisible specific execution action, such as executing a specific Application Programming Interface (API) call, performing a specific database retrieval, or executing a simple logical judgment, the task is marked as the most basic execution unit (i.e., an atomic task).
[0247] Building upon the recursive reasoning tree structure, this application also proposes a technological innovation in adaptive task hierarchy and memory management. Related reasoning models typically require a fixed-size context window to process information; as the context becomes increasingly long, the model easily loses the contextual relationships between information. This application effectively solves this problem through adaptive task hierarchy management and dynamic memory management.
[0248] Adaptive task hierarchy management refers to the dynamic adjustment of the task decomposition depth during the reasoning process. This means that when the model deals with tasks of different complexities, it will determine the decomposition depth according to the difficulty of the current task and the required context. For example, when dealing with a simple problem, the model can handle one layer of sub-tasks; while for more complex tasks, the model will automatically select multi-level task decomposition to gradually refine the problem and ensure that the information transmission and context in the reasoning process are not distorted. The adaptive hierarchy is not triggered at a fixed period in actual reasoning, but is calculated and decided each time a task node to be processed is encountered. The specific triggering time is "on-demand triggering". Among them, the main triggering time (before decomposition): it is triggered immediately before the system is ready to process each specific task node Ti. The logic is that the system must first calculate the complexity of the current node before deciding whether to continue to decompose it recursively or execute it directly as an atomic task; the secondary triggering time (feedback correction): it is triggered when a sub-task fails to execute or returns an ambiguous result. The logic is that the system will consider the original evaluation to be too low, recalculate the complexity and force a finer-grained secondary decomposition. The adjustment of the adaptive task hierarchy can be seen in formula (3): (3) in, Indicates task The decomposition depth (i.e., the number of objectives in the task hierarchy to be divided). () represents a function that dynamically adjusts the decomposition depth based on the context complexity of the current task. The complexity of a function is calculated by examining the following three metrics: Context information content (also known as context length), which refers to the number of context tokens or information entropy required for the current task. If the relevant information content exceeds the optimal context window limit for a single inference by the model, the complexity is extremely high and must be decomposed; Semantic ambiguity / abstraction (also known as semantic abstraction), which refers to the clarity of the task objective predicted by a lightweight model. For example, "write a game of xx" and "write a Python function to move xx". The more abstract the objective and the more implicit the steps, the higher the ambiguity and the greater the decomposition depth; Tool / dependency coupling (also known as external dependency coupling), which is determined by analyzing whether the task requires multiple heterogeneous tools (such as simultaneously requiring network search and code execution) or has unresolved pre-dependent variables (i.e., pre-variables). The longer the toolchain to be called or the more missing dependency data, the higher the complexity. It is a measure of task context complexity, including information content, context length, and the complexity of the current inference step. There are two calculation methods. For example, one is to break it down into multiple dimensions: calculating the proportion of the number of tokens related to the current task to the model's maximum context window, i.e., the context length ratio. The longer the text, the heavier the memory burden and the higher the complexity. Another method is to calculate the information entropy of the text or the density of key entities (i.e., the information density index), i.e., information density and entropy. The more valid facts contained in a unit of text, the more difficult the processing and the higher the complexity. A third method is to evaluate the semantic abstraction level of the task description (scored by a pre-trained model) or the number of potential logical jumps required, i.e., the depth of reasoning logic. The more ambiguous the goal, the more logical deduction steps are required, and the higher the complexity. Yet another example is that a pre-trained model (i.e., a language model) can be used for direct black-box scoring to obtain... .
[0249] The recursive reasoning tree structure not only dynamically adjusts the task hierarchy but also retains key information needed during reasoning through a memory management mechanism. Related models, when processing long texts, store all context in memory, leading to a waste of computational resources. In contrast, this application's embodiments dynamically prune irrelevant subtasks and dynamically manage working memory using context information, retaining only the key parts needed for the current task, thereby improving memory utilization efficiency and reducing computational overhead.
[0250] The core of dynamic memory management is to determine whether to retain the context information of each task based on its current state. In the recursive reasoning tree structure, memory is not simply a static storage of all information, but rather a dynamic scheduling and intelligent selection among tasks at different levels. Each task at each level decides whether to retain the relevant memory information of previous tasks based on its context complexity, while ensuring that the efficiency of information transfer between different tasks is maximized through hierarchical scheduling. This mechanism enhances the inference efficiency of the model through the following formula (4): (4) Identify all subtasks The sum of memory usage Determine the sum and the current total memory usage. The ratio of memory usage efficiency is used as a measure of memory efficiency. (This is also known as a memory usage efficiency metric). This formula measures the efficiency of memory usage at the task level, ensuring efficient memory management between each subtask and its parent task, while avoiding the waste of global memory in related technology models. The formula implements a switch for memory cleanup and compression mechanisms, determining when the system should prune or summarize to maintain the stability of long-range inference.
[0251] In large language models of related technologies, models typically rely on fixed-length context windows to process input information. As text length increases, these models cannot retain sufficient contextual information, leading to inaccuracies or information loss. Therefore, the introduction of strong memory mechanisms addresses this by intelligently managing, storing, and updating task-relevant memory information. The key innovation of strong memory mechanisms lies in their intelligent memory update, pruning, and reuse strategies. Their goal is to enable models to maintain efficient inference speeds over long-duration inference tasks while retaining the most relevant contextual information, avoiding information loss and redundant storage.
[0252] The working principle of strong memory mechanisms includes memory storage and updating, memory pruning and redundancy avoidance, and memory reuse and context transfer. Whenever the model performs reasoning, it generates certain contextual information, which needs to be stored in working memory so that subsequent tasks can use it. The storage and updating of memory is not simply about retaining every piece of information, but rather about dynamically deciding which information needs to be stored based on the requirements of the current task and the importance of the context. Suppose we are processing a large task with multiple levels of tasks, such as an information retrieval task across multiple pages, where each task generates certain contextual information. For example, task 1 is to retrieve the content of page A, task 2 is to further retrieve the content of page B based on the content of page A, and task 3 is to combine the information from pages A and B to answer the question. In this process, the content of page A is first stored in working memory. As the task is executed, new information is added to the memory (i.e., working memory units). For example, after task 2 is completed, the content of page A will be updated and combined with the content of page B to form a new context, which will be updated into the memory. The updating process of working memory is shown in formula (5): (5) in, It is current working memory. It is the reasoning result of the current task. The context related to the current task (i.e., memory entries associated with other tasks). This refers to updated working memory. Taking t=1 as an example, where task 1 retrieves the content of page A, and task 2 further retrieves the content of page B based on the content of page A. At this point... For a subtask that has just been completed and is currently submitting information, the memory update occurs after the task is executed. The system needs to evaluate the importance of the "page A content" just generated by the subtask to the overall goal, and then decide how to write it into memory. This refers to the working memory state before Task 1 is executed, containing only the global initial instructions (the user's initial question / prompt) and search intent. At this point, there is no specific content for page A. After Task 1 was executed, the updated working memory state was completed, containing the global initial instructions and the core content of page A (i.e. (Integration with the new output information of Task 1), this part of the memory will be passed as input to Task 2.
[0253] If Task 1 is the smallest unit of granularity, the Relevant Context refers to the input parameters necessary to execute the task, including the URL of page A, or the search keywords pointing to page A, and the task objective inherited from the global instructions, such as "what information are we looking for?" The initial memory of Task 1 (i.e., the state at t=0) is represented as the Global Context or User Prompt, which is a vector or text block containing user instructions, such as "Please help me find information on pages A and B and provide a comprehensive answer." It is the "seed" of the memory.
[0254] Memory updates depend not only on the task's input and output but also on contextual relevance. For example, if task 1 is to retrieve the title information of page A, while task 2 is to retrieve the detailed content of page A, the title information of page A may no longer be needed in task 2, thus its priority in memory can be dynamically adjusted.
[0255] As tasks continue to reason and information accumulates, redundant information will appear in working memory, especially information that is irrelevant to the current task (i.e., redundant fragments). To avoid memory overflow and memory waste, an intelligent pruning mechanism can be introduced, which can dynamically prune unnecessary memory content based on the importance of the task and the relevance of the context. Suppose that after processing tasks 1 and 2, the model has extracted information from pages A and B. If the goal of task 3 is only to generate an answer based on the joint information of pages A and B, then some content of page A (such as the title) is no longer important to task 3 and can be pruned. The pruning process compares the context required by the task with the existing context and selectively retains the most relevant memory content. The modification process can be seen in formula (6): (6) in, It is the pruned working memory (i.e., new memory entries). Used for pruning working memory. This refers to context that is no longer needed by the current task (i.e., redundant fragments). At t=2, Based on The results are derived from working memory, the inference results of the current task 3, and the context related to task 3. The calculated result is obtained at this point. It is used for updating That is, to Trim to obtain ,use Replace the original .
[0256] This application introduces a context importance assessment mechanism. This mechanism dynamically determines which information is redundant and which is necessary based on task type, task depth, and the correlation between contexts, making memory pruning more intelligent and accurate, thereby avoiding excessive reduction of important information. A pre-trained model can be used to directly output the context importance.
[0257] Strong memory mechanisms also include memory reuse and context passing. When processing multi-level tasks, the upper-level task needs to generate the answer based on the reasoning results of the sub-tasks. In this process, the memory information generated by the sub-tasks is passed to the parent task (that is, the memory entries of the parent node are obtained), providing context support for the parent task. This process not only helps the parent task obtain richer context information, but also reduces redundant computation. In Task 3, the model needs to generate the final answer based on the context of Task 1 and Task 2. The results of Task 1 and Task 2 are retained and reused in Task 3. When processing Task 3, the model will reason based on the memory content of Task 1 and Task 2, combined with the current context information. For example, if Task 1 provides key information of page A and Task 2 provides detailed information of page B, then Task 3 needs to fuse the information of these two tasks, retain and reuse the information of these two sub-tasks in memory, instead of reloading all context. The process of memory reuse can be seen in formula (7): (7) in, It is reused working memory. Used for memory reuse It is memory information related to the current task. (The above text...) It refers to the scope and constraints of the current task. These are reference materials and past answers (knowledge) used to solve problems. Memory is usually loaded into the context for the model to use.
[0258] It is generated Based on the input state, starting at t=2, the system will reuse... (Right now and The merged entity is loaded as the current context of Task 3. Task 3 uses this context to reason, generate new content, update Mreused, and thus form the final context. It is not a standalone auxiliary accessory, but rather the predecessor of the Memory State of Mission 3.
[0259] The final task memory should be represented as a "pruned, structured fusion," including a core conclusion and a key evidence chain. The core conclusion refers to the final answer or summary (high-level semantics) generated by the current task reasoning, while the key evidence chain refers to the necessary factual data (low-level details) selected and retained from the sub-task memories to support the conclusion. The final task memory is a deduplicated and high-density block of information.
[0260] This application also proposes a cross-level memory reuse mechanism, enabling the memory of a subtask to not only be passed to the parent task but also shared among multiple subtasks. For example, the result of a previous subtask is written to a common memory area (or the parent context is updated), and a subsequent subtask, upon startup, reads this common area to "see" the memory of its sibling task. This reuse mechanism reduces redundant computation in multi-level tasks and improves inference efficiency.
[0261] Table 2 Scores of different models in different scenarios
[0262] Referring to Table 2 above, the model in this embodiment achieved a comprehensive performance score of 66.0 in the context-optimized scenario, a 24.5% improvement compared to Model 10. This surpasses several mainstream frameworks. In summary, the models perform excellently in various inference tasks. By optimizing inference strategies and contextual understanding, they can improve performance on multiple datasets, and are particularly valuable for complex tasks. The following description continues to illustrate the exemplary structure of the task processing device 233 provided in the embodiments of this application as a software module. In some embodiments, such as Figure 2 As shown, the software modules stored in the task processing device 233 of the memory 230 may include: The instruction conversion module 2331 is used to acquire natural language instructions and convert them into tasks to be processed by a pre-trained language model.
[0263] The first partitioning module 2332 is used to partition the task to be processed into multiple first subtasks, and to use the multiple first subtasks as the task to be partitioned.
[0264] The second partitioning module 2333 is used to perform the following partitioning operations for each task to be partitioned: determine the complexity of the task to be partitioned according to at least one preset complexity index, determine the target number of task levels to be partitioned based on the complexity of the task to be partitioned, and divide the task to be partitioned into the target number of second subtasks.
[0265] The recursive partitioning module 2334 is used to, for each second subtask, if the complexity of the second subtask is greater than or equal to a preset complexity threshold, treat the second subtask as a new task to be partitioned, and recursively execute the partitioning operation until an atomic task with a complexity less than the complexity threshold is obtained.
[0266] The task execution module 2335 is used to construct a task tree based on the hierarchical relationship between the task to be processed, each first subtask, each second subtask, and atomic tasks, call the language model to execute the task tree, and obtain the result of responding to natural language instructions.
[0267] In some embodiments, the second partitioning module 2333 is further configured to: determine the number of characters in the text information associated with the task to be partitioned; use the ratio of the number of characters to the upper limit of the character limit of the processing window preset by the language model as a context length indicator; determine the depth of logical reasoning of the task to be partitioned as a semantic abstraction indicator; parse the text information associated with the task to be partitioned to obtain multiple entities in the text information; determine the density of entities in the text information; determine an information density indicator based on the density; count the number of external interfaces to be called by the task to be partitioned; determine an external dependency coupling degree indicator based on the number of interfaces; and determine the complexity of the task to be partitioned based on at least one of the context length indicator, semantic abstraction indicator, information density indicator, and external dependency coupling degree indicator.
[0268] In some embodiments, the second partitioning module 2333 is further configured to perform syntactic analysis on the instruction text of the task to be partitioned to obtain a syntax tree representing the syntactic structure of the task to be partitioned; identify multiple specific syntax nodes representing logical relationships from the syntax tree; determine the level of each specific syntax node in the syntax tree; and use the sum of the levels of at least one specific syntax node as the depth of logical reasoning for the task to be partitioned.
[0269] In some embodiments, the second segmentation module 2333 is further configured to: count the number of entities of a preset category included in the text information; determine the ratio of the number of entities to the length of the text information as the entity density; divide the text information into multiple words, determine the frequency of occurrence of each word in the text information, determine the information entropy of the text information based on the frequency of occurrence; and determine the information density index based on the entity density and the information entropy.
[0270] In some embodiments, the second partitioning module 2333 is further configured to parse the task to be partitioned to obtain multiple pre-variables that the operation based on calling external interfaces depends on; perform state detection on each pre-variable to obtain the state of each pre-variable; if the state of the pre-variable is characterized as no value is obtained, then the pre-variable is used as the target variable, and the number of variables of the target variable is counted; and the external dependency coupling index is determined based on the number of interfaces and the number of variables.
[0271] In some embodiments, the second partitioning module 2333 is further configured to perform the following processing for each task to be partitioned: constructing prompt words based on the task to be partitioned, wherein the prompt words are used to prompt the determination of the complexity of the task to be partitioned; calling a language model to analyze the prompt words in multiple dimensions based on the prompt words to obtain the evaluation parameters of each dimension; and determining the complexity of the task to be partitioned based on the evaluation parameters of multiple dimensions.
[0272] In some embodiments, the second partitioning module 2333 is further configured to call the language model based on the prompt words to perform reasoning operations on the task to be partitioned, obtain a reasoning path, count the number of inference nodes included in the reasoning path as a parameter for evaluating the reasoning steps; identify specific types of target words from the task to be partitioned, and use the number of target words as a parameter for evaluating the amount of knowledge; count the number of missing local constraints in the task to be partitioned, and determine the ratio of the number of conditions to the total number of preset reference conditions as a parameter for evaluating completeness.
[0273] In some embodiments, the second partitioning module 2333 is further configured to call the language model based on the prompt words to generate text, obtain the first text unit, and use the first text unit as the inference node to be generated; for each inference node to be generated, perform the following logical reasoning: call the language model based on the generated inference node and the prompt words to perform text prediction, obtain the new inference node, and use the new inference node as the inference node to be generated, and recursively execute the logical reasoning until the language model generation ends; combine multiple generated inference nodes in the order of generation to obtain the inference path.
[0274] In some embodiments, the second partitioning module 2333 is further configured to determine the target complexity interval to which the complexity belongs among a preset plurality of complexity intervals, wherein different complexity intervals are configured with different numbers of task levels; adjust the target complexity interval based on the highest complexity index to obtain the adjusted target complexity interval; and adjust the number of levels corresponding to the target complexity interval based on the adjustment range between the target complexity interval and the adjusted target complexity interval to obtain the target number of task levels to be partitioned for the task to be partitioned.
[0275] In some embodiments, the second partitioning module 2333 is further configured to determine the level difference between the target complexity interval and the adjusted target complexity interval in a preset interval sequence; determine the product of the level difference and the preset adjustment coefficient as a correction value for the number of levels corresponding to the target complexity interval; and adjust the number of levels corresponding to the target complexity interval based on the correction value to obtain the target number of task levels to be partitioned.
[0276] In some embodiments, the task execution module 2335 is further configured to construct an initial working memory unit; parse natural language instructions into initial context information including global constraints and instruction intent, and write the initial context information into the working memory unit; for each executed atomic task, associate the task result generated based on the atomic task with the node identifier of the atomic task in the task tree to obtain a structured memory entry, and write the memory entry into the working memory unit; when executing other tasks in the task tree, based on the hierarchical relationship, retrieve memory entries associated with other tasks from the working memory unit as auxiliary information for obtaining results from the language model inference, wherein the other tasks are any one of the pending task, the first subtask, and the second subtask.
[0277] In some embodiments, the task execution module 2335 is further configured to obtain historical memory entries in the working memory unit, wherein the historical memory entries are memory entries stored in the working memory unit before the execution of the atomic task; semantically fuse the task result generated based on the atomic task with the historical memory entries to obtain updated memory entries, and write the updated memory entries into the working memory unit.
[0278] In some embodiments, the task execution module 2335 is further configured to determine the second relevance between other tasks and each memory entry, and to designate memory entries with a second relevance greater than a preset second relevance threshold as memory entries associated with other tasks; to parse the memory entries associated with other tasks to obtain a memory summary representing semantic information; to select memory evidence corresponding to the memory summary from the memory entries associated with other tasks; and to combine the memory summary and memory evidence into auxiliary information to assist the results obtained by the language model inference.
[0279] In some embodiments, the task execution module 2335 is further configured to perform the following processing for each other task being executed: dividing the memory entries associated with other tasks into multiple memory segments, determining a first relevance between the other tasks and each memory segment; designating memory segments with a first relevance lower than a preset relevance threshold as redundant segments; deleting redundant segments from the memory entries associated with other tasks to obtain new memory entries associated with other tasks; and updating the memory entries associated with other tasks in the working memory unit to the new memory entries.
[0280] In some embodiments, the task execution module 2335 is further configured to determine the sum of the memory usage of subtasks of multiple other tasks; determine the ratio of the sum to the total memory usage as a memory usage efficiency indicator; if the memory usage efficiency indicator is lower than a preset efficiency threshold, then proceed to the step of deleting redundant segments from memory entries associated with other tasks to obtain new memory entries associated with other tasks.
[0281] In some embodiments, the task execution module 2335 is further configured to, if other nodes in the task tree that are at the same level as the task nodes corresponding to other tasks and belong to the same parent node have all been executed, aggregate the task results of other tasks and the task results of the tasks corresponding to other nodes to obtain the memory entry of the parent node; and write the memory entry of the parent node into the working memory unit.
[0282] This application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. The processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the task processing method described in this application.
[0283] This application provides a computer-readable storage medium storing computer-executable instructions or a computer program. When the computer-executable instructions or the computer program are executed by a processor, the processor will execute the task processing method provided in this application. For example, ... Figure 3A The task processing method is shown.
[0284] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.
[0285] In some embodiments, computer-executable instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
[0286] As an example, computer-executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., files that store one or more modules, subroutines, or code sections).
[0287] As an example, computer-executable instructions can be deployed to execute on a single electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed across multiple locations and interconnected via a communication network.
[0288] In summary, through the embodiments of this application, the task to be processed is divided into multiple first subtasks using a language model. The complexity of each task is determined according to a preset complexity index. Based on this complexity, the target number of second subtasks to be decomposed is determined. A complexity threshold is used to control the termination of the recursive division operation, thereby constructing a task tree through multiple levels of tasks. The language model is then invoked to execute the task tree and obtain the result. By introducing at least one complexity index and determining the target number of second subtasks based on it, the task decomposition process can intelligently adapt to tasks of different difficulties. For complex tasks, it can automatically perform deeper and broader decompositions; for simple tasks, it can converge quickly. This adaptive capability ensures that each division operation is efficient and targeted, improving the rationality of task decomposition and resource utilization efficiency. By setting a clear complexity threshold as the condition for recursive termination, it avoids the language model from handling high-complexity tasks that it cannot handle due to improper task division, thereby ensuring the high quality of the entire task tree execution process and ultimately improving the accuracy of the results in responding to user natural language commands.
[0289] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A task processing method, characterized in that, The method includes: Obtain natural language instructions and convert the natural language instructions into a task to be processed by a pre-trained language model; The task to be processed is divided into multiple first subtasks, and the multiple first subtasks are used as tasks to be divided. For each task to be partitioned, the following partitioning operation is performed: The complexity of the task to be partitioned is determined based on at least one preset complexity index; the target number of task levels to be partitioned for the task to be partitioned is determined based on the complexity of the task to be partitioned; and... The task to be divided is divided into the target number of second sub-tasks; For each second subtask, if the complexity of the second subtask is greater than or equal to a preset complexity threshold, then the second subtask is taken as a new task to be divided, and the division operation is recursively executed until an atomic task with a complexity less than the complexity threshold is obtained. A task tree is constructed based on the hierarchical relationship between the task to be processed, each first subtask, each second subtask, and the atomic tasks. The language model is then invoked to execute the task tree, and the result of responding to the natural language instruction is obtained.
2. The method according to claim 1, characterized in that, Determining the complexity of the task to be divided based on at least one preset complexity index includes: Determine the number of characters in the text information associated with the task to be divided, and use the ratio of the number of characters to the upper limit of the processing window preset by the language model as the context length indicator. The depth of logical reasoning for the task to be divided is determined as an indicator of semantic abstraction. The text information associated with the task to be divided is parsed to obtain multiple entities in the text information, the density of the entities in the text information is determined, and an information density index is determined based on the density. Count the number of external interfaces to be called for executing the task to be divided, and determine the external dependency coupling degree index based on the number of interfaces; The complexity of the task to be partitioned is determined based on at least one of the context length metric, the semantic abstraction metric, the information density metric, and the external dependency coupling metric.
3. The method according to claim 2, characterized in that, Determining the depth of logical reasoning for the task to be divided includes: Syntactic analysis is performed on the instruction text of the task to be divided to obtain a syntax tree representing the syntactic structure of the task to be divided. Identify multiple specific syntax nodes representing logical relationships from the syntax tree; Determine the level of each specific syntax node in the syntax tree, and sum the levels of at least one specific syntax node as the depth of logical reasoning for the task to be partitioned.
4. The method according to claim 2, characterized in that, Determining the density of the entity in the text information and determining an information density index based on the density includes: Count the number of entities belonging to a preset category included in the text information; The ratio of the number of entities to the length of the text information is determined as the entity density; The text information is divided into multiple words, the frequency of each word in the text information is determined, and the information entropy of the text information is determined based on the frequency of occurrence. The information density index is determined based on the entity density and the information entropy.
5. The method according to claim 2, characterized in that, The determination of the external dependency coupling index based on the number of interfaces includes: The task to be divided is parsed to obtain multiple pre-variables that the operation based on calling external interfaces depends on. Perform state detection on each of the preceding variables to obtain the state of each of the preceding variables; If the state of the preceding variable is characterized as no value is obtained, then the preceding variable is used as the target variable, and the number of variables of the target variable is counted. The external dependency coupling index is determined based on the number of interfaces and the number of variables.
6. The method according to claim 1, characterized in that, The method further includes: Based on the task to be divided, prompt words are constructed, wherein the prompt words are used to prompt the determination of the complexity of the task to be divided; Based on the prompt words, the language model is invoked to perform multi-dimensional analysis on the prompt words, and evaluation parameters for each dimension are obtained; The complexity of the task to be divided is determined based on the evaluation parameters of multiple dimensions.
7. The method according to claim 6, characterized in that, The step of calling the language model based on the prompt word to perform multi-dimensional analysis on the prompt word, and obtaining evaluation parameters for each dimension, includes: Based on the prompt words, the language model is invoked to perform reasoning operations on the task to be divided, and a reasoning path is obtained. The number of reasoning nodes included in the reasoning path is counted as an evaluation parameter for the reasoning steps. Identify specific types of target words from the tasks to be divided, and use the number of these target words as a knowledge quantity evaluation parameter; The number of missing local constraints in the task to be divided is counted, and the ratio of the number of missing constraints to the total number of preset reference conditions is determined as an integrity assessment parameter.
8. The method according to claim 7, characterized in that, The step of invoking the language model based on the prompt words to perform inference operations on the task to be segmented, and obtaining the inference path, includes: Based on the prompt words, the language model is invoked to generate text, resulting in the first text unit, which is then used as the inference node to be generated. For each inference node to be generated, the following logical reasoning is performed: based on the generated inference node and the prompt word, the language model is called to perform text prediction to obtain a new inference node, and the new inference node is used as the inference node to be generated, and the logical reasoning is recursively executed until the language model generates an end marker; The multiple generated inference nodes are combined in the order of their generation to obtain the inference path.
9. The method according to any one of claims 1 to 8, characterized in that, The method further includes: Construct the initial working memory unit; The natural language instruction is parsed into initial context information including global constraints and instruction intent, and the initial context information is written into the working memory unit; For each executed atomic task, the task result generated based on the atomic task is associated with the node identifier of the atomic task in the task tree to obtain a structured memory entry, and the memory entry is written into the working memory unit. When executing other tasks in the task tree, based on the hierarchical relationship, the memory entries associated with the other tasks are retrieved from the working memory unit as auxiliary information to assist the language model in reasoning to obtain the result, wherein the other tasks are any one of the task to be processed, the first subtask, and the second subtask.
10. The method according to claim 9, characterized in that, The step of writing the memory entry into the working memory unit includes: Obtain historical memory entries from the working memory unit, wherein the historical memory entries are memory entries stored in the working memory unit before the execution of the atomic task; The task results generated based on the atomic task are semantically fused with the historical memory entries to obtain updated memory entries, and the updated memory entries are written into the working memory unit.
11. The method according to claim 9, characterized in that, The method further includes: For each of the other tasks being executed, perform the following processing: The memory entries associated with the other tasks are divided into multiple memory segments, and a first relevance between the other tasks and each memory segment is determined; Memory segments with a first relevance lower than a preset relevance threshold are designated as redundant segments; The redundant segment is deleted from the memory entry associated with the other task to obtain a new memory entry associated with the other task; Update the memory entries in the working memory unit that are associated with the other tasks to the new memory entries.
12. The method according to claim 11, characterized in that, Before deleting the redundant fragment from the memory entry associated with the other task to obtain a new memory entry associated with the other task, the method further includes: Determine the sum of the memory usage of the subtasks of the other tasks; Determine the ratio of the sum to the total memory usage as an indicator of memory usage efficiency; If the memory usage efficiency index is lower than a preset efficiency threshold, then the process proceeds to the step of deleting the redundant segments from the memory entries associated with the other tasks and obtaining new memory entries associated with the other tasks.
13. The method according to claim 9, characterized in that, The method further includes: If all other nodes in the task tree that are at the same level as the task nodes corresponding to the other tasks and belong to the same parent node have been executed, then the task results of the other tasks and the task results of the tasks corresponding to the other nodes are aggregated to obtain the memory entry of the parent node. Write the memory entry of the parent node into the working memory unit.
14. The method according to claim 9, characterized in that, The step of retrieving memory entries associated with the other tasks from the working memory unit as auxiliary information to assist the language model in reasoning to obtain the result includes: Determine the second relevance between the other tasks and each memory entry, and take the memory entries with the second relevance greater than a preset second relevance threshold as the memory entries associated with the other tasks; The memory entries associated with the other tasks are parsed to obtain a memory summary representing semantic information; From the memory entries associated with the other tasks, filter out the memory evidence corresponding to the memory summary; The memory summary and the memory evidence are combined to form auxiliary information that assists the language model in reasoning to obtain the result.
15. The method according to any one of claims 1 to 14, characterized in that, Determining the target number of task levels to be divided based on the complexity of the task to be divided includes: Determine the target complexity interval to which the complexity belongs among a preset number of complexity intervals, wherein different complexity intervals are configured with different numbers of task levels; The target complexity range is adjusted based on the highest complexity index to obtain the adjusted target complexity range; Based on the adjustment range between the target complexity range and the adjusted target complexity range, the number of levels corresponding to the target complexity range is adjusted to obtain the target number of task levels to be divided for the task to be divided.
16. The method according to claim 15, characterized in that, The step of adjusting the number of levels corresponding to the target complexity interval based on the adjustment range between the target complexity interval and the adjusted target complexity interval, to obtain the target number of task levels to be divided for the task to be divided, includes: Determine the level difference between the target complexity interval and the adjusted target complexity interval in a preset interval sequence; The product of the level difference and the preset adjustment coefficient is determined as the correction value for the number of levels corresponding to the target complexity range; Based on the correction value, the number of levels corresponding to the target complexity range is adjusted to obtain the target number of task levels to be divided for the task to be divided.
17. A task processing device, characterized in that, The device includes: The instruction conversion module is used to acquire natural language instructions and convert the natural language instructions into a task to be processed by a pre-trained language model. The first partitioning module is used to partition the task to be processed into multiple first subtasks, and the multiple first subtasks are used as tasks to be partitioned. The second partitioning module is used to perform the following partitioning operations for each of the tasks to be partitioned: determining the complexity of the task to be partitioned according to at least one preset complexity index, determining the target number of task levels to be partitioned for the task to be partitioned based on the complexity of the task to be partitioned, and partitioning the task to be partitioned into the target number of second subtasks. The recursive partitioning module is used to, for each second subtask, if the complexity of the second subtask is greater than or equal to a preset complexity threshold, treat the second subtask as a new task to be partitioned, and recursively execute the partitioning operation until an atomic task with a complexity less than the complexity threshold is obtained. The task execution module is used to construct a task tree based on the hierarchical relationship between the task to be processed, each first subtask, each second subtask, and the atomic tasks, and to call the language model to execute the task tree to obtain the result of responding to the natural language instruction.
18. An electronic device, characterized in that, The electronic device includes: Memory is used to store executable instructions or computer programs. A processor, when executing computer-executable instructions or computer programs stored in the memory, implements the task processing method according to any one of claims 1 to 16.
19. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that, When the computer-executable instructions or computer program are executed by a processor, they implement the task processing method according to any one of claims 1 to 16.
20. A computer program product comprising computer-executable instructions or a computer program, characterized in that, When the computer-executable instructions or computer program are executed by a processor, the task processing method according to any one of claims 1 to 16 is implemented.