Performing tasks using cached intermediate results generated by a generative neural network

The task execution system addresses the inefficiencies of generative neural networks by caching intermediate results, improving performance and resource efficiency through reduced inference latency and consumption.

WO2026015137A1PCT designated stage Publication Date: 2026-01-15GOOGLE LLC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/US2024/037295
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2026-01-15

AI Technical Summary

Technical Problem

Performing tasks using generative neural networks is slow and resource-intensive due to the need for repeated inference passes to generate intermediate results, especially for frequent or complex sub-tasks, which is problematic for real-time applications and large user bases.

Method used

A task execution system utilizing a cache that stores intermediate results from previous tasks, allowing reuse or modification of these results to generate new outputs more efficiently, reducing the need for repeated inference through the generative neural network.

Benefits of technology

This approach significantly reduces inference latency and computing resource consumption by reusing cached intermediate results, enhancing performance for real-time use cases and conserving resources, especially for frequent or complex tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure US2024037295_15012026_PF_FP_ABST
    Figure US2024037295_15012026_PF_FP_ABST
Patent Text Reader

Abstract

Methods, systems, and apparatus, including computer programs encoded on computer storage media, for performing tasks using a generative neural network and a cache. One of the methods includes maintaining a cache, the cache storing, for each of a plurality of cached sub-tasks (i) a cached intermediate result generated by using a generative neural network for the cached sub-task in association with (ii) an identifier for the cached sub-task; receiving a prompt a task using the generative neural network; obtaining a plan for performing one or more sub-tasks based on the prompt; obtaining an intermediate result for each sub-task, comprising determining, for each sub-task, based on the sub-task and the identifiers for the plurality of cached sub-tasks, whether to use any of the cached intermediate results to generate the intermediate result for the sub-task; and generating a result for the task based on the intermediate result obtained for each sub-task.
Need to check novelty before this filing date? Find Prior Art

Description

PERFORMING TASKS USING CACHED INTERMEDIATE RESULTSGENERATED BY A GENERATIVE NEURAL NETWORKBACKGROUND

[0001] This specification relates to processing inputs using neural networks to generate output sequences.

[0002] Neural networks are machine learning models that employ one or more layers of nonlinear units to predict an output for a received input. Some neural networks include one or more hidden layers in addition to an output layer. The output of each hidden layer is used as input to the next layer in the network, i.e., another hidden layer or the output layer. Each layer of the network generates an output from a received input in accordance with current values of a respective set of parameters.SUMMARY

[0003] This specification describes a task execution system implemented as computer programs on one or more computers in one or more locations that uses cached intermediate results for sub-tasks to shorten inference time and reduce computing resource consumption when performing tasks using a generative neural network.

[0004] By maintaining a cache that stores intermediate results for sub-tasks that have been generated by a generative neural network in the past and, when a prompt for a new task that involves similar sub-tasks is received, utilizing the corresponding cached intermediate results to generate a new result for the new task, the task execution system saves time and computing resources by not having to perform multiple inference passes through the generative neural network to generate new intermediate results for these similar sub-tasks.

[0005] Instead, the task execution system can for example (i) reuse the cached intermediate results directly to generate the new result or (ii) modify the cached intermediate results by using an alternative, e.g., lightweight, generative neural network that has faster inference speed or lower inference cost or both, and then use the modified intermediate results to generate the new result.

[0006] The subject matter described in this specification can be implemented in particular embodiments so as to realize one or more of the following advantages.

[0007] The task execution system as described in this specification can perform any of a variety of tasks, which range from text processing tasks such as fact-checking and questionanswering tasks to agent control tasks such as automated assistance and object manipulationtasks, and, correspondingly, generate results for the tasks faster than some existing systems that rely on generative neural networks. The reduced inference latency can be critical for realtime use cases that require a result quickly. This also improves user experience with generative neural networks.

[0008] Moreover, the task execution system reduces the amount of computing resources, e.g., processing cycle and energy, consumed by the inference processes for new tasks because repeatedly performing multiple inference passes through the generative neural network to generate a new intermediate result for each of one or more sub-tasks involved in every new task that the system is requested to perform is no longer required. The savings in computing resources can be especially significant when these sub-tasks are frequent or trending subtasks that are common among a plurality’ of tasks that the system is requested to perform. The savings in computing resources can also be significant for complex tasks that involve a large number of sub-subtasks or for generative neural networks that have a large number of parameters.

[0009] The details of one or more embodiments of the subject matter of this specification are set forth in the accompanying drawings and the description below. Other features, aspects, and advantages of the subject matter will become apparent from the description, the drawings, and the claims.BRIEF DESCRIPTION OF THE DRAWINGS

[0010] FIG. 1 is a diagram of an example neural network system.

[0011] FIG. 2 is a flow diagram of an example process for generating a result for a task.

[0012] FIG. 3 is a flow diagram of an example process for determining whether to use any of cached outputs to generate an intermediate result for a sub-task.

[0013] Like reference numbers and designations in the various drawings indicate like elements.DETAILED DESCRIPTION

[0014] FIG. 1 is a diagram of an example task execution system 100. The task execution system 100 is an example of a system implemented as computer programs on one or more computers in one or more locations that can perform tasks then output the results 126 for the tasks.

[0015] To perform each task, the task execution system 100 obtains instruction data that characterizes the task to be performed by the system and context data that will be processedby the system in order to perform the task. Collectively, such data will be referred to in this specification as "prompt data,’7or “prompt 102” for short.

[0016] The prompt 102 can include data in any of a variety of modalities, e.g., any of text, audio, images, videos, or other sensor measurements, e.g.. Lidar data, EEG data, EKG data, and so on. Moreover, the prompt 102 can be obtain in any of a variety of ways.

[0017] In general, the task execution system 100 can receive the instruction data as a user input. The user input can include a touchscreen input, a voice input, a keyboard input, a gesture input, a mouse, trackpad, or other pointing device input, that characterizes the task to be performed. For example, the instruction data can be in the form of a request, an instruction, or a command that is in some natural language and that defines the task to be performed by the system.

[0018] In some cases, the task execution system 100 can receive the context data in association with the instruction data. For example, the context data can also be received by the system together with the instruction data in a single user input or multiple user inputs.

[0019] In some other cases, unlike the instruction data, the context data can include prestored data, and the task execution system 100 can obtain the context data from a storage device that is accessible by the system.

[0020] In yet other cases, the task execution system 100 can obtain the context data from another system over a data communication network, e.g., through an application programming interface (API) that is made available by the other system. For example, the other system can be a sensor system (when the task is an agent control task) or a webpage capturing system, a screen recording system, or a screenshot capturing system (when the task is an automated assistance task).

[0021] In general the task execution system 100 can be configured to perform any of a variety of tasks. A few examples of the tasks follow.

[0022] In some cases, the task can be a text generation task, and the task execution system 100 can be configured to perform the text generation task by generating text sequences. In these cases, the result 126 generated by the task execution system 100 can include an output sequence of text. The result 126 can be presented for display to users, e.g., to the user who submitted the instruction data, context data, or both.

[0023] As some general examples, the text generation task can be a natural language processing or understanding task, e.g., an entailment task, a paraphrase task, a textual similarity task, a sentiment task, a sentence completion task, a grammaticality task, and so on,that operates on a prompt 102 that includes an input sequence of text in some natural language to generate an output sequence of text that is similarly in some natural language.

[0024] As a particular example, the task execution system 100 can be configured to perform a question-answering task, e.g., it can be part of a question-answering system, where the prompt 102 includes an input sequence of text that identifies a question and the result 126 includes an output sequence of text that represents an answer to the question. For example, the question can be provided by a user of the task execution system 100, e.g.. by providing the input sequence of text directly to the system or by providing audio data representing a verbalization of the input sequence of text to the system.

[0025] As another particular example, the task execution system 100 can be configured to perform a fact-checking task, e.g., it can be part of a fact-checking system, where the prompt 102 includes an input sequence of text that represents a statement and the result 126 includes an output sequence of text that represents a prediction about whether the statement is factually true.

[0026] As another particular example, the task execution system 100 can be part of a dialog system and the prompt 102 can include audio or text from the most recent conversational turn submitted by a user of the dialog system during the dialog the result 126 includes an output sequence of that is the next turn in the conversation, e.g., either text or audio that is a response to the most recent conversational turn. Optionally, the prompt can also include one or more historical conversational turns that occurred earlier in the conversation.

[0027] As another particular example, the task execution system 100 can be configured to perform a machine translation task, e.g., it can be part of a machine translation system, where the prompt 102 can include text in a source language while the result 126 includes an output sequence of text in a target language that is a translation of the source text into the target language.

[0028] As another particular example, the task execution system 100 can be configured to perform a computer code generation task, e.g., it can be part of a computer code generation system, where the prompt 102 can include a text description of a desired piece of code or a snippet of computer code in a programming language and the result 126 includes computer code, e.g., a snippet of code that is described by the prompt or a snippet of code that follows the prompt in a computer program.

[0029] As another particular example, the task execution system 100 can be part of a search system that facilitates searching of resources on the Internet. A resource can be any data that can be provided over the Internet. A resource can be identified by a resource address that isassociated with the resource. Resources include web pages, word processing documents, portable document format (PDF) documents, images, video, and news feed sources, to name a few.

[0030] In this particular example, the search system can receive search queries submitted by client devices and, in response, identify resources that are relevant to the search query7in the form of search results and return the search results to the user devices in search results pages. A search result page can include search result data generated by the search system that identifies a resource responsive to a search query, and includes a link to the resource. The search result page can additionally include a result 126 in the form of an output sequence of text that is generated by the task execution system 100 based on a prompt 112 derived from the search query.

[0031] In some cases, the task can be an image or video generation task, and the task execution system 100 can be configured to perform the image or video generation task by generating images or videos that have multiple frames (where each frame is an image) as sequences of pixels. For example, the output result 126 can include a plurality of color values for pixels in an image arranged according to a specified order.

[0032] In some similar cases, the task can be an audio generation task or another generation task to generate data in some other modalities. For example, the task execution system 100 can generate an image, a video, an audio, or data in another modality conditioned on the prompt 112 that includes a text description of the content of the image, the video, the audio, or the data in the other modality.

[0033] In some cases, the task execution system 100 can be configured to perform an agent control task. In these cases, the prompt 102 can include (i) a text sequence in a natural language that characterizes a task to be performed by an agent in the environment and (ii) one or more observations or other data characterizing respective states of the environment, and the result 126 can be any data that indicates that the agent has successfully completed the task or that some termination criterion is satisfied, e.g., the environment enters a state that has been designated as a terminal state or a threshold amount of time has elapsed without successfully completing the task.

[0034] For example, the result 126 can include a textual indicator, e g., in the form of an output sequence of text, an audio indicator, e.g., in the form of a verbal response, or some other visual (e.g., graphical) indicator that is a confirmation of task accomplishment. As another example, the result 126 can include an observation of the environment that it is in the designated terminal state.

[0035] The agent can be, e.g., a real-world or simulated robot, a control system for an industrial facility, or a control system that controls a different kind of agent. The observations may include sensor data captured by sensors associated with (e.g. part of the agent, for example visual data, LIDAR data, sonar data, agent configuration data (e.g. joint angles), agent orientation data, or the like. For example, the observations may include images captured by a visual sensor of the agent or by a visual sensor located in the environment.

[0036] In some cases, the environment is a real-world environment and the agent is a mechanical agent interacting with the real-world environment. For example, the agent may be a robot interacting with the environment to accomplish a task, e.g., to locate an object of interest in the environment, to move an object of interest to a specified location in the environment, to physically manipulate an object of interest in the environment in a specified way, or to navigate to a specified destination in the environment; or the agent may be an autonomous or semi-autonomous land, air, or sea vehicle navigating through the environment to a specified destination in the environment.

[0037] In some cases, the environment is a simulated environment and the agent is implemented as one or more computer programs interacting with the simulated environment. For example, the environment can be a computer simulation of a real-world environment and the agent can be a simulated mechanical agent navigating through the computer simulation. For example, the simulated environment may be a motion simulation environment, e.g., a driving simulation or a flight simulation, and the agent may be a simulated vehicle navigating through the motion simulation.

[0038] In some cases, the environment is a suitable execution environment, e.g., a runtime environment or an operating system environment, that is implemented on one or more client devices such as smart phones, tablet computers, wearable devices, automobile systems, standalone personal assistant devices, or any other appropriate electronic device, and the agent is a virtual agent (also known as “automated assistant ” or “mobile assistant”) that may be interacted with by a user through the client devices.

[0039] In these cases, the task can be an automated assistance task. That is, the virtual agent can receive instruction data as input from the user (e.g.. typed or spoken natural language input) and respond with responsive content (e.g., visual and / or audible natural language output). The virtual agent can perform a broad range of tasks within the execution environment through interactions with various local and / or third-party' applications, websites, or other agents.

[0040] Examples of the automated assistance tasks include scheduling an appointment through a calendar application, making a phone call through a telephone application, sending an email through an e-mail application, sending an instant message through an instant messaging application, playing a music through a digital music player application, playing a video through a digital video player application, and so on.

[0041] To perform these tasks, the task execution system 100 uses a task planning engine 105 and a generative neural network 120. As illustrated in FIG. 1. in some implementations, the task planning engine 105 is included as part of the task execution system 100. In some other implementations, the task planning engine 105 is implemented within a remote system that is separate from, but in data communication with, the task execution system 100.

[0042] The generative neural network 120 can have any appropriate neural network architecture that allows the neural network to map an input sequence of tokens from a vocabulary to an output sequence of tokens from the vocabulary.

[0043] The vocabulary of tokens can include any of a variety of tokens that represent text symbols or other symbols. For example, the vocabulary’ of text tokens can include one or more of characters, sub-words, words, punctuation marks, numbers, or other symbols that appear in a corpus of text in a natural language and / or a computer programming language.

[0044] Additionally, or alternatively, the vocabulary’ of tokens can include tokens that can represent data other than text. For example, the vocabulary of tokens can include image tokens that represent a discrete set of image patch embeddings of an image that can be generated by an image encoder neural network based on processing the image patches of the image. As another example, the vocabulary’ of tokens can include audio tokens that represent code vectors in a codebook of a quantizer, e.g., a residual vector quantizer.

[0045] When the task is an agent control task, the input sequence of tokens can for example include (i) text tokens that characterize the agent control task to be performed by an agent in an environment (ii) image tokens that represent a discrete set of image patch embeddings of an observation image of the environment, and the output sequence of tokens can for example include tokens that define or otherwise specifies an action to be performed by the agent in response to the observation image, e.g., "open gripper” or “move arm to coordinates (x, y. z).”

[0046] For example, the task execution system 100 can then perform the agent control task by generating instructions for the agent that when executed will cause the agent to perform the action, by submitting a control input directly to the appropriate controls of the agent, or by using another appropriate control technique.

[0047] When the task is an automated assistance task, the input sequence of tokens can for example include (i) text tokens that characterize the automated assistance task to be performed by a virtual agent in an execution environment (ii) image tokens that represent a discrete set of image patch embeddings of a screen image of the execution environment (e.g., a screenshot image of a user interface displayed on a computing device), and the output sequence of tokens can for example include tokens that define or otherwise specifies an action to be performed by the virtual agent when the execution environment is in a state characterized by the screen image, e g., “click the button at coordinates (x, y, z)” or “enter [keyword] in search box.”

[0048] For example, the task execution system 100 can perform the automated assistance task by performing the action within the execution environment, e.g.. an action that simulates a user input, e.g., that simulates a touchscreen input, a voice input, a keyboard input, a gesture input, a mouse, trackpad, or other pointing device input.

[0049] For example, the generative neural network 120 can be a Transformer-based language model neural network or a recurrent neural network-based language model. As a particular example, the generative neural network 120 can be an auto-regressive Transformer-based neural network that has, e.g., an encoder-only Transformer architecture, an encoder-decoder Transformer architecture, or a decoder-only Transformer architecture.

[0050] Examples of such architectures include those described in Colin Raffel. et al. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv: 1910.10683, 2019; Daniel Adiwardana. et al. Towards a human-like open-domain chatbot. CoRR, abs / 2001.09977, 2020; Tom B Brown, et al. Language models are few-shot learners. arXiv preprint arXiv;2005. 14165, 2020; Aakanksha Chowdhery, et al. PaLM: Scaling Language Modeling with Pathways. arXiv preprint arXiv: 2204.02311; Rohan Anil, et al. Palm 2 technical report. arXiv preprint arXiv:2305. 10403, 2023; and Rohan Anil, et al. Gemini: a family of highly capable multimodal models. arXiv preprint arXiv:2312.11805 2023.

[0051] The planning engine 105 is configured to process the prompt 102 to generate a plan for performing the task characterized in the prompt 102 by completing one or more subtasks 108A-N. The plan specifies the one or more sub-tasks 108A-N. In implementations the planning engine 105 can do this by generating one or more sub-task prompts, where each sub-task prompt corresponds to a sub-task, and has a corresponding intermediate result. Collectively, the one or more sub-task prompts define the plan for performing the task characterized in the prompt 102.

[0052] The one or more sub-tasks 108A-N can be arranged in any sequential or parallel order within the plan. For example, the one or more sub-tasks can include a first sub-task 108A that must be performed prior to a second sub-task 108B, e.g., because the second sub-task 108B operates on an intermediate result that is generated after the first sub-task 108A is accomplished. As another example, the one or more sub-tasks can include a first sub-task 108A that can be performed independently from, e.g.. in parallel with, a second sub-task 108B.

[0053] The planning engine 105 can generate the one or more sub-task prompts from the prompt 102 in many different ways.

[0054] In some implementations, the planning engine 105 can apply any known text classification, information extraction, or grounded semantic extraction techniques to extract any portions of the prompt 102, and then generate the one or more sub-task prompts that correspond to the one or more sub-tasks 108A-N based on the extracted portions of the prompt 102, e.g., by concatenating a predetermined template sequence or another sequence that is generated by using the generative neural network 120 to an extracted portion of the prompt 102.

[0055] In some implementations, the planning engine 105 can generate the one or more subtask prompts from the prompt 102 by interacting with the generative neural network 120 or another neural network. For example, the planning engine 105 can generate an input sequence that includes one or more task planning examples followed by the prompt 102 and then provide the input sequence for processing by the generative neural network 120 to generate the one or more sub-task prompts that correspond to the one or more sub-tasks 108A-N. For example, each task planning example can be in the form of an input-output pair, where the input describes an example task, and the output describes example sub-task prompts that should be generated by the generative neural network 120 based on processing the input.

[0056] In these implementations the planning engine 105 can interact with the generative neural network 120 by using any of the techniques discussed in Shunyu Yao. et al. React: Synergizing reasoning and acting in language models. arXiv preprint arXiv:2210.03629 (2022); Yao, Shunyu, et al. "Keep calm and explore: Language models for action generation in text-based games." arXiv preprint arXiv:2010.02903 (2020); and Huang, Wenlong, et al. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. International conference on machine learning. PMLR. 2022, the entire contents of which are hereby incorporated by reference.

[0057] Suppose, for example, the task is a question-answering task, and the prompt 102 includes context data as follows: "What is the elevation range for the area that the eastern sector of the Colorado orogeny extends into?”

[0058] In this example, the planning engine 105 can generate, from the prompt 102, a first sub-task prompt: “Search [Colorado orogeny]”, which defines a first sub-task of searching the Internet for resources relevant to the keyword “Colorado orogeny”; a second sub-task prompt: “Lookup [eastern sector]”, which defines a second sub-task of searching the Internet for resources relevant to the keyword “eastern sector; a third sub-task prompt: “Search [High Plains]”, which defines a third sub-task of searching the Internet for resources relevant to the keyword “High Plains”, and a fourth sub-task prompt: “Finish[High Plains]” which defines a fourth sub-task of using the generative neural network 120 to generate, as the result for the question-answering task, an output sequence of text based on the resources identified for the keyword “High Plains”.

[0059] Note that in this example the first and second sub-tasks can be arranged in parallel, but the third sub-task is arranged subsequent to the second sub-task, as the keyword “High Plains” is mentioned in the intermediate result for the second sub-task (e.g., it can be “The eastern sector extends into the High Plains and is called the Central Plains orogeny.”). Likewise, the fourth sub-task is arranged subsequent to the third sub-task, as the output sequence of text is dependent on the intermediate result for the third sub-task (e.g., the intermediate result for the third sub-task can be “The High Plains are a subregion of the Great Plains. From east to west, the High Plains rise in elevation from around 1 ,800 to 7,000 ft.” and thus the output sequence of text can be “1,800 to 7,000 ft”.

[0060] Some sub-tasks can be performed by using the generative neural network 120 alone. That is. the task execution system 100 can use the generative neural network 120 alone to generate the intermediate results for some sub-tasks. Examples of these sub-tasks include generating an output sequence of text, an image, a video, or an audio.

[0061] Some other sub-tasks cannot be performed by using the generative neural network 120 alone, and instead require usage of some external tools, either in place of using the generative neural network 120 or in addition to using the generative neural network 120. For example the task execution system 100 can interact with the external tools through application programming interfaces (APIs) that are made available by the external tools.

[0062] An external tool can generally be any software that is query able, e.g., by the task execution system 100, to provide data in response to a query. Generally, the usage of such external tools improves the likelihood that the task execution system 100 can successfullyaccomplish complex tasks, or tasks that cannot be accurately performed by using the generative neural network 120 alone.

[0063] Examples of these external tools include an Internet search system, a machine translation system, a question answering system, a calculator system, a calendar system, to name just a few. Correspondingly, examples of those other sub-tasks include searching a corpus of documents, e.g., web pages, books, or other documents to obtain a set of search results that each identify a respective document that is relevant to a search query, determining which day in week a particular date is, evaluating mathematical expressions to generate a result, and so on.

[0064] Having performed the one or more sub-tasks 108A-N in accordance with the plan to obtain the corresponding intermediate result for each sub-task, the task execution system 100 then generates the result 126 for the task characterized by the prompt 102 based on the corresponding intermediate results for the one or more sub-tasks 108A-N.

[0065] The result 126 can be generated in any of a variety of ways, depending on the plan that specifies the one or more sub-tasks 108A-N for performing the task. For example, the result 126 can include a concatenation of a first intermediate result for a first sub-task 108 A and a second intermediate result for a second sub-task 108B. As another example, the result 126 can include data derived from a corresponding intermediate result for a sub-task, e.g., an output sequence of text generated by using the generative neural network 120 to process data that includes the corresponding intermediate result for the sub-task.

[0066] The task execution system 100 can then provide the result 126 as an output, e.g., by providing the result 126 to be presented on a display of a client device to the user who submitted the instruction data for the task. Additionally or alternatively, after generating the result 126, the task execution system 100 can provide the result 126 to one or more external systems for storage or further processing.

[0067] In practice, performing tasks by using the task execution system 100 in this way is slow and consumes a large amount of computing resources, e.g., processing resources, network bandwidth resources, and energy resources, because of both the memory and computation requirement of the generative neural network 120 and the network bandwidth requirement of the external tools.

[0068] The consumption of computing resources can be significant in scenarios where the task execution system 100 has a large user base, e.g., has one million, two million, ten million, or more users, and hence, receives a large number of, e.g., one million, two million.ten million, or more, prompts for various tasks to be performed by the task execution system 100.

[0069] As such, the task execution system 100 as described in this specification makes use of several additional components to shorten inference time and reduce computing resource consumption. As illustrated in FIG. 1, the additional components include a search engine 130, a cache maintenance engine 140. The additional components further include a cache 150 that can be implemented in any storage device accessible by the task execution system 100.

[0070] The cache 150 maintains data that is generated as a result of historic tasks previously performed by the task execution system 100 in response to historic prompts 102 received by the task execution system 100 in the past, i.e., before the prompt 102 is received. The cache maintenance engine 140 is configured to manage the data stored in the cache 150. For example, the cache maintenance engine 140 can add new data to the cache 150 and delete existing data from the cache 150. The data includes data at sub-task granularity that is related to various sub-tasks that have been previously performed by the task execution system 100 (referred to as "‘cached sub-tasks’") when performing the historic tasks.

[0071] More specifically, the cache 150 stores, for each of a plurality of cached sub-tasks: (i) a cached intermediate result generated for the cached sub-task, (ii) an identifier for the cached sub-task, and, optionally, (iii) metadata for the cached intermediate result. In implementations the cache 150 can have any appropriate data structure that, for a cached subtask, relates the identifier, the cached intermediate result, and, when stored, (iii) the metadata.

[0072] Thus, after a corresponding intermediate result for each sub-task is generated, i.e., either by using the generative neural network 120 or by using an external tool, the cache maintenance engine 140 can store a copy of the intermediate result in the cache 150.Moreover, after the corresponding intermediate result for each sub-task is generated, the task execution system 100 generates an identifier for the cached sub-task, and the cache maintenance engine 140 stores the identifier in association with the corresponding intermediate result in the cache 150.

[0073] There are many ways in which the identifier can be generated.

[0074] In some implementations, the identifier can include text in some natural language that describes the sub-task. For example, the task execution system 100 can use any portion of the corresponding sub-task prompt or the corresponding intermediate result for the cached subtask as the identifier. As another example, the task execution system 100 can process the corresponding sub-task prompt or the corresponding intermediate result for the cached subtask by using the generative neural network 120 or another neural network to generate asummarization or another textual description, and then use the summarization or the textual description as the identifier.

[0075] In some implementations, the identifier can be in the form of a vector in an embedding space. For example, the task execution system 100 can generate the vector for the sub-task by processing the corresponding sub-task prompt, the corresponding intermediate result, or the summarization generated by using the generative neural network 120 (as mentioned above) for the cached sub-task using an embedding neural network that includes one or more neural network layers of any appropriate type, or some other machine learning model.

[0076] The metadata can characterize any of a variety of aspects of the cached intermediate results.

[0077] For example, for each of the plurality of cached sub-tasks, the metadata for the cached intermediate result can include metadata that defines an expiration time of the cached intermediate result. The metadata can define the expiration time definitely, e.g., that the cached intermediate result expires at 11:59 on Jan. 1, 2025 or expires at infinity (namely it never expires), or can alternatively define the expiration time relatively, e.g.. that the cached intermediate result expires in 60 calendar days after it has been generated or expires after an infinite amount of time has elapsed.

[0078] As another example, for each of the plurality of cached sub-tasks, the metadata for the cached intermediate result can include metadata that defines a usage frequency of the cached intermediate result. For example, the metadata can include a count of use of the cached intermediate result by the task execution system 100 over a given amount of time. As another example, the metadata can include a count of use of the cached intermediate result by the task execution system 100 when performing a given number of tasks.

[0079] As another example, for each of the plurality of cached sub-tasks, the metadata for the cached intermediate result can include metadata that defines the time since the last use of the cached intermediate result. For example, the metadata can include a length of time that has elapsed since the last time the cached intermediate result is used by the task execution system 100 when performing a given task.

[0080] In FIG. 1, for example, the first cached sub-task in the cache 150 is a sub-task of generating an output sequence of text that is a brief description of George Washington by using the generative neural network 120. The cached intermediate result for the first cached sub-task that is stored in the cache 150 thus can for example be: "George Washington was an American Founding Father, military officer, and politician who served as the first presidentof the United States from 1789 to 1797. . . ” The second cached sub-task in the cache 150 is a sub-task of calculating a mathematics expression: “5 squared’" by using a calculator system. The cached intermediate result for the second cached sub-task that is stored in the cache 150 thus can be: “25”. Note that, in either example, the expiration time of the cached intermediate result can be set to infinity because such an answer is always factually correct and thus will not expire.

[0081] When performing the task characterized by the prompt 102. for each of one or more sub-tasks that is defined in the plan for the task that is generated by the planning engine 105, the search engine 130 is configured to perform a nearest neighbor (NN) search computation to search through the identifiers stored in the cache 150 for an identifier that is most similar to an identifier for the sub-task according to some similarity’ measure.

[0082] The identifier for the sub-task will usually be generated by task execution system 100 in the same way as the identifiers for the cached sub-tasks that are stored in the cache 150, e.g., by using a portion of a sub-task prompt that corresponds to the sub-task as the identifier, or by processing the sub-task prompt using an embedding neural network to generate a vector, which is then used as the identifier.

[0083] When the identifier includes text in some natural language, for some similarity measures, e.g., edit distance or other distance measures, the most similar identifier is the one stored in the cache 150 that is closest to the identifier for the sub-task.|00084| When the identifier is in the form of a vector in an embedding space, for some similarity measures, e.g.. Euclidean distance or Manhattan distance or other distance measures, the most similar identifier is the one stored in the cache 150 that is closest to the identifier for the sub-task (have the smallest similarity measure with the identifier for the subtask).

[0085] When the identifier is in the form of a vector in an embedding space, for some other similarity measures, e.g., inner product similarity or cosine similarity, the most similar identifier is the one stored in the cache 150 that has the largest similarity’ measure with the identifier for the sub-task.

[0086] For each of one or more sub-tasks, after obtaining the most similar identifier by using the search engine 130, the task execution system 100 determines whether to use the corresponding cached intermediate result that is stored in association with the most similar identifier in the cache 150 to generate the intermediate result for the sub-task.

[0087] For example, if the most similar identifier stored in the cache 150 matches the identifier for the sub-task, e.g., they satisfy a similarity measure threshold, then the taskexecution system 100 uses the corresponding cached intermediate results that is stored in the cache 150 as the intermediate result for the sub-task, i.e., without using either the generative neural network 120 or any external tool to perform the sub-task to generate an intermediate result for the sub-task.

[0088] Continuing with the example above, suppose, that the prompt 102 in FIG. 1 characterizes a task of generating a description of the first 3 president of the United States, and the plan that is generated by the planning engine 105 from the prompt 102 includes three sub-tasks 108A-C : a first sub-task 108A of generating a description of the first US president, a second sub-task 108B of generating a description of the second US president, and a third sub-task 108C of generating a description of the third US president.

[0089] In this example, by using the identifier matching techniques described above, the task execution system 100 is able to determine that the identifier of the first cached sub-task (generating an output sequence of text that is a brief description of George Washington) in the cache 150 matches the identifier for the first sub-task 108A. Correspondingly, the task execution system 100 uses the cached intermediate result ("George Washington was an American Founding Father, military officer, and politician who served as the first president of the United States from 1789 to 1797. . . ”) for the first cached sub-task as the intermediate result for the first sub-task 108A; the task execution system 100 refrains from using the generative neural network 120 to generate another output sequence of text representing a description of the first US president when performing the task characterized by the prompt 102.

[0090] Alternatively, suppose, that the prompt 102 in FIG. 1 characterizes a task of generating a response to the following question: “one robot assembles five vehicles per day, how many vehicles can be assembled every day in a factory that has five robots " and the plan that is generated by the planning engine 105 from the prompt 102 includes two sub-tasks 108A-B: a first sub-task 108A of calculating a mathematics expression: “5 multiplied by 5”, and a second sub-task 108B of generating, based on the intermediate result of the first subtask 108 A, an output sequence that represents the answer to the question by using the generative neural network 120.

[0091] In this example, by using the identifier matching techniques described above, the task execution system 100 is able to determine that the identifier of the first cached sub-task (calculating a mathematics expression: “5 squared”) in the cache 150 matches the identifier for the first sub-task 108A. Correspondingly, the task execution system 100 uses the cached intermediate result (“25”) for the first cached sub-task as the intermediate result for the firstsub-task 108A: the task execution system 100 refrains from using the calculator system to compute any mathematics expressions when performing the task characterized by the prompt 102.

[0092] In this way the task execution system 100 can shorten inference time and reduce computing resource consumption by avoiding using the generative neural network 120 and, analogously, the external tools to repeatedly generate multiple intermediate results that are largely similarly to each other, e.g., preventing using the generative neural network 120 to generating overly duplicative texts, images, videos, or audios or preventing using a search system to do overly duplicative searching, when performing tasks in response to different prompts 102. Using the cached intermediate results to generate the intermediate result for the sub-tasks also ensures that they can be generated faster than if they would have to be generated by using the generative neural network 120 or the external tools.

[0093] In some implementations, the cache 150 can have a fixed size limit, and thus for some cached sub-tasks that are least likely to be performed again, based on various criteria, the cache maintenance engine 140 can perform cache maintenance operations on the cache 150 to delete existing data related to these cached sub-tasks to make room for new sub-tasks as they are being performed by the task execution system 100.

[0094] In principle the cache maintenance operations can be repeated as often as necessary' to make the caching as data efficient as possible, e.g., once per day, once per week, once per month, or every time a request for a cache maintenance operation is received.

[0095] For example, a cache maintenance operation can include deleting the cached intermediate results (and their associated identifier and metadata) that have already expired. Specifically, the cache maintenance engine 140 can identify a cached intermediate result for a cached sub-task that has metadata that defines an earliest expiration time among the expiration times associated with all cached intermediate results stored in the cache 150, and then delete the identified cached intermediate result from the cache 150.

[0096] As another example, a cache maintenance operation can include deleting the cached intermediate results (and their associated identifier and metadata) that are least likely used again. Specifically, the cache maintenance engine 140 can identify a cached intermediate result for a cached sub-task that has metadata that defines a lowest usage frequency among the usage frequencies associated with all cached intermediate results stored in the cache 150, and then delete the identified cached intermediate result from the cache 150.

[0097] Additionally or alternatively, the cache maintenance engine 140 can identify a cached intermediate result for a cached sub-task that has metadata that defines a longest length oftime since last use among the times since last use associated with all cached intermediate results stored in the cache 150, and then delete the identified cached intermediate result from the cache 150.

[0098] As a further example, instead of storing multiple individual cached intermediate results, a group of similar cached intermediate results can be combined into a single cached intermediate result as a result of a cache maintenance operation that is performed by the cache maintenance engine 140.

[0099] Suppose, for example, the cache 150 stores the cached intermediate result for a cached sub-task of generating an output sequence of text representing an answer to the question “Where was the first American president bom?’" and also stores the cached intermediate result for another cached sub-task of generating an output sequence of text representing an answer to the question “What is the birthplace of George Washington?” In this example, by performing a cache maintenance operation, the cache maintenance engine 140 can delete either one of the two cached intermediate results (and their associated identifier and metadata) because they are reasonably similar to each other.[000100] FIG. 2 is a flow diagram of an example process 200 for generating a result for a task. For convenience, the process 200 will be described as being performed by one or more systems of one or more computers located in one or more locations. For example, a task execution system, e.g., the task execution system 100 of FIG. 1, appropriately programmed in accordance with this specification, can perform the process 200.[000101] The system includes a generative neural network. The generative neural network can have any appropriate neural network architecture that allows the neural network to map an input sequence of tokens from a vocabulary to an output sequence of tokens from the vocabulary.[000102] The system accesses a cache for a plurality of cached sub-tasks. The cache stores, for each of the plurality of cached sub-tasks: (i) a cached intermediate result generated by using the generative neural network or an external tool for the cached sub-task, (ii) an identifier for the cached sub-task, and. optionally, (iii) metadata. For example, for each cached sub-task, the metadata can include data that defines (i) an expiration time of the cached intermediate result, or (ii) a usage frequency of the cached intermediate result, or both (i) and (ii).[000103] The system receives a prompt to perform a task using the generative neural network (step 202). As mentioned above the prompt can include instruction data thatcharacterizes the task to be performed by the system and context data that will be processed by the system in order to perform the task.[000104] The system obtains a plan for performing the task by completing one or more sub-tasks (step 204). The plan specifies the one or more sub-tasks. In some implementations, the system can do this by using a planning engine that is implemented within the system (as mentioned above) to generate one or more sub-task prompts based on the prompt. Each subtask prompts corresponds to a sub-task. Each sub-task has a corresponding intermediate result. In some other implementations, the system can receive the plan that specifies the one or more sub-tasks from another system, e.g., a remote system that implements such a planning engine.[000105] The system obtains an intermediate result for each sub-task (step 206), as will be described further below in FIG. 3. In short, at step 206, the system determines, for each sub-task, whether to use any of the cached intermediate results that are stored in the cache to generate the intermediate result for the sub-task.[000106] The system generates a result for the task based on the intermediate result obtained for each sub-task (step 208). The result can include an intermediate result as-is, or some data that is derived from an intermediate result, e.g., data that is generated as a result of further processing of the intermediate results.[000107] As a particular example, when the generative neural network is configured as an auto-regressive Transformer-based neural network, the generative neural network can proceed to generate the remaining portion of the result conditioned on the obtained intermediate results and any previous portion of the result that has already been generated by the generative neural network.[000108] Notably, in many cases, the result will be generated based on at least one intermediate result that is not generated by using the generative neural network or the external tool, and that is instead generated based on a cached intermediate result that is already stored in the cache. That is, at step 206, for at least one sub-task, obtaining the intermediate result includes retrieving the intermediate result from the cache. In fact, the greater the number of cached intermediate results stored in the cache, the higher the likelihood that the result for the task will be generated based on an intermediate result that is obtained without using the generative neural network or the external tool.[000109] FIG. 3 is a flow diagram of an example process 300 for generating an intermediate result for a sub-task. For convenience, the process 300 will be described as being performed by one or more systems of one or more computers located in one or morelocations. For example, a task execution system, e.g., the task execution system 100 of FIG. 1, appropriately programmed in accordance with this specification, can perform the process 300. The system can perform process 300 for each of the one or more sub-tasks that is specified in the plan generated at step 204 of process 200.[000110] The system performs a search in the cache for a most similar cached sub-task to the sub-task (step 302). In particular, the system performs a nearest neighbor (NN) search computation based on using the identifiers for the plurality of cached sub-tasks that are stored in the cache and the identifier for the sub-task to search for the most similar cached sub-task, according to some similarity measure.[000111] If an identifier for the most similar cached sub-task matches the identifier for the sub-task, the system generates the intermediate result for the sub-task without using the generative neural network (step 304). For example, the system can compute a similarity measure between the identifier for the most similar cached sub-task and the identifier for the sub-task. If the computed similarity7measure satisfies a threshold similarity measure, the system can determine that there is a match. Accordingly, the system can generate the output for the sub-task without using the generative neural network.[000112] In implementations there are many ways to perform step 304. For example, the system can perform step 304 based on utilizing the metadata associated with the cached intermediate results stored in the cache.|000113| In some implementations, if the identifier for the most similar cached sub-task matches the identifier for the sub-task and an expiration time of a cached intermediate result for the most similar cached sub-task that is stored in the cache is after a current time at which the prompt is received, the system can directly use the cached intermediate result for the most similar cached sub-task as-is as the intermediate result for the sub-task.[000114] In some implementations, if the identifier for the most similar cached sub-task matches the identifier for the sub-task but the expiration time of the cached intermediate result for the most similar cached sub-task that is stored in the cache is before the current time at which the prompt is received, i.e., the cached intermediate result has expired, the system can modify the cached intermediate result for the most similar cached sub-task and then use the modified cached intermediate result as the intermediate result for the sub-task.[000115] For example, the system can process, using an alternative neural network, at least the cached intermediate result for the most similar cached sub-task to generate the modified cached intermediate result. In this example the alternative neural network can be alightweight generative neural network that has fewer parameters and thus has a faster inference speed, a lower inference cost, or both than the generative neural network. [000116] Alternatively, if the identifier for the most similar cached sub-task does not match the identifier for the sub-task, the system generates the intermediate result for the subtask by using the generative neural network (step 306). For example, the system can compute a similarity measure between the identifier for the most similar cached sub-task and the identifier for the sub-task. If the computed similarity measure does not satisfy a threshold similarity measure, the system can determine that there is a mismatch. Accordingly, the system can generate the output for the sub-task by using the generative neural network. [000117] This specification uses the term “configured'’ in connection with systems and computer program components. For a system of one or more computers to be configured to perform particular operations or actions means that the system has installed on it software, firmware, hardware, or a combination of them that in operation cause the system to perform the operations or actions. For one or more computer programs to be configured to perform particular operations or actions means that the one or more programs include instructions that, when executed by data processing apparatus, cause the apparatus to perform the operations or actions.[000118] Embodiments of the subject matter and the functional operations described in this specification can be implemented in digital electronic circuitry, in tangibly-embodied computer software or firmware, in computer hardware, including the structures disclosed in this specification and their structural equivalents, or in combinations of one or more of them. Embodiments of the subject matter described in this specification can be implemented as one or more computer programs, e g., one or more modules of computer program instructions encoded on a tangible non transitory storage medium for execution by, or to control the operation of, data processing apparatus. The computer storage medium can be a machine- readable storage device, a machine-readable storage substrate, a random or serial access memory device, or a combination of one or more of them. Alternatively or in addition, the program instructions can be encoded on an artificially generated propagated signal, e.g., a machine-generated electrical, optical, or electromagnetic signal, that is generated to encode information for transmission to suitable receiver apparatus for execution by a data processing apparatus.[000119] The term “data processing apparatus” refers to data processing hardware and encompasses all kinds of apparatus, devices, and machines for processing data, including by way of example a programmable processor, a computer, or multiple processors or computers.The apparatus can also be, or further include, special purpose logic circuitry, e.g., an FPGA (field programmable gate array) or an ASIC (application specific integrated circuit). The apparatus can optionally include, in addition to hardware, code that creates an execution environment for computer programs, e.g., code that constitutes processor firmware, a protocol stack, a database management system, an operating system, or a combination of one or more of them.[000120] A computer program, which may also be referred to or described as a program, software, a softw are application, an app, a module, a software module, a script, or code, can be w ritten in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages; and it can be deployed in any form, including as a stand alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment. A program may, but need not, correspond to a file in a file system. A program can be stored in a portion of a file that holds other programs or data, e.g., one or more scripts stored in a markup language document, in a single file dedicated to the program in question, or in multiple coordinated files, e.g., files that store one or more modules, sub programs, or portions of code. A computer program can be deployed to be executed on one computer or on multiple computers that are located at one site or distributed across multiple sites and interconnected by a data communication network.[000121] In this specification, the term “database’' is used broadly to refer to any collection of data: the data does not need to be structured in any particular way, or structured at all, and it can be stored on storage devices in one or more locations. Thus, for example, the index database can include multiple collections of data, each of w hich may be organized and accessed differently.[000122] Similarly, in this specification the term “engine” is used broadly to refer to a software-based system, subsystem, or process that is programmed to perform one or more specific functions. Generally, an engine will be implemented as one or more software modules or components, installed on one or more computers in one or more locations. In some cases, one or more computers will be dedicated to a particular engine; in other cases, multiple engines can be installed and running on the same computer or computers.[000123] The processes and logic flow s described in this specification can be performed by one or more programmable computers executing one or more computer programs to perform functions by operating on input data and generating output. The processes and logic flows can also be performed by special purpose logic circuitry, e.g., an FPGA or an ASIC, or by a combination of special purpose logic circuitry and one or more programmed computers.[000124] Computers suitable for the execution of a computer program can be based on general or special purpose microprocessors or both, or any other kind of central processing unit. Generally, a central processing unit will receive instructions and data from a read only memory or a random access memory or both. The essential elements of a computer are a central processing unit for performing or executing instructions and one or more memory devices for storing instructions and data. The central processing unit and the memory can be supplemented by, or incorporated in, special purpose logic circuitry. Generally, a computer will also include, or be operatively coupled to receive data from or transfer data to, or both, one or more mass storage devices for storing data, e.g., magnetic, magneto optical disks, or optical disks. However, a computer need not have such devices. Moreover, a computer can be embedded in another device, e.g., a mobile telephone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a Global Positioning System (GPS) receiver, or a portable storage device, e.g., a universal serial bus (USB) flash drive, to name just a few. [000125] Computer readable media suitable for storing computer program instructions and data include all forms of non volatile memory, media and memory devices, including by way of example semiconductor memory devices, e.g., EPROM, EEPROM, and flash memory devices; magnetic disks, e.g., internal hard disks or removable disks; magneto optical disks; and CD ROM and DVD-ROM disks.[000126] To provide for interaction with a user, embodiments of the subject matter described in this specification can be implemented on a computer having a display device, e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor, for displaying information to the user and a keyboard and a pointing device, e.g., a mouse or a trackball, by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback, e.g., visual feedback, auditory feedback, or tactile feedback; and input from the user can be received in any form, including acoustic, speech, or tactile input. In addition, a computer can interact with a user by sending documents to and receiving documents from a device that is used by the user; for example, by sending web pages to a web browser on a user's device in response to requests received from the web browser. Also, a computer can interact with a user by sending text messages or other forms of message to a personal device, e.g., a smartphone that is running a messaging application, and receiving responsive messages from the user in return.[000127] Data processing apparatus for implementing machine learning models can also include, for example, special-purpose hardware accelerator units for processing common andcompute-intensive parts of machine learning training or production, e.g., inference, workloads.[000128] Machine learning models can be implemented and deployed using a machine learning framework, e.g., a TensorFlow framework or a JAX framework.[000129] Embodiments of the subject matter described in this specification can be implemented in a computing system that includes a back end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front end component, e.g., a client computer having a graphical user interface, a web browser, or an app through which a user can interact with an implementation of the subject matter described in this specification, or any combination of one or more such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN) and a wide area network (WAN), e.g., the Internet.[000130] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. In some embodiments, a server transmits data, e.g., an HTML page, to a user device, e.g.. for purposes of displaying data to and receiving user input from a user interacting with the device, which acts as a client. Data generated at the user device, e.g., a result of the user interaction, can be received at the server from the device.[000131] While this specification contains many specific implementation details, these should not be construed as limitations on the scope of any invention or on the scope of what may be claimed, but rather as descriptions of features that may be specific to particular embodiments of particular inventions. Certain features that are described in this specification in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination. Moreover, although features may be described above as acting in certain combinations and even initially be claimed as such, one or more features from a claimed combination can in some cases be excised from the combination, and the claimed combination may be directed to a subcombination or variation of a subcombination.[000132] Similarly, while operations are depicted in the drawings and recited in the claims in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order, or that all illustrated operations be performed, to achieve desirable results. In certain circumstances, multitasking and parallel processing may be advantageous. Moreover, the separation of various system modules and components in the embodiments described above should not be understood as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products.[000133] Particular embodiments of the subject matter have been described. Other embodiments are within the scope of the following claims. For example, the actions recited in the claims can be performed in a different order and still achieve desirable results. As one example, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some cases, multitasking and parallel processing may be advantageous.[000134] What is claimed is:

Claims

CLAIMS1. A method performed by one or more computers, the method comprising: maintaining a cache, the cache storing, for each of a plurality of cached sub-tasks (i) a cached intermediate result generated by using a generative neural network for the cached subtask in association with (ii) an identifier for the cached sub-task; receiving a prompt to perform a task using the generative neural network; obtaining a plan for performing the task by completing one or more sub-tasks; obtaining an intermediate result for each sub-task, wherein for at least one sub-task, obtaining the intermediate result comprises retrieving the intermediate result from the cache; and generating a result for the task based on the intermediate result obtained for each subtask.

2. The method of claim 1, wherein retrieving the intermediate result from the cache comprises: performing a search in the cache for a most similar cached sub-task to the sub-task based on using the identifier for each of the plurality of cached sub-tasks and an identifier for the sub-task; and generating the intermediate result for the sub-task without using the generative neural network when an identifier for the most similar cached sub-task matches the identifier for the sub-task.

3. The method of any one of claims 1-2, wherein the cache stores, for each of the plurality of cached sub-tasks, (i) the cached intermediate result for the cached sub-task in association with (ii) the identifier for the cached sub-task and (iii) metadata that defines (a) an expiration time of the cached intermediate result, or (b) a usage frequency of the cached intermediate result, or both (a) and (b).

4. The method of any one of claim 2-3. wherein if the identifier for the most similar cached sub-task matches the identifier for the sub-task, generating the intermediate result for the sub-task without using the generative neural network comprises: if the identifier for the most similar cached sub-task matches the identifier for the subtask and an expiration time of a cached intermediate result for the most similar cached subtask that is stored in the cache is after a current time at which the prompt is received, usingthe cached intermediate result for the most similar cached sub-task that is stored in the cache as the intermediate result for the sub-task.

5. The method of any one of claims 2-4, wherein if the identifier for the most similar cached sub-task matches the identifier for the sub-task, generating the intermediate result for the sub-task without using the generative neural network comprises: if the identifier for the most similar cached sub-task matches the identifier for the subtask and the expiration time of the cached intermediate result for the most similar cached subtask that is stored in the cache is before the current time at which the prompt is received, generating the intermediate result for the sub-task based on using a lightweight generative neural network that has fewer parameters than the generative neural network.

6. The method of claim 5, wherein generating the intermediate result for the sub-task based on using the lightweight generative neural network comprises: processing, using the lightweight generative neural network, at least the cached intermediate result for the most similar cached sub-task that is stored in the cache to generate the intermediate result for the sub-task.

7. The method of any one of claims 2-6, further comprising: performing a cache maintenance operation on the cache based on the metadata stored in the cache.

8. The method of claim 7, wherein performing the cache maintenance operation on the cache comprises: identifying a cached intermediate result for a cached sub-task that has metadata that defines an earliest expiration time; and deleting the cached intermediate result from the cache.

9. The method of any one of claims 7-8, wherein performing the cache maintenance operation on the cache comprises: identifying a cached intermediate result for a cached sub-task that has metadata that defines a lowest usage frequency; and deleting the cached intermediate result from the cache.

10. A system comprising one or more computers and one or more storage devices storing instructions that when executed by the one or more computers cause the one more computers to perform the operations of the respective method of any one of claims 1-9.

11. One or more computer storage media storing instructions that when executed by one or more computers cause the one more computers to perform the operations of the respective method of any one of claims 1 -9.