Efficient provision of machine learning model computation with high throughput and low latency.

Decoupling prefill and generation workloads in machine learning models allows for optimized serving configurations, improving efficiency and throughput by using different batch sizes and hardware resources, addressing inefficiencies in existing combined processing methods.

JP2026539152APending Publication Date: 2026-11-20GOOGLE LLC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
JP2026524908
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-10-26
Filing Date
2024-10-25
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Existing machine learning model infrastructures fail to recognize the differences between prefill and generate workloads, leading to inefficient processor utilization and low generation throughput due to combined processing at the same batch size, which is suboptimal for latency and throughput requirements.

Method used

Decouple prefill and autoregressive generation workloads, allowing for separate optimization of serving configurations based on workload demands, using different batch sizes and hardware resources for each task.

Benefits of technology

This decoupling improves overall efficiency, reduces inference costs, and enhances throughput while optimizing for latency, enabling more efficient use of computing resources and hardware.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026539152000001_ABST
    Figure 2026539152000001_ABST
Patent Text Reader

Abstract

An exemplary method includes receiving an input request to process a plurality of input sequences using a machine learning sequence processing model to generate a plurality of output sequences corresponding to each of the plurality of input sequences, each of which is generated for each of the plurality of input sequences, each of which is generated in parallel across the input elements of each input sequence, for each input sequence, each of which is generated in one or more batches having a first batch size using a prefill system, the prefill system comprising one or more prefill computing devices and running one or more layers of a machine learning sequence processing model, and autoregressively generating a plurality of output elements for each of the plurality of output sequences in one or more batches having a second batch size using the plurality of initial attention tensors, the plurality of output elements being generated using a generation system comprising one or more generation computing devices.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] Priority This application claims priority to U.S. Provisional Patent Application No. 63 / 593,413 (filed on 26 October 2023), which is incorporated herein by reference in its entirety.

[0002] This disclosure generally relates to machine learning processing and machine-learned devices and systems. More specifically, this disclosure relates to improved techniques for hosting and providing machine-learned models for performing computations. [Background technology]

[0003] A computer can receive input. A computer can execute instructions to process the input in order to produce an output using a parameterized model. A computer can receive feedback on its performance when producing an output using the model. A computer can generate feedback by evaluating its performance. A computer can receive feedback from external sources. A computer can update the model's parameters based on the feedback to improve the model's performance. In this way, a computer can iteratively "learn" to produce a desired output. The resulting model is often called a machine learning model. [Overview of the Initiative]

[0004] Aspects and advantages of the embodiments of this disclosure are partially described in the following description, or can be learned from the description, or can be learned through the practice of the embodiments.

[0005] Exemplary aspects of this disclosure provide exemplary methods. In some embodiments, an exemplary method may include receiving an input request to process a plurality of input sequences using a machine learning sequence processing model to generate a plurality of output sequences corresponding to a plurality of input sequences. An exemplary method may include generating a plurality of initial attention tensors for each of the plurality of input sequences. An exemplary method may generate one or more respective initial attention tensors for each input sequence in parallel across the input elements of each input sequence. In an exemplary method, one or more respective initial attention tensors may be generated in one or more batches having a first batch size using a prefill system, the prefill system comprising one or more prefill computing devices and running one or more layers of a machine learning sequence processing model. An exemplary method may include using the plurality of initial attention tensors to autoregressively generate a plurality of output elements for each of the plurality of output sequences in one or more batches having a second batch size. In an exemplary method, the plurality of output elements may be generated using a generation system comprising one or more generation computing devices. In an exemplary method, at least a portion of the machine learning sequence processing model may be partitioned across one or more generation computing devices along the batch dimension.

[0006] Exemplary embodiments of this disclosure provide one or more exemplary non-temporary computer-readable media for storing instructions executable by one or more processors to cause a computing system to perform exemplary operations. In some embodiments, exemplary operations may include embodiments of exemplary methods.

[0007] Exemplary embodiments of the present disclosure provide an exemplary computing system that includes one or more processors and one or more exemplary non-transitory computer-readable media storing instructions executable by the one or more processors to cause the computing system to perform exemplary operations. In some implementations, the exemplary operations may include implementations of the exemplary methods.

[0008] Other exemplary aspects of the present disclosure are directed to other systems, methods, apparatuses, tangible non-transitory computer-readable media, and devices for performing the functions described herein. These and other features, aspects, and advantages of various implementations will be better understood with reference to the following description and appended claims. The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate implementations of the present disclosure and, together with the description, serve to explain the related principles. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] [Figure 1] FIG. 2 is a block diagram of aspects of an exemplary system for implementing exemplary aspects of the present disclosure. [Figure 2] FIG. 3 is a block diagram of aspects of an exemplary system for implementing exemplary aspects of the present disclosure. [Figure 3] FIG. 4 is a block diagram of aspects of an exemplary system for implementing exemplary aspects of the present disclosure. [Figure 4] FIG. 5 is a block diagram of aspects of an exemplary system for implementing exemplary aspects of the present disclosure. [Figure 5] FIG. 6 is a block diagram of aspects of an exemplary system for implementing exemplary aspects of the present disclosure. [Figure 6] FIG. 7 is a block diagram of aspects of an exemplary system for implementing exemplary aspects of the present disclosure. [Figure 7] FIG. 8 is a block diagram of aspects of an exemplary system for implementing exemplary aspects of the present disclosure. [Figure 8]This is a block diagram of an exemplary system embodiment for implementing an exemplary embodiment of the present disclosure. [Figure 9] This is a block diagram of an exemplary system embodiment for implementing an exemplary embodiment of the present disclosure. [Figure 10] This is a block diagram of an exemplary system embodiment for implementing an exemplary embodiment of the present disclosure. [Figure 11] This is a block diagram of an exemplary system embodiment for implementing an exemplary embodiment of the present disclosure. [Figure 12] This is a block diagram of an exemplary system embodiment for implementing an exemplary embodiment of the present disclosure. [Figure 13] This is a block diagram of an exemplary system embodiment for implementing an exemplary embodiment of the present disclosure. [Figure 14] This is a block diagram of an exemplary system embodiment for implementing an exemplary embodiment of the present disclosure. [Figure 15] This chart reports exemplary measurements of a case study of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 16] This figure shows an exemplary partitioned layout of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 17] This figure shows an exemplary partitioned layout of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 18] This figure shows an exemplary partitioned layout of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 19] This figure shows an exemplary partitioned layout of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 20] This chart reports exemplary measurements of a case study of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 21] This chart reports exemplary measurements of a case study of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 22]This chart reports exemplary measurements of a case study of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 23] This chart reports exemplary measurements of a case study of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 24] This chart reports exemplary measurements of a case study of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 25] This chart reports exemplary measurements of a case study of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 26] This chart reports exemplary measurements of a case study of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 27] This chart reports exemplary measurements of a case study of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 28] This chart reports exemplary measurements of a case study of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 29] This chart reports exemplary measurements of a case study of an exemplary system for implementing exemplary embodiments of the present disclosure. [Figure 30] This is a flowchart illustrating an exemplary method for implementing an exemplary aspect of the present disclosure. [Figure 31] This is a flowchart illustrating an exemplary method for implementing an exemplary aspect of the present disclosure. [Figure 32] This flowchart illustrates an exemplary method for training a machine learning model according to exemplary embodiments of the aspects of this disclosure. [Figure 33] This is a block diagram of an exemplary processing flow for using a machine learning model to process inputs for generating an output, according to an exemplary embodiment of an aspect of the present disclosure. [Figure 34]This is a block diagram of an exemplary sequence processing model according to an exemplary embodiment of the present disclosure. [Figure 35] This is a block diagram of exemplary technology for populating exemplary input sequences for processing by a sequence processing model, according to exemplary embodiments of aspects of the present disclosure. [Figure 36] This is a block diagram of an exemplary model development platform according to an exemplary embodiment of the aspects of the present disclosure. [Figure 37] This is a block diagram of an exemplary training workflow for training a machine learning model according to an exemplary embodiment of the aspects of the present disclosure. [Figure 38] This is a block diagram of an inference system for running one or more machine learning models to perform inference, according to an exemplary embodiment of an aspect of the present disclosure. [Figure 39] This is a block diagram of an exemplary network computing system according to an exemplary embodiment of the aspects of the present disclosure. [Figure 40] This is a block diagram of an exemplary computing device according to an exemplary embodiment of the aspects of the present disclosure. [Figure 41] This is a block diagram of an exemplary computing device according to an exemplary embodiment of the aspects of the present disclosure. [Modes for carrying out the invention]

[0010] Generally, this disclosure covers techniques for enhancing the parallelization of machine learning models, such as autoregressive machine learning-based sequence processing models. Exemplary embodiments of this disclosure provide techniques for distributing execution tasks across multiple hardware accelerators, thereby improving the scalability of machine learning models and systems. The distribution of execution tasks can be adapted to different workloads based on the requirements of each workload.

[0011] In some embodiments, exemplary embodiments of the Disclosure can improve the efficiency and speed of running autoregressive machine learning-based sequence processing models (e.g., large language models, i.e., LLMs) and delivering results from them by decoupling different workloads and optimizing the serving configuration of the Disclosure for each. Some applications, including interactive workloads such as chatbots, have strict latency constraints. Others, including offline inference for scoring or distillation, prioritize high throughput per token and low cost regardless of latency. By decoupling different workloads and optimizing the serving configuration for each, exemplary embodiments of the Disclosure can be optimized for different targets (e.g., throughput, latency, cost, etc.).

[0012] Traditional infrastructures generally combine prefill and generate workloads and force them to run on the same server at the same batch size. More generally, traditional approaches generally fail to recognize the differences between prefill and generate workloads and the associated impact on computing resource usage. When this is combined with strict latency constraints for the overall reasoning, it can force prefill to run at batch size 1, and this combination also forces decoding to run at batch size 1, resulting in relatively insufficient processor utilization and low generation throughput.

[0013] Exemplary embodiments of this disclosure allow for the isolation of workloads based on the stage of processing an input request. For example, a request for inference might require the model to process an input sequence containing an initial set of input elements and to generate an output sequence (having one or more output elements) based on the input sequence. Processing the input sequence to understand the input context might be called a “prefill” task. For example, the model’s internal inference system could “prefill” this initial set of context before beginning to generate new output elements. Processing the context to generate new output elements might be called a “generate” task or “decode” task.

[0014] Exemplary embodiments of this disclosure can separate prefilling and autoregressive generation workloads. This decoupling can, in some cases, lead to a significant reduction in inference costs by optimizing the configuration of the model serving architecture for each workload, thereby improving the overall efficiency of the system. Workload decoupling can enable optimization of overall throughput by changing the serving configuration as needed for each task, resulting in improved efficiency and cost savings. For example, using different batch sizes for prefilling and generation can increase efficiency and throughput and reduce latency.

[0015] An exemplary embodiment of this disclosure allows prefill and decode programs to be interleaved on the same server, with prefill for each new session occurring in a first interval with a first batch size (e.g., 1), and generation occurring in a second interval with a larger second batch size. The system can alternate between prefill and generation computations. This configuration can improve overall throughput while reducing latency in some situations. To batch different sessions together, the server may maintain batches of inference intermediates (e.g., KV cache) in the form of a circular buffer that is updated during prefill and generation. The buffer may maintain a “cursor” representing the current position in the decode. In some examples, this approach can maintain a high effective batch size and, consequently, high throughput throughout prefill and generation. This approach involves splitting the inference job into two tasks, the two tasks being batched separately and executed dynamically based on the arrival of requests. This approach may involve maintaining a decoding intermediate (e.g., a KV cache circular buffer) in accelerator memory during these computations.

[0016] Other exemplary embodiments of this disclosure may utilize a separate prefill and generation system. This approach allows prefill and generation tasks to be performed in separate pools of servers. An exemplary lifecycle of an input request may include arriving at the router, being forwarded to an available prefill server that computes the internal context state of the model (e.g., an attention tensor such as a KV cache), and then being sent to a generation server to generate the context state based on the context. The generation system may employ a circular buffer similar to that described above with respect to the interleaved approach, except that prefill updates to the buffer may be received from the prefill system, instead of pausing generation to perform prefill locally. The generation system may employ a different batch size (e.g., 32, 64, 256, 512, etc.) than the prefill system.

[0017] Furthermore, separating the prefill and generation workloads makes it easier to use different model architectures or configurations for prefill and generation. For example, different model partitioning schemes, quantization schemes, etc., can be used in the prefill and generation workflows.

[0018] Furthermore, separating prefill and generation workloads can make it possible to use different hardware for each task. For example, hardware selections for prefill and generation tasks can be chosen to optimize resources for the different demands of prefill and decode.

[0019] For example, pre-filtering tasks can have computational bottlenecks. For instance, high intrinsic parallelism may allow pre-filling to be done using a single forward pass through the model (e.g., in parallel across multiple inputs), which can reduce the memory bandwidth required to load or unload intermediate computations or model weights. In contrast, generation tasks can have memory bottlenecks. For example, autoregressive generation, which involves multiple forward passes through the model to sample a series of outputs (e.g., based on previously sampled outputs), can be heavily reliant on memory bandwidth to load and offload model weights and intermediate computations from the computation core (e.g., per forward pass).

[0020] Thus, for example, a pool of hardware devices can be provisioned to optimally handle input requests. The pool of hardware devices can be homogeneous or heterogeneous. For example, a pool of hardware devices may include computing devices with various specifications. In some cases, some hardware devices may have higher memory bandwidth than others. Some hardware devices may be faster or have more computing cores than others.

[0021] Furthermore, exemplary embodiments also provide techniques for partitioning large models across a pool of computing devices. For example, large models can have a large memory footprint due to both the trained model parameters and the transient states of intermediate computations used during prediction / generation. Model parameters may not fit into the memory of a single accelerator chip. For some models that attend across context sequences when generating the next element in a sequence, one or more layers of attention tensors can be cached or stored in memory during the generation period (e.g., to avoid recalculation at each generation step). This footprint may also not fit into the memory of a single accelerator chip. Such a large memory footprint can result in significant memory traffic to load parameters and intermediate computations from high-bandwidth memory (HBM) into the computing cores at each step, and consequently, a large total memory required to meet a given latency target. For example, in some embodiments, the system can store tensors such as weights and attention tensors in the HBM. These tensors can be transmitted from the HBM to the chip's computing cores once per forward pass of the model (prefill or generation step). This takes a certain amount of time. For small batch sizes and sequence lengths, the time spent loading weights can account for most of the processing time. For larger batch sizes and sequence lengths (e.g., batch size 512+ with 2048+ tokens), the time spent loading attention tensors can account for most of the processing time. For example, the size of the attention tensor can be proportional to the square of the sequence length.

[0022] Therefore, large models can be partitioned across many accelerator chips to fit into memory. This distributes memory and computation costs across all chips, but can introduce inter-chip communication costs. Generally, model partitioning results in inter-chip communication, and different partitioning strategies for a given model involve different patterns and amounts of communication. In a given partitioning layout, the time required for inter-chip communication does not decrease very rapidly (or not at all) with increasing numbers of chips. Inter-chip communication can become a bottleneck as the number of chips increases.

[0023] Different partitioning strategies can result in different amounts of memory bandwidth load. The choice of partitioning strategy for a given model size can depend on the requirements of the specific application. Multi-axis tensor partitioning strategies, batch sizes, and chip configurations for a particular application can be based on latency and throughput targets. For example, latency reduction can often be achieved by reducing the batch size, but as the batch size decreases, processor utilization may decrease, and consequently, the total cost per token (in terms of chip seconds or dollars) may increase. If the application requires generating text with long attention contexts, this can substantially increase inference time. For example, for a parameter transformer model with over 500 billion parameters and multi-head attention, the attention KV cache increases significantly. With a batch size of 512 and a context length of 2048, the KV cache totals 3TB, which is three times the size of the model's parameters. In some generation workflows, on-chip memory can load this KV cache from off-chip memory once for each token generated, during which time the chip's computing cores can be effectively idle. When an application uses offline inference (e.g., latency is not a concern), the primary goal may be to maximize per-chip throughput (e.g., to minimize the total cost per token). Generally, larger batches lead to better processor utilization, so increasing the batch size can be efficient. Certain partitioning strategies that are inefficient at small batch sizes may become more efficient as the batch size increases.

[0024] In certain embodiments, exemplary embodiments of the Disclosure provide technical solutions for parallel layout and memory optimization to achieve scalability of machine learning models for efficient low-latency inference of large models (e.g., models with a high number of parameters). Specifically, exemplary embodiments of the Disclosure provide a robust partitioning framework to facilitate model parallel scaling. This framework can identify the optimal partitioning strategy for a given model size with specific application requirements. This enables intelligent selection of the optimal multi-axis tensor partitioning strategy, batch size, and chip configuration for a given application, in contrast to traditional black-box exhaustive searches for partitioning strategies, which often involve consuming large amounts of computation to simply explore the search space. For example, the trade-offs between computational efficiency, latency, and communication costs may change as the model size, sequence length, and application requirements for latency and throughput change. Therefore, having a framework that allows representation and optimization for different strategies and selections can facilitate system selection and implementation improvements on different hardware configurations, without the need to experimentally run each of these different hardware configurations first. For example, the modeling framework provided herein can provide a solution to the technical problem of achieving a desired latency target, given throughput specifications, the number of chips, and a specific chip topology.

[0025] For example, in an exemplary case study, a dense model with 540B parameters running on 64 TPU v4 chips achieved a low batch size latency of 29ms per token during generation (using int8 weight quantization) and achieved 76% MFU during large batch size processing of input tokens while supporting a large context length of 2048 tokens. For interactive applications such as chatbots running on PaLM540B with int8 weights, an embodiment of the case study with 64 TPU v4 chips can process 64 tokens of text from a user, examine 1920 tokens of cached conversation history, and generate a 64-token response in a total of 1.9 seconds. For offline throughput-oriented applications, an embodiment of the case study can process 1984 tokens of input and generate a 64-token output for a vast number of samples, with an overall FLOPS efficiency of 73%. More detailed information documenting the technical improvements achieved using the exemplary partitioning techniques described herein is provided herein.

[0026] The exemplary embodiments of this disclosure can achieve numerous technical effects and benefits related to enhanced parallelization of autoregressive or non-autoregressive machine learning-based sequence processing models. For example, the technique may result in improved energy efficiency during operation of the machine learning-based model, contributing to improved capabilities of the computer implementing such model. This improved energy efficiency may manifest in several forms, such as more energy-efficient runtime execution or inference. Practically, this may mean less energy is required to keep the model in memory or to perform computations within the model. Furthermore, improved energy efficiency may enable the completion of more tasks within a given energy budget. For example, it may be possible to process a larger volume of tasks, process more complex tasks, or perform the same tasks with greater accuracy or precision.

[0027] Other examples include improved efficiency and speed in running machine learning models and providing results from those models. By decoupling different workloads and optimizing the serving configuration for each, this technique can reduce inference costs and improve overall system efficiency. For example, this disclosure can separate the prefilling and autoregressive generation tasks that are traditionally coupled in autoregressive machine learning model inference. This decoupling can, in some cases, lead to reduced inference costs by optimizing the configuration of the model serving architecture for each workload. This allows for more efficient use of computing resources and enables the processing of larger amounts of data in less time, which can be particularly beneficial in time-constrained applications such as real-time language processing or predictive models.

[0028] Another advantage of the exemplary embodiments described herein is the potential for more efficient use of hardware resources. By separating pre-fill and generation workloads, different hardware can be used for each task. For example, a pre-fill task with a computation bottleneck can be assigned to hardware with more computing cores, while a generation task with a memory bottleneck can be assigned to hardware with faster memory or higher memory bandwidth. This improved hardware utilization can result in higher performance and cost savings.

[0029] Furthermore, the exemplary embodiments disclosed herein may also enable new capabilities in computing systems. For example, by using a separate pre-fill and generation system, the exemplary embodiments may enable pre-fill and generation tasks to run on separate pools of servers. This may allow for more dynamic and flexible system configurations, and in some cases, enable the performance of more complex or large-scale tasks that would be difficult or impossible with conventional coupled approaches.

[0030] Other technical effects of the exemplary embodiments of this disclosure include improved energy efficiency when operating with machine learning models, thereby improving the capabilities of the computer implementing such models. For example, the exemplary embodiments can provide more energy-efficient runtime execution or inference. In some scenarios, improved energy efficiency may mean less energy is used to perform a given task (e.g., less energy is consumed to maintain the model in memory, less energy is consumed to perform computations within the model, etc.). In some scenarios, improved energy efficiency may result in completing more tasks for a given energy budget (e.g., completing a large number of tasks, more complex tasks, or the same tasks but with higher accuracy or precision, etc.).

[0031] In other exemplary embodiments, the exemplary embodiments may provide more energy-efficient training or model updates. In some scenarios, improved energy efficiency may result in less energy being used to perform a given number of update iterations (e.g., less energy consumed to keep the model in memory, less energy consumed to perform calculations within the model such as gradient calculations and loss backpropagation). In some scenarios, improved energy efficiency may result in completing more update iterations for a given energy budget (e.g., a large number of iterations).

[0032] Thus, for example, the energy efficiency improvements of the exemplary embodiments of this disclosure can reduce the amount of pollution or other waste associated with implementing machine learning models and systems, thereby advancing the entire field of machine learning and artificial intelligence. The amount of pollution can be reduced overall (e.g., in absolute terms) or on a normalized basis (e.g., energy per task, per model size, etc.). For example, by performing more energy-efficient training or inference operations, the amount of CO2 emitted in connection with training and running machine learning models (e.g., by power supply) can be reduced. By performing more energy-efficient training or inference operations, the amount of thermal pollution in the environment (e.g., by processor / storage location) can be reduced.

[0033] Various exemplary embodiments are described herein with reference to the accompanying drawings.

[0034] Figure 1 is a block diagram of an exemplary ecosystem implementing a segregated machine learning-based sequence processing model architecture. One or more client devices 102 can send one or more input requests 104 to a model host platform 106. The model host platform 106 may include one or more routing systems 108 that can orchestrate the processing of the input requests 104. For example, a routing system 108 may pass data from the input requests 104 to one or more prefill systems 110 to perform pre-filtering tasks (e.g., to prefill latent context data for generating content based on latent context data). The prefill systems 110 may pass these intermediate calculations 112 to one or more generating systems 114 (e.g., directly or via a routing system 108) to perform generating tasks. The generating systems 114 may process the intermediate calculations 112 (e.g., and other data) to generate outputs for processing the input requests 104. The model host platform 106 can respond to input requests (multiple) 104 and provide output payloads (multiple) 116 to client devices (multiple) 102.

[0035] The client device 102 may be, or include, any type of computing device capable of interacting with the model host platform 106. These devices may include, but are not limited to, personal computers, servers, virtual machines, laptops, tablets, smartphones, wearable technology, or any other device capable of sending and receiving data. The client device 102 may use a variety of applications or interfaces to send input requests 104 to the model host platform 106. These input requests may relate to a variety of tasks, such as interactive workloads like chatbots or offline inference for scoring or distillation.

[0036] Furthermore, the client device 102 can receive an output payload 116 from the model host platform 106, which contains the results of the processed request. The client device can be used by an individual or multiple users to send input requests to a machine learning-based sequence processing model in order to process the input sequence and generate a corresponding output sequence.

[0037] The client device(s) 102 may include software or applications that facilitate interaction with the model host platform 106. This software can handle the formation of input requests, the transmission of data to and from the model host platform 106, and the presentation of output payloads to the user. The client device(s) 102 may be part of the model host platform 106, or may be implemented on the same platform or system that also implements the model host platform 106.

[0038] An input request(s) 104 may be a series of commands or data sent to the model host platform 106 by one or more client devices 102. These requests can be sent by various protocols or methods, such as HTTP requests, API calls, or other arbitrary forms of data transmission. They represent the initial interaction between the client device(s) and the model host platform and initiate a processing sequence in the system.

[0039] Each input request 104 may contain an input sequence intended to be processed by a machine learning-based sequence processing model. The input sequence may include various data formats, such as text, numbers, images, or any other type of data to be trained to process the model. For example, in the context of a language model, the input sequence may represent a string of text.

[0040] Input requests (multiple) 104 may be generated as a result of user interaction with an application or interface on a client device (multiple) 102. For example, a user may enter a text-based query into a search engine, which may then form the basis of an input request. Alternatively, input requests (multiple) 104 may be automatically generated by software on the client device (multiple) without direct user input. The client device 102 may capture images, record sketches, record audio, etc., process these, and send them in the input requests (multiple) 104.

[0041] The nature and format of input request(s) 104 may depend on the specific application or function being performed. For example, in the context of a chatbot, input request(s) 104 may contain the text of a user's query or statement. In the case of an offline inference task, input request(s) 104 may contain a batch of data to be processed or scored.

[0042] Furthermore, the input request(s) 104 may also include additional parameters or metadata that can guide the processing of the input sequence. These may include, for example, the desired output format, the required level of detail or complexity for the output, or any other user preferences or requirements. This information can be used to customize the processing of the input sequence, thereby allowing the system to be adapted to the specific needs of different users or applications.

[0043] In some cases, multiple input requests 104 can be sent in parallel, enabling the simultaneous processing of multiple input sequences. This can be useful in scenarios requiring high throughput or efficiency, such as large-scale data processing tasks or real-time applications.

[0044] Each input request 104 may be associated with a unique identifier that enables the model host platform 106 to track the processing of the request and associate the results of the processing with the appropriate client device 102. Furthermore, the unique identifier can be used to manage the processing of multiple input requests 104, for example, by enabling the model host platform 106 to prioritize certain requests or address requests in a specific order.

[0045] Input requests (or multiple requests) 104 can be generated by an application or interface running on the client device 102. This application or interface can provide a user-friendly way for users to generate requests, for example, by allowing users to input data via a graphical user interface, or by automatically generating requests based on user actions or system events. The application or interface can also handle communication with the model host platform 106, including sending input requests (or multiple requests) 104 and receiving output payloads (or multiple requests) 116.

[0046] Input requests (multiple) 104 can be provided via an application programming interface (e.g., an API) that enables the software to communicate with the model host platform 106 in a standard manner.

[0047] The model host platform 106 may be a computing platform or system that hosts and manages the execution of machine learning models, such as machine learning-prepared sequence processing models. This platform can be implemented on one or more servers or other computing devices, which may be located in a single physical location or distributed across multiple locations. The model host platform 106 can be implemented across a single computer, a network of computers, or multiple data centers. The model host platform 106 can utilize various forms of hardware, such as CPUs, GPUs, TPUs, or other types of processing units. The model host platform 106 can be designed to handle large volumes of input requests and process these requests rapidly and efficiently. The platform can host one or more machine learning-prepared sequence processing models, such as large-scale language models (LLMs), image processing models, or any type of machine learning-prepared model (e.g., autoregressive machine learning-prepared models).

[0048] The model host platform 106 may include various systems and components designed to efficiently process input requests. For example, it may include one or more routing systems 108 that manage the flow of data between different components of the platform. These routing systems can receive input requests, forward them to appropriate processing systems (such as the prefill system 110 and the generation system 114), and route the resulting output back to the client device.

[0049] The model host platform 106 can be configured to handle a wide variety of input request types and generate various different outputs. The platform configuration may vary based on the nature of the machine learning-prepared sequence processing model it hosts. For example, if the model is a language model, the platform may be configured to handle input requests containing text data and generate text-based outputs. If the model is a multimodal model, the platform may be configured to handle input requests containing multiple different modalities of data. The platform may be configured to assemble multiple different data modalities to augment the data received in the input request 104.

[0050] The model host platform 106 can be configured to optimize the processing of different types of workloads. For example, it can be configured to prioritize latency-sensitive tasks for interactive workloads such as chatbots, maximize throughput for large-scale offline inference tasks, maximize efficient computation to reduce costs, or perform a combination of such objectives. To achieve this, the model host platform 106 can use different serving configurations for different types of workloads. For example, the model host platform 106 can separate prefilling and autoregressive generation tasks, allowing these tasks to be optimized independently based on the specific requirements of each workload.

[0051] Furthermore, the model host platform 106 can be configured to manage the hardware resources used by the system, including functions for selecting appropriate hardware for each task and for partitioning large models across multiple computing devices. Partitioning a model can involve different partitioning strategies with different patterns and amounts of communication between devices. For example, a large model that uses a large amount of memory (e.g., to store weights, activations, and intermediate calculations) can be partitioned across many accelerator chips to fit into the memory, allowing the memory and computation costs to be distributed across all chips.

[0052] The model host platform 106 may include various computing devices with different functions, such as processors with different numbers of cores or memory devices with different bandwidths. The model host platform 106 may also include software components designed to manage and optimize the use of these hardware resources, such as load balancers, task schedulers, or memory management systems.

[0053] Model Host Platform 106 can utilize a combined configuration in which prefill and generate workloads run on the same server with the same batch size. This traditional configuration may achieve low latency at the expense of reduced processor utilization and throughput.

[0054] The model host platform 106 can utilize a decoupled serving infrastructure configuration. For example, the model host platform 106 can decouple pre-filtering and generation tasks onto different pools of servers (e.g., pre-filtering system 110, generation system 114). This allows for more efficient use of hardware resources, as different tasks can be assigned to servers optimized for specific tasks. For example, pre-filtering tasks can be assigned to servers with more compute cores, while generation tasks can be assigned to servers with faster memory or higher memory bandwidth. In an exemplary decoupled configuration, the router system 108 can forward data from incoming input requests to available pre-filtering servers that compute the model's internal context state, such as an attention tensor or KV cache. This context state can then be sent to the generation servers for context-based content generation. This decoupled approach can improve overall throughput and allow for the use of different hardware for each task, resulting in improved efficiency and cost savings.

[0055] The model host platform 106 can use an interleaved serving infrastructure configuration. In this case, the prefill and decode programs can be interleaved on the same server, with each prefill for a new session occurring in a first interval with a first batch size, and generation occurring in a second interval with a larger second batch size.

[0056] The model host platform 106 can use a combination of interleaved and isolated serving configurations depending on the specific requirements of each workload. For example, the model host platform 106 can use an isolated configuration for some tasks and an interleaved configuration for others. The model host platform 106 can dynamically switch between different configurations based on the current workload.

[0057] The model host platform 106 may include various security features designed to protect the system's data and resources. These may include, for example, encryption features to protect data transmitted between the platform and client devices 102, access control features to manage who can access the system and what actions they can take, and an intrusion detection system to identify and respond to potential security threats.

[0058] The routing system(s) 108 may be an application, subsystem, or service within the model host platform 106, which can distribute input requests(s) 104 to appropriate processing systems such as prefill systems(s) 110 and generation systems(s) 114. The routing system(s) 108 can also control the flow of data within the platform and manage responses from the processing systems. The routing system(s) 108 may function as a central point of coordination, thereby processing requests from client devices(s) 102 and then sending them to the appropriate destinations.

[0059] The routing system(s) 108 may be responsible for orchestrating the processing of input requests(s) 104 using appropriate prefill and generation systems based on the nature and requirements of each request. When an input request arrives, the routing system(s) 108 may forward the request to an available prefill server that computes the internal context state of the model, such as an attention tensor or a KV cache. Once pre-filtering is complete, the resulting context state can be sent to a generation server for content generation based on the context, either directly from the prefill server or via the routing system(s).

[0060] The routing system(s) 108 can implement scheduling algorithms for queuing pre-filtering and generation tasks. These algorithms may take into account various factors, such as the current load on different processing systems, the expected processing time for different tasks, the priority levels of different tasks, and the specific resource requirements of the tasks. For example, if a pre-filtering task requires more computing power (e.g., a long input sequence length), it may be queued to a server with more computing power, larger on-processor memory, etc. Similarly, if a generation task is expected to use more resources (e.g., to handle requests for long-form content generation compared to answering yes / no questions), it may be queued to a server with high memory bandwidth.

[0061] In some examples, the sequence length may be 64, 128, 256, 512, 1024, 2048, 8192, up to 32768, or longer, for example, up to 43,000. Various exemplary sequence lengths are presented herein.

[0062] In some examples, the batch size may be or include 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, etc. Various exemplary sequence lengths are presented herein.

[0063] In some examples, the number of chips used can be 2, 4, 8, 16, 32, 64, 128, 256, or more, for example, it could include thousands or more chips.

[0064] The routing system(s) 108 can maintain queues for pre-fill and generation tasks together or separately. For example, when an input request 104 arrives, the routing system(s) 108 can add a new pre-filter task to the pre-fill queue. Similarly, once a pre-filter task is completed, the routing system(s) 108 can add a new generation task to the generation queue. The routing system(s) 108 can optimize the queuing of these tasks based on various factors, such as the current load on the pre-fill and generation systems, the priorities of different tasks, or the latency requirements of different client devices(s) 102 (e.g., different service accounts associated with client devices(s) 102).

[0065] The routing system(s) 108 may queue pre-filtered tasks based on the arrival order of input requests or according to a priority scheme. For example, some requests may have a higher priority due to the nature of their time constraints, and the routing system(s) 108 may push these requests to the front of the queue for immediate processing. Generation tasks may also be queued based on their arrival order or according to a priority scheme.

[0066] The routing system(s) 108 may function in continuous interaction with the prefill system(s) 110 and the generation system(s) 114 to monitor the status of tasks, receive updates, and redistribute tasks as needed. In the case of multiple input requests, the routing system(s) 108 can maintain client connections while the input requests are queued and processed.

[0067] Furthermore, the routing system(s) 108 can incorporate system conditions, such as a backlog of requests or system overload, into the task distribution and prioritization process. For example, when the model host platform 106 is overloaded, the routing system(s) 108 can prioritize urgent or high-priority tasks, delay non-urgent tasks, or initiate load shedding if the system capacity is exceeded.

[0068] The routing system(s) 108 can handle error scenarios such as failures of prefill or generation servers. In such cases, the routing system may reroute pending tasks from the failed server to other available servers to ensure the continuous processing of tasks.

[0069] The routing system(s) 108 can also handle the task of returning the generated output sequence to the client device 102. This may include packaging the output sequence in an appropriate format, transmitting the output sequence over the network, and ensuring that the output sequence is correctly received by the client device.

[0070] The flexible configuration provided by the routing system(s) 108 helps optimize the use of system resources, improve system response times, and enhance resilience to workload failures or changes, thereby increasing the overall efficiency and performance of the model host platform 106.

[0071] A prefill system(s) 110 may be a component or subsystem of a model host platform 106 tasked with the initial processing of input sequences received in the form of input requests. A prefill system(s) 110 may be designed to perform pre-filtering, which may include processing input sequences (e.g., from input requests(s) 104) to generate intermediate computations 112, thereby allowing the model's internal inference system to understand the context before beginning to generate new output elements.

[0072] The pre-fill system(s) 110 may include one or more generation servers, each of which may be implemented on a separate computing device or a cluster of devices. These devices may have specific hardware, such as a CPU, GPU, TPU, or other type of processor, necessary to effectively perform the pre-filling process.

[0073] Pre-filtering may involve processing an input sequence (e.g., a string of text, a sequence of image patches, a set of multimodal data types, etc.) to generate an initial set of attention tensors. These attention tensors can capture the relationships between different parts of the input sequence and can be used by the model to understand the contextual information of the input sequence. For example, some attention tensors within a transformer model architecture may be called a key-value (KV) cache.

[0074] For example, in an autoregressive transformer-based content generation model, the prefill system 110 can generate a KV cache for one or more transformer layers in parallel with the input prompt sequence. The generated KV cache may contain information about all tokens in the input sequence and their relationships to all other tokens. This processing step can be performed using a single forward pass through the transformer model and may be highly parallelized by high intrinsic parallelism. The KV cache can be computed by the self-attention layer of the transformer model. The self-attention layer can create a set of key-value pairs for each token in the input sequence. These key-value pairs can be used to compute an attention score for each possible pair of tokens, reflecting how much attention each token should pay to all other tokens when generating the next output token(s).

[0075] Generating a KV cache in parallel for the prompt sequence can be advantageous in terms of efficiency because this computation can occur independently for each token, allowing the prefill system(s) 110 to process the entire sequence at once in a single forward pass through the model. This parallelized approach can significantly reduce the time required to prefill the model, resulting in faster response times to input requests. For example, model parameters, weights, activations, etc., can be loaded into the processing core once per forward pass. By performing prefilling in a single forward pass, the prefill system(s) 110 can perform more computations with less load / unloading. Thus, for example, memory bandwidth may not be a bottleneck for the prefill system(s) 110.

[0076] Once an intermediate calculation 112 is generated, it can be transmitted from a prefill device(s) to a generation device(s) for a generation task based on the intermediate calculation 112. This transmission can be initiated and managed by a routing system(s) 108. The intermediate calculation 112 can be stored or cached in memory for later use during a subsequent generation process or subsequent pre-filter task. For example, in the case of incremental prefill, the intermediate calculation 112 can be used to quickly initiate prefill, thereby allowing the prefill system(s) 110 to perform incremental prefill on the input sequence and concatenate incremental additional intermediate calculation sets with the intermediate calculation 112 to obtain an updated set of intermediate calculations 112. For example, in a multi-turn session environment (e.g., a chatbot application), incremental prefill can improve the efficiency of the prefill system(s) 110. In an incremental prefill configuration, the machine learning-trained sequence processing model(s) can perform causal prefills (e.g., prefills performed using attention mask blocking attention on elements after the input sequence).

[0077] The prefill system(s) 110 can be configured to optimize pre-filtering based on workload requirements, server specifications, input data characteristics, and other considerations. For example, for workloads that prefer high throughput, the prefill system(s) 110 can be configured to process larger batches of data at once. Similarly, in situations where minimal latency is preferred, the prefill system(s) 110 can be configured to prioritize rapid processing of smaller batches of data.

[0078] The prefill system(s) 110 can operate on a separate computing device (e.g., a chip, server, virtual instance, etc.) from the one performing the generation task. This separation allows for independent optimization of each workload, which may result in cost savings and performance improvements. For example, considering that the prefill system(s) 110 may have computational bottlenecks due to their inherent parallel processing, the prefill system(s) 110 may be located on a server with high computing power, while the generation task, which may have memory bandwidth bottlenecks, may be performed on a server with faster memory or higher memory bandwidth.

[0079] The prefill system(s) 110 can operate with a prefill batch size. The prefill batch size can be selected to optimize the performance of the prefill system(s) 110. The prefill batch size may indicate the number of different input sequences processed by the model or model partition in each forward pass.

[0080] The pre-fill system(s) 110 can operate with a pre-fill batch size of 1. For example, pre-filtering can be highly parallelizable, allowing the pre-fill system(s) 110 to perform pre-filtering in parallel across the length of the input sequence (e.g., in parallel for each element in the sequence). Thus, for example, the "effective batch size" can be the length of the input sequence. Therefore, even when processing with a pre-fill batch size of 1 (e.g., one input sequence per forward pass), the pre-filtering can efficiently utilize computing resources by operating in parallel across the length of the input sequence. In some situations, the pre-filtering can be computationally intensive even with a batch size of 1, so increasing the batch size may not significantly increase efficiency or throughput, depending on the hardware used. However, it should be understood that larger pre-fill batch sizes can be used as desired to optimize the efficiency, throughput, latency, etc., of a particular hardware configuration.

[0081] Intermediate calculations (multiple) 112 may be data or information generated as a result of the prefill system (multiple) 110 processing the input sequence obtained based on the input request (multiple) 104. These intermediate calculations may serve as the basis for subsequent processing tasks, such as the autoregressive generation of new output elements in the sequence.

[0082] An example of an intermediate computation (or multiple computations) 112 is a key-value (KV) cache that can be generated by a prefill system (or multiple computations) 110 when processing data with a transformer-based machine learning-prepared sequence processing model. The KV cache may contain vectors representing an understanding of the input sequence at each step of the sequence. Key (K) and value (V) pairs in the KV cache may represent the self-attention score and feature representation of each token in the input sequence (e.g., a word or wordpiece in a text sequence). These key-value pairs can be used by the transformer model during the generation task to compute an attention score for obtaining a new output element, and that attention score helps determine the relevance or context of one token to other tokens in the input sequence. The KV cache can be dynamically updated as each new token is generated in the sequence.

[0083] Other examples of intermediate computations (multiple)112 may include feature maps in a convolutional neural network (CNN), hidden states in a recurrent neural network (RNN), latent vectors in an autoencoder, or any other type of data or information that a model generates as it processes the input sequence.

[0084] Intermediate computations (multiple) 112 can be stored in memory during the processing of the input sequence and can be used in various ways to support the generation of the output sequence. For example, they can be used as input to further layers of the model in combination with other intermediate computations, or they can be used to update the internal state of the model. Alternatively, intermediate computations (multiple) 112 can be sent to different computing devices for further processing, routed back to the client device, stored for future use, or used in various other ways depending on the requirements of a particular machine learning-prepared sequence processing model and a particular case study.

[0085] Furthermore, intermediate calculations 112 can be used to manage and optimize the processing of the model. For example, intermediate calculations 112 can be used to determine the batch size or expected output length of a processing task. Intermediate calculations 112 can be stored in a buffer (e.g., a circular buffer) for reuse throughout different steps of the generation procedure. Efficient management of intermediate calculations can reduce the number of calculations and save time and resources. The management of intermediate calculations 112 may include buffering strategies, efficient memory usage strategies, and computation reuse strategies, which can lead to efficient use of hardware resources and reduced computation overhead.

[0086] The generation system(s) 114 may be a component or subsystem of the model host platform 106, or may include one, that uses intermediate computations(s) 112 generated by the prefill system(s) 110 to generate output sequences. For example, the generation system(s) 114 may perform the task of autoregressively generating output elements for each output sequence based on intermediate computations(s) 112, which may include multiple initial attention tensors and other pre-computed information.

[0087] The generation system(s) 114 may include one or more generation servers, each of which may be implemented on a separate computing device or a cluster of devices. These devices may have specific hardware, such as a CPU, GPU, TPU, or other type of processor, necessary to effectively perform the generation task.

[0088] In some exemplary embodiments, the generation task may involve numerous forward passes through the model to sample a series of outputs. Thus, the generation task can utilize a large amount of memory bandwidth to load and offload model weights and intermediate computations from the device's computing cores.

[0089] The generation system(s) 114 can use a variety of different strategies to generate the output sequence. The generation system(s) 114 can use intermediate computation(s) 112, such as a KV cache in a transformer-based model, to generate output elements one at a time.

[0090] While some generation tasks may be serial (e.g., autoregressive generation with data dependencies on previous iterations), multiple generation tasks can be batched together for efficiency. The batch size chosen for a generation task can be optimized based on various factors. For example, a larger generation batch size can be selected to maximize throughput and computational efficiency on certain hardware configurations. However, when latency below a certain threshold is desired (e.g., for real-time interactive applications such as chatbots), generation tasks can be run in smaller generation batch sizes, or even in individual sessions, to meet these requirements.

[0091] The generation batch size(s) may differ from the prefill batch size. The generation batch size(s) may be larger than the prefill batch size.

[0092] The generation system(s) 114 can be configured to use different model architectures or configurations to generate output based on a prefilled context. For example, in text-based models, they may generate a sequence of text prompts, complete sentences, generate paragraphs, or create an entire document. Depending on the characteristics of a particular case study and input sequence, the generated output may vary significantly in length and complexity.

[0093] The generation system(s) 114 may be scalable to handle various workloads. For example, if a large number of generation tasks are predicted or observed, additional generation servers can be provisioned to handle the load, allowing the model hosting platform 106 to dynamically adapt to changes in demand.

[0094] Once an output sequence is generated, it can be returned to a client device(s) 102 via a routing system(s) 108 and is often packaged in an appropriate format as part of an output payload(s) 116. The payloads can be streamed one by one or delivered upon completion.

[0095] The output payload(s) 116 may be the result or output generated by the model host platform 106 in response to the input request(s) 104. The output payload(s) 116 may be data sent back to the client device 102 after the input request(s) 104 have been processed by the machine-trained model. The output payload(s) 116 may include an output sequence generated based on the input sequence or on any other type of data generated by the model during the processing of the input request(s) 104. Depending on the type of model used, an output sequence may be a text sequence, an image sequence, or a sequence of multiple or other types of data.

[0096] The output payload(s) 116 may vary in size and format depending on the specific characteristics of the processed request. For example, a text generation task may produce an output payload containing a sequence of words, while an image processing task may produce an output payload containing image data.

[0097] The output payload(s) 116 can be filtered before being sent to the client device(s) 102 based on various considerations. For example, output filters can be applied to determine whether the content generated by the model adheres to specific guidelines or criteria, such as content moderation rules, user-specific preferences, or legal regulations. Similarly, output filters can be applied to the generation system output to optimize the output for client device requirements or limitations, such as screen size, processing power, or bandwidth. For example, the generation system(s) 114 may generate text with complex details, but a summary filter can be applied to the content to return a degraded version to the output payload(s) 116. Intermediate buffering can be implemented to review the generated output before sending it as part of the output payload(s) 116.

[0098] The output payload(s) 116 can communicate with the client device 102 in various formats. For example, the output payload(s) 116 can be sent as a single block of data, divided into multiple chunks, or streamed in real time as it is generated by the model. Streaming can be useful for providing low-latency responses (e.g., low latency until the start of the output sequence), such as in interactive chatbots or real-time content generators. Multiple output payloads(s) 116 generated based on multiple input requests can communicate simultaneously or at intervals, depending on the processing and communication capabilities of the client device(s) 102, as well as the specific application or use case.

[0099] The output payload(s)116 may include additional information along with the generated output sequence, such as confidence scores, attention maps, or other types of metadata. This additional data may include metadata, status, or error messages regarding the processing of the input request, or other information. This additional information can provide further insights into the operation of the machine-trained model and facilitate a deeper understanding of the generated output.

[0100] Figure 2 is a block diagram showing additional details of an exemplary embodiment of the model host platform 106. The routing system 108 can process data from input requests 104 and pass input elements 202 to the prefill system 110. The prefill system 110 can implement a machine learning-based sequence processing model using prefill computing devices 204 that run model partitions 206. The prefill system 110 can process input elements 202 to generate intermediate computations 208. The routing system 108 can pass intermediate computations 208 directly to the generation system 114. The routing system 108 can shard / reshard intermediate computations 208 to obtain (re)sharded intermediate computations 210. The (re)sharded intermediate computation(s) 210 can be passed to the generating system(s) 114. The generating system(s) 114 can process the (re)sharded intermediate computation(s) 210 using machine learning-based sequence processing models running on generating computing devices(s) 212 within one or more model partitions(s) 214. The generating system(s) 114 can return output elements(s) 216.

[0101] The input elements (multiple) 202 can be individual data fragments within the input sequence that the machine learning-based sequence processing model processes. These input elements can vary widely depending on the nature of the model and the specific task for which it is designed to function.

[0102] For example, in the context of natural language processing models, input elements 202 may be, or represent, individual words, sentences, or paragraphs within a text document. Input elements 202 may also be smaller text units such as characters, morphemes, or n-grams. These input elements can be processed and analyzed by the model to understand the structure and meaning of the text.

[0103] In the case of an image processing model, the input element(s)202 can be tokens representing individual pixels or regions (e.g., patches) of an image. Each pixel can be represented as a combination of red, green, and blue (RGB) color values, or in another color space such as YUV or HSV. Regions of the image can be represented using various techniques, such as convolutional patches (e.g., patches of feature maps generated by one or more layers of a convolutional neural network), superpixels, or other segmentation methods.

[0104] In a speech recognition model, the input element(s)202 may be, or represent, individual phonemes, syllables, or words of the spoken language. These elements can be extracted from the audio data using various feature extraction techniques, such as Fourier transform, Mel frequency septal coefficients (MFCC), or deep neural network-based methods.

[0105] In a multimodal model that processes multiple types of data simultaneously, the input elements(s) can be combinations of different types of data elements. For example, in a model designed to generate image captions, the input elements could be a combination of text data (such as existing captions or metadata) and image data (such as pixels or image features).

[0106] In the context of time series analysis models, the input element(s)202 can be individual data points within a time series. These data points can represent various types of information, such as stock prices, weather conditions, or sensor readings recorded at a specific point in time.

[0107] For models designed to process genetic data, the input element(s)202 can be individual nucleotides, codons, or genes within a DNA or RNA sequence. These elements can be analyzed by the model to perform tasks such as gene prediction, variant identification, or phylogenetic analysis.

[0108] In some cases, the input element(s)202 may be represented using a variety of data types or formats, such as integers, floating-point numbers, strings, arrays, tensors, or other data structures. For example, the input element(s)202 may be an embedded representation of data, such as text tokens, image tokens, audio tokens, or other data embedding representations.

[0109] Input elements 202 can be derived from or otherwise obtained from input requests 104. For example, an input request may contain a text document, and the input elements may be individual words, sentences, or paragraphs within that document. In another example, if an input request contains an image, the input elements may be individual pixels or sections of the image. If an input request contains audio data, the input elements may be segments of an audio waveform or features extracted from an audio waveform. An input request 104 may contain multiple types of data, such as text and images, in which case the input elements 202 may contain elements from each type of data. Furthermore, these elements may undergo preprocessing steps such as tokenization, normalization, feature extraction, or encoding before being fed into the model.

[0110] The prefill computing device(s) 204 may be, or include, various hardware systems used to perform pre-filtering with machine learning-based sequence processing models. The prefill computing device(s) 204 may include specific hardware accelerators or other components designed to improve the performance of the pre-filtering. These may include, for example, high-bandwidth memory devices, high-speed read / write storage devices, or processors specialized for tasks such as matrix multiplication or convolution. The prefill computing device(s) 204 may include CPUs, GPUs, TPUs, ASICs, FPGAs, or combinations thereof.

[0111] A prefill computing device(s) 204 can be a standalone device, or it can be part of a larger system. For example, a prefill computing device(s) 204 can be installed on a server, workstation, laptop, mobile device, or other type of computer. Alternatively, they can be part of a distributed computing system, where tasks are distributed across multiple devices in a network.

[0112] Model partitions 206 can be different sections or subsets of a machine learning-based sequence processing model that are run and implemented independently on different computing devices. These partitions can be created based on various characteristics of the model, such as layer structure, data flow, computational requirements, or other factors. If the model is too large to fit into the memory of a single device, model partitions 206 can be created to distribute the model across multiple devices. This may involve splitting the model's parameters, its intermediate computations, or both. The splitting can be done in a way that reduces or minimizes the communication costs between devices, such as by ensuring that each device only needs to communicate with a small number of neighboring devices.

[0113] For example, in a deep neural network model, the model partition(s) 206 may correspond to individual layers, groups of layers, or sub-parts of a layer within the network. Each layer may be implemented and executed on a separate computing device, enabling parallel processing of different parts of the input data. Different parts of a layer can be implemented and executed on separate computing devices.

[0114] In a convolutional neural network (CNN), the model partition(s) 206 may contain various sets of model weights for convolutional layers, pooling layers, fully connected layers, or other components of the model. Each partition may be responsible for computation or part of computation in processing the input data, such as applying convolutional filters, pooling features, or performing final predictions.

[0115] In a transformer-based model, the model partition(s) 206 can be sets of model weights for individual transformer blocks or layers. Each transformer block may contain components such as an attention head, a feedforward network, a normalization layer, or other components of the model. Each partition may be responsible for a stage or part of a calculation in processing sequence data, such as attending different parts of the input sequence, transforming the attended features, or normalizing the output.

[0116] In another example, model partitions(s) 206 can be created based on the data flow within the model. For instance, in a pipelined parallel processing approach, different stages of the processing pipeline may be implemented on different devices. For example, one device might handle data preprocessing, another might perform the main processing tasks, and yet another might handle post-processing or output generation.

[0117] Furthermore, model partitions (multiple) can be defined along different axes of the model architecture. For example, a model can be partitioned along a batch axis, a sequence axis, a feature axis, or a combination thereof. This type of partitioning may enable the model to handle larger batches of data, longer sequences, or higher-dimensional features than is possible with a single device.

[0118] Furthermore, model partitions 206 may be created based on the computational requirements of different parts of the model. For example, if certain parts of the model require high computational power while others require less, those parts may be divided and allocated to different devices according to their computational needs. This can result in more efficient use of available hardware resources. In some cases, model partitions 206 may be dynamically adjusted based on the current workload or other factors.

[0119] Model partitions 206 can be implemented using data parallelism. An exemplary data parallelism approach may involve different partitions of a model processing different partitions of data (e.g., input data, intermediate activations, etc.) simultaneously. In the context of machine learning-based sequence processing models, data parallelism may involve dividing the input sequence into several smaller sequences and assigning each of the smaller sequences to a different model partition 206 (which may be duplicates). Each model partition can process the data assigned to it independently of the other model partitions. After all partitions have completed processing, the results can be aggregated to produce a final output. This approach may increase the model's throughput and allow it to handle larger input sequences. For example, if the model is a neural network, each partition may correspond to a copy of a given part of the network, and each partition may process a different subset of the input data.

[0120] Model partitions (multiple) 206 can be implemented using tensor parallelism. An exemplary tensor parallelism approach may involve distributing the model's computation across multiple devices. Instead of each device processing a different subset of the data along with a complete copy of the model, each device can process a portion of the computation of the entire dataset. This can be done by partitioning the tensors that the model uses in its computation and distributing these partitions across multiple devices. For example, if the model is a neural network, tensor parallelism may involve partitioning the network's weight tensor across multiple devices. Each device can then use its subset of weights to process a portion of the network's computation. After all devices have completed their computations, the results can be aggregated to produce a final output. This approach can be useful when the model is too large to fit on a single device, as it allows for the distribution of the model's computation across multiple devices.

[0121] To further enhance the scalability and efficiency of the model, both data parallelism and tensor parallelism can be used in a hybrid parallelism approach. In such a setup, the model's computation can be partitioned across multiple sets of devices using tensor parallelism, each of which may contain individual devices that process different subsets of data using data parallelism.

[0122] The prefill system(s) 110 can use one or more different partitioning techniques. The prefill system(s) 110 can use one or more partitions 206 across one or more prefill computing devices 204 for the feedforward portion of a machine learning-based sequence processing model.

[0123] For example, a 1D (one-dimensional) weight-stationary partitioning strategy can be applied. This partitioning strategy may involve partitioning each weight matrix of a feedforward network across multiple chips along one axis of the weight matrix (e.g., the network depth axis, the embedding depth axis). This partitioning method may allow each weight shard to be multiplied by the appropriate activation shard on each chip. The results can then be aggregated across the chips using an all-gather or reduce-scatter operation.

[0124] Other strategies (e.g., for a larger number of chips) could be a 2D (two-dimensional) fixed-weight partitioning strategy. This strategy may involve partitioning each weight matrix along both the network depth axis and the embedding depth axis, so that each shard can be approximately square. This method can reduce communication time between chips. Communication can be more efficient when multiplying the activation matrix with a set of continuous weight matrices by alternating between one of the two axes performing activation aggregation between each multiplication. Each chip may always have the activation shards necessary to multiply with its weight shards, without always having a perfectly replicated copy of the activation tensor.

[0125] When batch sizes are large, the activation size can exceed the weight size. In these cases, it may be more economical to keep the activation fixed to each chip and instead transmit the weights between chips. For distributed computing systems with devices distributed along three axes (X, Y, and Z), this approach may be called XYZ weight-gathered. For medium batch sizes, it may be useful to use a "hybrid" approach in which both weights and activations are partially transmitted along different axes. These approaches may be called X weight-gathered and XY weight-gathered. Weight-gathered layouts can reduce communication related to activations by using fully aggregated operations for weighting. Thus, this layout can reduce the total amount of communication by adjusting the relative sizes of the X, Y, and Z axes. This allows for a trade-off between weight communication and activation communication.

[0126] In some cases, a fixed-weight strategy can minimize communication when there are few tokens per batch, while a different weight-intensive layout may be optimal when there are many tokens per batch. When the batch size and prefill sequence length are sufficiently large, a weight-intensive layout may be less expensive or more efficient.

[0127] The prefill system(s) 110 may use one or more partitions 206 across one or more prefill computing devices 204 for the attention calculation unit of a machine learning-based sequence processing model. This attention calculation unit may include elements such as query (Q), key (K), and value (V) activations used in a multi-head attention process. These elements can be divided into a number of partitions equal to the number of chips (nchips) across the nheads dimension, when the number of attention heads (nheads) is a multiple of the number of chips (nchips).

[0128] For example, in a scenario where the number of chips (nchips) is greater than the number of attention heads (nheads), the attention heads can be partially replicated across the entire chip. This distribution allows each chip to have a portion of the Q, K, and V activations, potentially enabling parallel processing of attention calculations and efficient use of computing resources.

[0129] Each partition 206 can handle a subset of attention calculations, which can be processed independently by the associated pre-filter computing device(s) 204. This configuration allows pre-filtering to be distributed across multiple devices, improving system throughput and efficiency.

[0130] The partitioned layout can correspond to a two-dimensional fixed-weight feedforward layout, which provides an efficient configuration for distributing computations across multiple devices. In this fixed-weight layout, the model weights remain fixed on each device as the data moves, thereby reducing communication overhead between devices and improving computation speed and efficiency.

[0131] Intermediate calculation(s) 208 may be the same as or different from intermediate calculation(s) 112. Intermediate calculation(s) 208 may be the result generated by prefill system(s) 110 after processing input elements(s) 202. These calculations may represent an understanding of the model of the input data and can be used as a basis for further processing of the task, such as generating an output sequence.

[0132] The (re)sharded intermediate computation(s) 210 may contain intermediate computation(s) 208 in a format compatible with the generating system(s) 114. For example, the generating system(s) 114 may implement a machine learning-based sequence processing model partitioned differently from the partitions used by the prefill system(s) 110. Thus, in order to use the intermediate computation(s) 208, the model host platform 106 may shard or reshard the intermediate computation(s) 208 to obtain a (re)sharded intermediate computation(s) 210 that is consistent with the partition scheme used by the generating system(s) 114.

[0133] Generative computing devices 212 can be various hardware systems that can be used to perform generative tasks with machine learning-based sequence processing models. These computing devices may include specific hardware accelerators or other components designed to improve the performance of the generative tasks. These may include, for example, high-bandwidth memory devices, high-speed read / write storage devices, or processors specialized for tasks such as matrix multiplication or convolution. Generative computing devices 212 may include CPUs, GPUs, TPUs, ASICs, FPGAs, or combinations thereof.

[0134] A generating computing device(s) 212 can be a standalone device or part of a larger system. For example, a generating computing device(s) 212 can be installed in a server, workstation, laptop, mobile device, or other type of computer. Alternatively, they can be part of a distributed computing system, where tasks are distributed across multiple devices in a network.

[0135] The generation computing device(s) 212 may include a larger memory capacity or higher memory bandwidth (compared to, for example, the prefill computing device(s) 204) to accommodate the memory utilization of the generation task. For example, the generation task may involve multiple forward passes through the model to sample a series of outputs, which can utilize a large amount of memory bandwidth to load and offload model weights and intermediate computations from the device's computing cores.

[0136] The generation system(s) 114 can use one or more different partitioning techniques. The generation system(s) 114 can use one or more partitions 214 across one or more generation computing devices 212 for the feedforward portion of the machine learning sequence processing model.

[0137] For example, a 1D (one-dimensional) fixed-weight partitioning strategy can be applied. This partitioning strategy may involve partitioning each weight matrix of a feedforward network across multiple chips along one axis of the weight matrix (e.g., the network depth axis, the embedding depth axis). This partitioning method may allow each weight shard to be multiplied by the appropriate activation shard on each chip. The results can then be aggregated across the chips using a total aggregation operation or a variance reduction operation.

[0138] Other strategies (e.g., for a larger number of chips) could be a 2D (two-dimensional) fixed-weight partitioning strategy. This strategy may involve partitioning each weight matrix along both the network depth axis and the embedding depth axis, so that each shard can be approximately square. This method can reduce communication time between chips. Communication can be more efficient when multiplying the activation matrix with a set of continuous weight matrices by alternating between one of the two axes performing activation aggregation between each multiplication. Each chip may always have the activation shards necessary to multiply with its weight shards, without always having a perfectly replicated copy of the activation tensor.

[0139] When batch sizes are large, the activation size can exceed the weight size. In these cases, it may be more economical to keep the activation fixed to each chip and instead transmit the weights between chips. This approach may be called XYZ weight-aggregated. For medium batch sizes, it may be useful to use a "hybrid" approach in which both weights and activations are partially transmitted along different axes. These approaches may be called X weight-aggregated and XY weight-aggregated. Weight-aggregated layouts can reduce communication related to activations by using fully aggregated operations for weighting. Therefore, this layout can reduce the total amount of communication by adjusting the relative sizes of the X, Y, and Z axes. This allows for a trade-off between weight communication and activation communication.

[0140] In some cases, a fixed-weight strategy can minimize communication when there are few tokens per batch, while a different weight-intensive layout may be optimal when there are many tokens per batch. When the batch size and prefill sequence length are sufficiently large, a weight-intensive layout may be less expensive.

[0141] The generation system(s) 114 may use one or more partitions 214 across one or more prefill computing devices 212 for the attention calculation unit of the machine learning-based sequence processing model. This attention calculation unit may include elements such as query (Q), key (K), and value (V) activations used in the multi-head attention process. These elements can be divided into a number of partitions equal to the number of chips (nchips) across the dimension of nheads, when the number of attention heads (nheads) is a multiple of the number of chips (nchips).

[0142] For example, in a scenario where the number of chips (nchips) is greater than the number of attention heads (nheads), the attention heads can be partially replicated across the entire chip. This distribution allows each chip to have a portion of the Q, K, and V activations, potentially enabling parallel processing of attention calculations and efficient use of computing resources. Each partition 214 can handle a subset of attention calculations, which can be processed independently by the associated generating computing device(s) 212. This configuration allows for the distribution of pre-filtering across multiple devices, improving system throughput and efficiency.

[0143] The partitioned layout can correspond to a two-dimensional fixed-weight feedforward layout, which provides an efficient configuration for distributing computations across multiple devices. In this fixed-weight layout, the model weights remain fixed on each device as the data moves, thereby reducing communication overhead between devices and improving computation speed and efficiency.

[0144] Different model partitioning schemes can be used for the prefill system(s) 110 and the generation system(s) 114. For example, the prefill system(s) 110 can partition the computation of attention tensors(s) (e.g., KV values) across the head dimension. The generation system(s) 114 can partition the computation of attention tensors(s) across the batch dimension.

[0145] For example, in the context of a transformer model, the matrices Q, K, and V can be divided into nchips partitions in batch (B) dimension. This reduces the memory cost of loading the KV cache per chip to one-nchips, thereby potentially reducing memory time by the same factor.

[0146] To facilitate the use of different model partitioning schemes for prefill systems 110 and generation systems 114, the system may reshard the input activation tensors using all-to-all set communication. For example, during autoregressive generation, there may only be one token for each example of Q, K, and V tensors, but the KV cache may have many tokens. Since the KV cache can be orders of magnitude larger than the Q, K, and V tensors, it may be beneficial to spend all-to-all communication time on smaller tensors to save memory time on larger tensors.

[0147] Further examples of partitioning schemes and test results can be found in Pope et al., Efficiently Scaling Transformer Inference, arXiv:2211.05102v1[cs.LG]9 Nov 2022, which is incorporated herein by reference in its entirety. Various sharding and resharding techniques are described in Rink et al., Memory-Efficient Array Redistribution Through Portable Collective Communication, arXiv:2112.01075v2[cs.DC]28 Nov 2022, which is incorporated herein by reference in its entirety.

[0148] The output elements (multiple) 216 can be individual data fragments that make up the final output sequence generated by the machine learning-based sequence processing model. These elements can vary widely depending on the nature of the model and the specific task for which it is designed to function.

[0149] For example, in the context of a natural language processing model, the output element(s)216 could be, or represent, individual words, sentences, or paragraphs within the generated text document. These elements can be generated by the model when it processes and generates text based on the input sequence and patterns or data structures learned about the data.

[0150] In the image processing model, the output element(s) 216 may be tokens representing individual pixels or regions of the generated image. Each pixel may be represented as a combination of red, green, and blue (RGB) color values, or in another color space such as YUV or HSV. Regions of the image may be represented using various techniques such as convolutional patches, superpixels, or other segmentation methods.

[0151] In a speech synthesis model, the output element(s)216 may be, or represent, individual phonemes, syllables, or words of the generated speech. These elements can be extracted from audio data using various feature extraction techniques, such as Fourier transform, Mel frequency septal coefficients (MFCCs), or deep neural network-based methods.

[0152] In the context of a recommendation system, the output element(s) 216 may be, or represent, individual items recommended by the system. For example, these could be products, movies, songs, or any other type of item designed for the system to recommend.

[0153] The output elements(s)216 may also include additional information or metadata related to the generated output. For example, in a classification task, each output element may be accompanied by a confidence score indicating the model's certainty in the prediction. In a generation task, each output element may be accompanied by information about the generation process, such as specific model parameters or random seeds used to generate the output.

[0154] In some cases, the output element(s)216 can be represented using a variety of data types or formats, such as integers, floating-point numbers, strings, arrays, tensors, or other data structures.

[0155] Figure 3 is a block diagram of an exemplary configuration of a prefill system 110. The prefill system 110 may include multiple groups of computing devices. Group 302 may include M prefill computing devices 302-1, 302-2, ..., 302-M. Group 304 may include N prefill computing devices 304-1, 304-2, ..., 304-N. Group 306 may include O prefill computing devices 306-1, 306-2, ..., 306-O.

[0156] Each group can consist of the same or different partitioning scheme(s). Each group can consist of the same or different hardware devices(s). The prefill system(s) 110 or routing system(s) 108 can select an execution group to process a particular input sequence based on one or more attributes of the input sequence. For example, when selecting an execution group, the length of the input sequence, the complexity of the input sequence, the priority of the input sequence, the deadline associated with the input sequence, or other factors may be considered.

[0157] For example, the sequence length may be determined for an input sequence, and groups may be selected based on the sequence length. For instance, longer sequences may be routed to groups with larger buffer sizes, while shorter sequences may be routed to groups with smaller buffer sizes. This optimizes the use of computational resources and memory, resulting in improved efficiency and throughput.

[0158] In some scenarios, the selection of a group to process an input sequence can be dynamic and change over time. For example, if the sequence initially routed to a group begins to exceed the group's buffer size, the sequence can be dynamically routed to a different group with a larger buffer size. This can ensure that the processing of the sequence continues smoothly without exceeding the device's memory capacity.

[0159] Each group can implement a different partitioning scheme for a machine learning-based sequence processing model. For example, one group might implement a weight-stationary partitioning layout where the model's weights remain fixed on each device while the data moves. Another group might implement a weight-gathered partitioning layout where the data remains fixed, but the weights are aggregated from different devices. Yet another group might implement a hybrid partitioning layout that combines aspects of both weight-stationary and weight-gathered layouts. These different partitioning schemes can be chosen based on the specific requirements of the task each group is expected to address.

[0160] For example, different groups may have different levels of processing efficiency. For example, model flop utilization (MFU) may vary based on the partition layout. Some layouts can achieve high speed at a low efficiency. Different groups can be configured to have different speed / throughput and efficiency trade-offs. Based on priority or cost objectives associated with a given input request 104, the routing system(s) 108 or prefill system(s) 110 can assign a given request to be processed by a particular group.

[0161] The groups may have varying levels of hardware specifications. For example, group 302 may consist of devices with, for example, high-speed processors. Group 304 may include less powerful (e.g., more cost-effective) processors. Group 306 may be slower but highly efficient (e.g., energy-efficient) processors. Based on priority or target cost / speed associated with a given request 104, the routing system(s) 108 or prefill system(s) 110 may assign a given request to be processed by a particular group.

[0162] The prefill system(s) 110 or routing system(s) 108 can select an execution group based on the current workload or capacity of each group. For example, a group with fewer ongoing tasks or a group with more available resources may be selected to handle a new input sequence. This can help balance the load across different groups and maximize the overall throughput of the system.

[0163] The prefill system(s) 110 or routing system(s) 108 can select an execution group based on specific requirements of the input sequence. For example, if the input sequence contains text data, a group optimized for processing text data may be selected. If the input sequence contains image data, a group optimized for processing image data may be selected.

[0164] The prefill system(s) 110 or routing system(s) 108 can dynamically reconfigure groups based on current workloads or other factors. For example, if the workload increases, additional computing devices may be added to the group to increase its capacity. Conversely, if the workload decreases, some computing devices may be removed from the group to conserve resources. This dynamic reconfiguration allows the system to adapt to changes in workload and optimize the use of available resources.

[0165] Furthermore, the device topology can change depending on the group configuration. For example, devices within a group can be connected in specific ways to optimize data transmission between devices. This may include connecting devices in a ring, mesh, tree, or other topology (e.g., a toroidal grid), depending on the communication requirements of the task.

[0166] Figure 4 is a block diagram of an exemplary configuration of a generation system (or multiple generation system) 114. A generation system (or multiple generation system) 114 may include multiple groups of computing devices. Group 402 may include P generation computing devices 402-1, 402-2, ..., 402-P. Group 404 may include Q generation computing devices 404-1, 404-2, ..., 404-Q. Group 406 may include R generation computing devices 406-1, 406-2, ..., 406-R.

[0167] Each group can consist of the same or different partitioning scheme(s). Each group can consist of the same or different hardware devices(s). Each group can consist of the same or different generation batch sizes(s). The generation system(s) 114 or routing system(s) 108 can select an execution group to process a particular output sequence based on one or more expected or actual attributes of the output sequence. For example, when selecting an execution group, the length of the output sequence, the complexity of the output sequence, the priority of the output sequence, the deadline associated with the output sequence, or other factors may be considered.

[0168] The attributes of an output sequence can be either expected or actual. Expected attributes can be determined by predicting the most likely attributes associated with the output sequence based on the context associated with the output sequence (e.g., input sequence, corresponding input request, client device, etc.). For example, an output sequence for a yes / no question is expected to be short and may be processed on a case-by-case basis. An output sequence for a request for long-format content is expected to be long and may be processed on a case-by-case basis. An output sequence for input request 104, which includes an image request, is expected to include a multimodal data type, calls to an external API, etc., and may be processed on a case-by-case basis.

[0169] The predicted attributes described herein can be obtained by predicting attribute values ​​using a predictive model trained to predict attribute values ​​based on one or more features of the processing task and log usage data that records the final ground truth attribute values. Predicted attributes may be used implicitly by directly outputting predictions that control the task (e.g., directly outputting predictions that control the route of the input), thereby preventing explicit attributes from being regressed.

[0170] Actual attributes can be monitored and detected during the generation of the output sequence. The model host platform 106 can monitor the generation status of the output sequence, determine the current length, the current modality mix, etc., and respond accordingly to optimize the processing (e.g., shift to a different group).

[0171] For example, the sequence length may be determined for an output sequence, and groups may be selected based on the sequence length. For instance, longer sequences may be routed to groups with larger buffer sizes, while shorter sequences may be routed to groups with smaller buffer sizes. This optimizes the use of computational resources and memory, resulting in improved efficiency and throughput.

[0172] In some scenarios, the selection of a group to process an output sequence can be dynamic and change over time. For example, if the sequence initially routed to a group begins to exceed the group's buffer size, the sequence may be dynamically routed to a different group with a larger buffer size. This can ensure that the processing of the sequence continues smoothly without exceeding the device's memory capacity.

[0173] Each group can implement a different partitioning scheme for a machine learning-based sequence processing model. For example, one group might implement a weight-fixed partitioning layout where the model's weights remain fixed on each device while the data moves. Another group might implement a weight-aggregated partitioning layout where the data remains fixed, but the weights are aggregated from different devices. Yet another group might implement a hybrid partitioning layout that combines aspects of both weight-fixed and weight-aggregated layouts. These different partitioning schemes can be chosen based on the specific requirements of the task each group is expected to address.

[0174] For example, different groups may have different levels of processing efficiency. For example, model flop utilization (MFU) may vary based on the partition layout. Some layouts can achieve high speed at a low efficiency. Different groups can be configured to have different speed / throughput and efficiency trade-offs. Based on priority or cost objectives associated with a given input request 104, the routing system(s) 108 or generation system(s) 114 may assign a given request to be processed by a particular group.

[0175] The groups may have varying levels of hardware specifications. For example, group 402 may consist of devices having, for example, high-speed processors. Group 404 may include less powerful (e.g., more cost-effective) processing units. Group 406 may include slower but highly efficient (e.g., energy-efficient) processors. Based on priority or target cost / speed associated with a given request 104, the routing system(s) 108 or generation system(s) 114 may assign a given request to be processed by a particular group.

[0176] The generation system(s) 114 or routing system(s) 108 can select an execution group based on the current workload or capacity of each group. For example, a group with fewer ongoing tasks or a group with more available resources may be selected to process a new output sequence. This can help balance the load across different groups and maximize the overall throughput of the system.

[0177] The generation system(s) 114 or routing system(s) 108 can select an execution group based on specific requirements of the input sequence. For example, if the output sequence contains or is expected to contain text data, a group optimized for processing text data may be selected. If the input sequence contains or is expected to contain image data, a group optimized for processing image data may be selected.

[0178] The generation system(s) 114 or routing system(s) 108 can dynamically reconfigure groups based on the current workload or other factors. For example, if the workload increases, additional computing devices may be added to the group to increase its capacity. Conversely, if the workload decreases, some computing devices may be removed from the group to conserve resources. This dynamic reconfiguration allows the system to adapt to changes in workload and optimize the use of available resources.

[0179] Furthermore, the device topology can change depending on the group configuration. For example, devices within a group can be connected in specific ways to optimize data transmission between devices. This may include connecting devices in a ring, mesh, tree, or other topology, depending on the communication requirements of the task.

[0180] Figure 5 is a block diagram of an exemplary interleaved processing flow. The interleaved system(s) 500 can process multiple sessions in parallel. The interleaved system(s) 500 can process batches of prefill and batches of generation or decoding sequentially, for example, by using a common pool of computing devices(s) (e.g., hardware accelerators).

[0181] In Figure 5, please understand that the numbered "intervals" shown can represent a single forward path through the model.

[0182] In the example shown in Figure 5, the batch size for prefilling can be 1 session. For example, in interval 2, the prefilling for session 1 can be completed (e.g., in one forward pass). The batch size for generation can be 3 sessions. However, in intervals 3, 4, and 5 (e.g., 3 forward passes), only the prefilling for session 1 is completed, so only the generation for session 1 proceeds.

[0183] Next, the interleaved system(s) 500 can pause during interval 6 to prefill session 2. Thus, in the next set of decode intervals, the generation of sessions 1 and 2 may proceed in intervals 7 and 8. Next, the interleaved system(s) 500 can pause during interval 9 to prefill session 3. Thus, in the next set of decode intervals, the generation of sessions 1, 2, and 3 may proceed in interval 10. Once the sequence end token is processed in session 1, the prefill of session 4 may proceed during the next pause in decoding (e.g., interval 11). After the prefill of session 4, generation may proceed again with a full batch size of 3.

[0184] The interleaved system 500 can be used in addition to, or as an alternative to, a separate serving system.

[0185] An exemplary hardware configuration for an embodiment of interleaved system(s) 500 may include a pool of hardware accelerators that can be used for both prefilling and decoding.

[0186] Figure 6 is a block diagram of an exemplary model host platform 106 that can be used for interleaved processing. The model host platform 106 may include hardware accelerators 602. The model host platform 106 may be associated with multiple configurations 604-1, 604-2, ..., 604-N. The model host platform 106 can control one, more, or all of the hardware accelerators 602 to run a forward pass of a machine-learned model, and the model can be split differently based on a selected configuration from the multiple configurations 604-1, 604-2, ..., 604-N. Although this specification describes interleaved processing, it should be understood that the example described with respect to Figure 6 may include exemplary attributes of other embodiments described elsewhere in this specification.

[0187] Hardware accelerators 602 may correspond to prefill computing devices 204 or generating computing devices 212. Hardware accelerators 602 may include CPUs, GPUs, TPUs, ASICs, FPGAs, or combinations thereof. Hardware accelerators 602 can be interconnected in mesh, tree, or other topologies. Exemplary topologies include toruses such as 3D toroidal topologies.

[0188] The model host platform 106 may use hardware accelerators 602 with different configurations (e.g., different model partition layouts) based on the current task being performed using hardware accelerators 602.

[0189] Figure 7 is an exemplary communication timeline diagram showing a workflow cycle including hot swapping between different configurations for prefilling and decoding. Model host platform 106 receives input request(s) 104 and may use hardware accelerator(s) 602 to load a first configuration in operation 702. Using the first load configuration, hardware accelerator(s) 602 can perform a prefill operation in 704. Model host platform 106 may use hardware accelerator(s) 602 to load a second configuration in operation 706. Using the second load configuration, hardware accelerator(s) 602 can perform a decode operation in 708 and return the generated output(s) (e.g., final output, intermediate output(s)) to model host platform 106. Model host platform 106 may store the generated output in a buffer or generate an output payload containing all or part of the generated output.

[0190] In one example, hardware accelerator(s) 602 can be initialized using an initial weight partition. Loading a first or second configuration may involve using the initial weight partition (for example, loading all or part of the initial weight partition into processor core memory). Loading a first or second configuration may involve using different weight portions, such as aggregating the model weights across the entire array of hardware accelerators to populate local memory for each hardware accelerator.

[0191] In one example, the initial weight partition may correspond to a fixed-weight partition layout. Thus, the hardware accelerator(s) 602 can be used in a fixed-weight configuration without further reconfiguration. Alternatively, the initial weight partition can be selected to correspond to an initial state for aggregating weights across multiple hardware accelerators in at least partially activation-fixed or weight-aggregated configurations. This may enable hot-swapping between fixed-weight and weight-aggregated configurations by choosing whether to use the initial weight partition or aggregate weights from each of the initial weight partitions of other devices.

[0192] Figure 8 is a block diagram of an exemplary circular buffer 800. A cursor can identify a position in the buffer for writing the result of time step t. The cursor can then overwrite past time values ​​that have been offloaded from the buffer.

[0193] This specification provides different references to different exemplary model partitioning techniques and model weight layouts. Further detailed examples of model partitioning configurations are provided herein to illustrate exemplary embodiments of various partitioning configurations that are referenced throughout with respect to a variety of different systems and devices.

[0194] Exemplary notation is employed herein to aid in understanding various exemplary embodiments. Number of parameters n params Consider an exemplary machine learning-prepared sequence processing model M with (for example, learned weights). The parameters are the number of chips n. chips It can be divided over E or d. Model M is E or d model Model M may have an embedding dimension called F or d. ff It may have a feedforward network with an intermediate dimension called n. Model M has n output heads. heads Or it may have H.

[0195] Each example in a batch of B sequences is L of the input textinput tokens, and can generate L gen tokens of output text. Since all input tokens may be present at the start of inference, the model M can execute all B×L input tokens in a single forward pass for some tokens or up to all tokens in parallel. This step may be referred to as prefill. L gen consecutive loops of steps can be used to autoregressively generate output tokens. Each step may involve a single forward pass through the model, after which a new token can be sampled for each of the B examples in the batch. This loop may be referred to as generation or decoding.

[0196] Prefill can be executed in parallel at L input , but autoregressive decoding is executed sequentially at L gen , so the two phases may have different performance characteristics.

[0197] This framework can be used to examine several optimization trade-offs. For example, scaling up the model size can unlock new capabilities and application possibilities, but may bring trade-offs in terms of inference cost. Inference cost can be measured in terms of the metrics of latency, throughput, and model FLOPS utilization. Latency may be or include the total time for inference, and can be decomposed into the time to process the input tokens present at the start of inference and the time to autoregressively generate one or more output tokens. Decoding latency may also be measured per step and divided by the number of tokens in each sequence. Prefill or decode throughput may be or include the number of tokens processed or generated per second. Model FLOPS Utilization (MFU) is the ratio of the observed throughput to the theoretical maximum throughput when the benchmarked hardware setup is operating at peak FLOPS without memory or communication overhead.

[0198] This framework may introduce communication overhead when larger models do not fit on a single accelerator chip and need to be split across multiple accelerator chips to fit into memory.

[0199] The memory cost in this framework can be related to storing tensors, such as weight and attention value caches, in on-device high-bandwidth memory (HBM). In some examples, for large transformer-based models, weight and attention value tensors can account for the majority of the memory cost. Other tensors can also pass through HBM, but their memory footprint can generally be much smaller.

[0200] For a forward path through an exemplary model M, these tensors are transmitted from the HBM to the chip's computing core once per forward path of the model (prefill or decode step). This takes a certain amount of time, which can be called storage time. In some cases, with small batch sizes and sequence lengths, the time spent loading weights accounts for the majority of the time. In other cases, with larger batch sizes and sequence lengths, the time spent loading attention value tensors accounts for the majority of the time.

[0201] The computational cost in this framework can include matrix multiplication and accumulation operations. For example, a decoder-only model with N parameters may require 2N matrix multiplication FLOPs in the forward pass for each recognized token. This is because each matrix multiplication performs one multiplication and one addition for each input token-parameter value pair in the forward pass. If all chips are running at peak FLOPS, these matrix multiplications take a constant amount of time, which can be called computation time. In some cases, matrix multiplication in the attention mechanism of the model mechanism may add a much smaller number of FLOPs per token in a large model, and can often be eliminated. Although the computational cost of attention is relatively small, (unlike weights) the attention cache is unique for each sequence in a batch (it is generated based on the input(s)), and therefore can account for a significant portion of the memory capacity and bandwidth cost.

[0202] Both the memory-time weight-loaded portion and the non-attention computation time can be proportional to the model size and inversely proportional to the number of chips. However, in a given partitioned layout, the time required for inter-chip communication may not decrease very rapidly (or not at all) with respect to the number of chips used, and can become an increasingly significant bottleneck as the number of chips increases.

[0203] For example, latency reduction can be achieved by using more chips and partitioning the model in as many ways as possible. Latency reduction can often be achieved by reducing the batch size, but as the batch size decreases, the MFU generally worsens, resulting in a higher total cost per token (in chip-seconds or dollar terms).

[0204] As the attention context, and therefore the sequence length, increases, inference time can also increase. For example, for a model with over 500 billion elements and multi-head attention, the attention KV cache increases significantly. With a batch size of 512 and a context length of 2048, the KV cache totals 3TB, which is three times the size of the model's parameters. On-chip memory may need to load this KV cache from off-chip memory once for each token generated, during which time the chip's computing cores are essentially idle.

[0205] When latency is a low priority and the primary goal is to maximize throughput per chip (e.g., minimize total cost per token), increasing the batch size can be efficient. Larger batches may consequently yield better MFUs, and certain partitioning strategies that are inefficient at smaller batch sizes may become more efficient as the batch size increases.

[0206] An exemplary partition layout is described herein with respect to an X×Y×Z 3D torus topology. Subscripts are used to specify the partitioned tensor dimensions. For example, BLE xyz The notation indicates that the last dimension E of a tensor of logical shape [B,L,E] is divided into X×Y×Z partitions, where x, y, and z refer to the physical axes on which the hardware accelerators are interconnected. A tensor per chip can be of shape [B,L,E / (XYZ)]. If a tensor is duplicated on axis x, that axis is omitted from the notation. The suffix "partialsum-" indicates that a given tensor is locally contracted (summed) on each chip (across some axes not represented by the shape), but further, if the result is semantic, it needs to be summed across the entire chip on the indicated axis (creating a tensor duplicated on the indicated axis).

[0207] Several communication sets are used. All-reduce(x) is performed across the set of chips on the x-axis of the torus using BLE. yz The partial sum tensor (partialsum-x) is summed, the sum is broadcast to all participating chips, and the output of shape $BLE_{yz}$ is returned. Total reduction can be divided into two phases: a reduction phase and a broadcast phase. The reduction phase is called reduce-scatter(x) and is performed across the set of chips in the x-axis BLE yz (partialsum-x) is the sum of the tensors, but B x LE yz or BLE xyz Within layouts such as these, it generates sharded output rather than replicated across chips within that axis. The broadcast phase is called total aggregation (x), and is tensor BLE. xyz Broadcast and concatenate to all chips along the x-axis, and replicate across the x-axis, the output is X times larger than its input, i.e., BLE yz This generates all-to-all-set communication, by using direct communication between all (source, destination) pairs, from one tensor dimension to another, for example, BLH. x Q to B x Shift sharding to LHQ.

[0208] Figure 9 shows collective communication.

[0209] Figure 10 shows one exemplary fixed-weight partition layout for the feedforward layer of a machine learning model. Each [E, F] weight matrix has n along the E or F axis. chipsThe matrix is ​​divided (or sharded) between the two axes. Each weight shard is multiplied by the appropriate activation shard on each chip, and the result is aggregated across the chips with full aggregation and / or variance reduction. Furthermore, when computing two consecutive matrix multiplications (as in a Transformer MLP block), the first matrix multiplication may be divided by the output axis, and the resulting activation shards on each chip may be themselves, which are needed to compute the second matrix multiplication divided by the input axis.

[0210] As shown in Figure 10, the weights and activations of the feedforward layer are n along the F-axis. chips It is divided over EF. In the exemplary 3D torus topology, the partition layout for weights is EF xyz and F xyz E is the case where the partitions X, Y, and Z span the entire physical hardware accelerator communication axis, and XYZ=n chips The system is divided into partitions. The weights remain fixed on each chip, and activation is transmitted between chips to match the weight layout, including one total aggregation and one variance reduction. In this 1D fixed-weight partitioning strategy, each chip obtains inputs and outputs for shapeBLE with variance reduction and total aggregation, respectively. The resulting communication time can be expressed as follows:

number

[0211] Other strategies involve partitioning each [E,F] weight matrix along both the E and F axes so that each shard is approximately square. For example, E=1024, F=4096, and n chipsIf = 64, sharding is performed with 4 divisions across E and 16 divisions across F. As a result, each of the 64 chips stores 256 × 256 chunks of the weight matrix, and activations are transmitted between chips. This can be called a 2D fixed-weight configuration. The total computational cost may be the same as a 1D fixed-weight configuration, but communication can be more efficient. When multiplying the activation matrix by a successive set of weight matrices, between each multiplication, it is possible to alternate between one of the two axes performing the activation aggregation. The choice of partitioning ensures that each chip always has the activation shards necessary to multiply with its weight shards, without always having a completely duplicated copy of the activation tensor.

[0212] Each axis is O((n chips ) 0.5 Because it is divided into ), the communication time is not constant, O((n chips ) -0.5 It scales as follows. In some embodiments, even if the 2D layout is limited to a certain number of chips and batch size, communication time continues to decrease, so latency can continue to be reduced by adding more chips. In some embodiments, the 2D fixed-weight configuration is more efficient than the 1D fixed-weight configuration when the following condition is met.

number

[0213] Figure 11 shows an exemplary 2D fixed-weight partitioning layout. While the exemplary 1D fixed-weight layout in Figure 10 performs its total aggregation and variance reduction in a non-sharding BLE configuration per chip, this 2D fixed-weight layout partitions E such that the amount of traffic for F partitioning is reduced from BLE to BLE / X. This incurs the cost of introducing a second pair of variance reduction and total aggregation operations, but this cost can be balanced with existing communications.

[0214] The weight partitioning layout in Figure 11 is E x F yz This is because they are divided into X partitions along the E dimension and YZ partitions along the F dimension. The partition layout of the input activation is the same as in the 1D example.

[0215] In one example, the optimization framework provided herein can provide optimal values ​​for X, Y, and Z to minimize the total communication time. Assuming F=4E, an exemplary embodiment is:

number

number

[0216] In the exemplary fixed-weight strategy described above, each chip stores one shard of each weight matrix in memory and is responsible for multiplying that fixed-weight shard by each corresponding activation shard. The outputs of the matrix multiplications from each chip are then aggregated across the chips to be used as input for subsequent operations.

[0217] However, as batch size (and sequence length) increases, the size of the output activation can become significantly larger than the size of the weights. When this occurs, it may be more economical to keep the activation fixed at each chip and instead transmit the weights between chips. For very large batch sizes, it may be beneficial to keep the activation completely fixed between consecutive matrix multiplications and transmit the weights completely between all chips.

[0218] When at least some of the weights are moved between chips, it can be called a "weight-aggregated" layout. Weight aggregation can be 1D, 2D, 3D, etc., based on the axis along which the weights are aggregated. For example, aggregating weights across all axes (e.g., taking a complete copy of the weights from a partition across all axes) can be called an XYZ weight-aggregated layout with respect to three axes, XYZ. A hybrid approach may involve aggregating weights across two axes on each chip to generate duplicate weights for partitions across those two axes (the weights may be further distributed across other axes). For example, aggregating weights from an initial distribution across the X and Y axes can be called an XY weight-aggregated layout. Aggregating weights from an initial distribution across the X axis can be called an X weight-aggregated layout.

[0219] Figure 12 shows an exemplary XY weight-aggregated layout. The specific layout shown here is the same as the 2D weight-fixed layout. x F yz The approach starts with a layout, which allows the same initial weight layout to be used for both weight-aggregated (e.g., during prefilling) and weight-fixed (e.g., during decoding). Immediately before einsum, the weight tensor is aggregated across the X and Y axes using traffic EF / Z. This is additional traffic compared to the weight-fixed layout, but in return reduces traffic during activation. One variance reduction / total aggregation pair is skipped for activation, and the traffic for the other pairs is reduced from BLE / X to BLE / XY.

[0220] By changing the relative sizes of the X, Y, and Z axes, weighted communication can be traded off with activation communication, thereby minimizing the total amount of data transmitted.

[0221] In some examples, the initial weight layout can be chosen to share weights between a fixed-weight layout and a weight-aggregated layout. This allows for selection from variations of the weight-aggregated layout. The variation shown in Figure 12 uses fully aggregated (xy) weights and uses batch B for activation. xy LE z Use splitting.

[0222] Figure 13 shows the use of total aggregation (x) for weighting and B for activation partitioning. x LE yz This shows an X-weighted layout using [a specific method / framework].

[0223] Figure 14 shows that the weights use total aggregation (xyz), and correspondingly, B is used for activation. xyz This shows an XYZ weight-aggregated layout using LE partitioning.

[0224] Figure 15 shows how the optimal communication configuration switches between these layouts as the batch size increases for several exemplary embodiments. Communication volume was estimated at X=Y=Z=4, E=16384, and F=65536. The 2D fixed-weight strategy minimizes communication when there are few tokens per batch, but different weight-intensive layouts are optimal when there are many tokens per batch.

number

[0225] The communication time for a fixed-weight layout can be linear with respect to the block line (BL), while the communication time for a weight-aggregated layout can be linear with respect to square root (BL). Therefore, when the batch size and prefill sequence length are sufficiently large, a weight-aggregated layout can be more efficient or less expensive.

[0226] While the explanation concerns feedforward network layers, the exemplary layout described above can be used for various model components. The attention mechanism can be parallelized using similar techniques.

[0227] For example, multi-head attention uses F to n heads It can be similarly parallelized by replacing it with [another method]. However, inference using multi-head attention can involve considerable memory and bandwidth costs for storing and loading the KV cache, and these costs can account for a large portion of the remaining inference in large batches or long context lengths.

[0228] An alternative approach called multiquerie tensor is generally used for the query tensor n heads It outputs the following, but outputs only a single head for the key-value tensor. This key-value head is n heads It is shared across query heads. This reduces the size of the KV cache tensors, and consequently, the memory time spent loading them. heads It is reduced to one-tenth. However, it also removes the axis that would otherwise be used for parallel processing.

[0229] Figure 16 shows an illustrative comparison of multi-head and multi-query tensor shapes.

[0230] n heads Dimension (W in multiquerie tension) Q and W O In multi-head attention, in addition to those two, W K and W V The partitioned layout of the projection matrix having ) may match the layout used in the feedforward layer.

[0231] Figure 17(A) shows an exemplary split layout for multi-head attention, corresponding to a 2D weighted feedforward layout. Here, the activation of Q, K, and V is nheads ga n chips When n is a multiple of n, heads Across dimensions, n chips It is divided into n partitions. chips ga n heads If the value is greater than the specified value, the attention head is partially duplicated. The most similar partitioned layout for multi-queer attention (shown in Figure 17(B)) handles the KV cache similarly to multi-head attention. Even though the key and value tensors are shared across all heads, they are duplicated on each chip, and the memory cost savings of multi-queer attention are lost.

[0232] Advantageously, by partitioning the multi-querie tension mechanism (e.g., Q, K, V tensors) across batch dimension B, as shown in Figure 17(C), the memory cost of loading a KV cache per chip is reduced to n chips It can be reduced to one-tenth. This reduces memory time by the same factor.

[0233] Figure 18 provides an exemplary layout of an approach that shards across the head.

[0234] Figure 19 provides an illustrative layout of an approach that is sharded across batches.

[0235] Sharding through batches can incur additional communication costs to re-shard the input activation tensor using all-to-all communication, compared to multi-querier tension sharding strategies where the Q, K, and V matrices are partitioned across the head dimension. During autoregressive generation, there is generally only one token per example of the Q, K, and V tensors (e.g., per instance in a batch), but the KV cache has many tokens (e.g., 2048 or more). Since the KV cache can be orders of magnitude larger than the Q, K, and V tensors, it can be beneficial to spend all-to-all communication time on smaller tensors to save memory time on larger tensors.

[0236] In some cases, the impact of sharding attention across batches, such as during prefilling, may be minimal. A Q tensor can have many tokens, all of which may be queried against the same K and V tensors. Since the memory load of the K and V tensors can be amortized across all tokens of the Q tensor, this memory load may not become a bottleneck during prefilling. In such cases, a layout that is sharded across heads may be used to avoid additional communication costs.

[0237] The proposed partitioned layout, with its multi-querieor tension, allows for the use of larger batch sizes and sequence lengths, which can improve throughput in addition to reducing latency through reduced memory time. The measured savings can be an order of magnitude larger compared to multi-head attention.

[0238] A parallel transformer block can be used. In an exemplary parallel transformer block, the feedforward layer and attention layer can be summed so that they are computed in parallel from the layer-normalized input and obtain the output. The advantages of the exemplary parallel representation are as follows: First, there may be only one layer normalization per layer instead of two layers, which reduces latency at small batch sizes. Second, the input matrix of the feedforward layer is the query projection matrix W of the attention layer. Q It can be merged with the key / value projection matrix W K and W V These can be merged in the attention layer, and the output matrix of the feedforward layer is the output projection matrix W of the attention layer. O This can be merged with F / n. This fusion may help facilitate the use of higher FLOPS because larger matrix multiplications are performed more efficiently by the accelerator. heads By eliminating one of the two total reduction operations at each transformer layer required for parallel processing, communication time along this axis can be halved.

[0239] Looped Collective Einsum technique is used to perform communication in parallel with computation. This makes it possible to partially or completely hide most of the communication time for distributed reduction and fully aggregated operations. For distributed reduction operations, it is possible to choose whether to reduce the distributed reduction to the batch dimension, the sequence dimension (B or L), or the hidden dimension (E or F). In the case study that follows, the latter was chosen.

[0240] In the case study that follows, the CollectiveEinsum loop accounts for the overwhelming majority of inference latency, so considerable effort was invested to maximize its performance. First, CollectiveEinsum was optimized for different scenarios (latency vs. throughput, different numbers of torus axes, fusion with different input / output aggregates). Second, to maximize the potential for overlap, the matrix multiplications and communication sets that should be fused are explicitly matched. Such optimizations improved performance by approximately 1.4 times compared to a simpler implementation that was partitioned and scheduled by the original compiler as initially developed. Some of the weight-aggregated layouts would run out of memory without these optimizations.

[0241] The following low-level optimizations were also included: improving the in-memory layout of tensors to minimize padding and copying during matrix multiplication, faster top-k / top-p implementations for decode sampling, accelerating the binary logarithm implementations of Softmax and Swish, and supporting incremental processing of sequences during prefill.

[0242] The AQT library is used to reduce the memory cost of 16-bit weights by converting the 16-bit weights to int8 without significant quality degradation. This makes it possible to save memory time from weight loading, which is particularly useful in the low batch size regime and reduces the amount of communication in the weight-aggregated layout. Activation quantization can reduce computation time in large batch configurations and reduce the communication volume of activations in the weight-stationary layout, but it was not used in the case study that follows.

[0243] A case study was conducted to evaluate the efficiency of various embodiments of the techniques described herein. The content that follows is an empirical study of the techniques on models of the PaLM family, which was selected because the model architecture incorporates the techniques of multi-query attention layers, parallel attention layers, and feed-forward layers.

[0244] The inference framework for the case study is based on JAX and XLA, and the original high-level embodiment of the case study is based on T5X. The case study uses up to 256 TPU v4 chips for benchmarking. Each TPU v4 chip is capable of performing bfloat16 matrix operations at 275 TFLOPS, has 32 GiB of high-bandwidth memory (HBM) with a bandwidth of 1200 GB / s, and has an interconnect bandwidth of 270 GB / s in a 3D torus topology. For the PaLM 540B model, the number of attention heads was padded from 48 to 64 to more effectively partition more than 64 chips. This added 18B of parameters to the model, incurring a cost of 3% MFU, which was well recovered by enabling more effective partitioning.

[0245] The case study evaluates the relative performance of the feedforward lamination strategy in the present invention. First, the decoding performance is evaluated. A batch size of 512 is used to balance latency and MFU.

[0246] Figure 20 shows the performance of 1D and 2D fixed-weight layouts as the number of chips increases. While communication begins to be limited in both layouts, the 2D layout performs better because scaling with respect to the number of chips is asymptotically better.

[0247] Next, we consider the prefill phase. We will consider batch sizes ranging from 2048 tokens (1 case, 2048 tokens) to 1 million tokens (512 cases, 2048 tokens per case).

[0248] Figure 21 shows that the optimal partition layout for this case study switches from a 2D fixed-weight layout to a weight-aggregated layout as the batch size increases. The weighted layout is less efficient at low batch sizes but ultimately becomes most efficient at high batch sizes, achieving 76% MFU when communication overhead is almost negligible. Such large batch sizes would fail due to memory exhaustion without multi-query tension on this hardware.

[0249] Next, an exemplary strategy for dynamically selecting a partition layout is as follows: During the prefilling phase, the system can choose between a weight-fixed layout and a weight-aggregated layout based on the current number of tokens in the batch. During the generation phase, because the batch size of tokens is small, the system can choose a 2D weight-fixed layout.

[0250] Furthermore, the case study evaluated partitioned layouts for multi-query attention. We examined PaLM with multi-query attention in both a baseline layout partitioned by attention heads and an optimized layout partitioned per batch. We also created a modified variation of PaLM540B that uses multi-head attention instead of multi-query. To keep the parameter count of the attention layer constant, we reduced the head dimension from 256 in the multi-query variation to 128 in the multi-head variation.

[0251] Large batch sizes and context lengths can result in very large KV caches, posing a risk of memory exhaustion. Table 1 shows that optimized multi-query layouts can accommodate context lengths up to 32–64 times greater than those of multi-head and baseline multi-query variations, fitting within a fixed memory size. [Table 1]

[0252] During prefilling, multi-query and multi-head attention can generate similar inference latency. This is because many attention queries are computed in parallel, and the attention computation is computationally constrained to attention matrix multiplication.

[0253] Figure 22 shows that the optimized multi-query layout improved speed during generation in the case study. As the context length decreases, the speed improvement is minimal because almost all time is spent in the feedforward layer. As the context length increases, the time spent loading the KV cache into the attention layer becomes a much larger part of the overall inference time. For example, when the multi-query attention scales up to sequence lengths of 8192–32,768 tokens (batch sizes of 512 and 128, respectively), the attention layer may only account for 8–31% of the total runtime.

[0254] In this case study, we examined a variation of PaLM 540B in which the parallel representation of the transformer blocks is replaced with a serial attention / feedforward layer. During generation, a 2D fixed-weight layout, 64 chips, and a batch size of 512 are used. In the serial configuration, the inference latency per step is 14% higher than the parallel version due to the longer communication time for activation. In the prefill phase, this difference is reduced because the weight-intensive layout reduces activation communication.

[0255] In the case study, the Pareto frontier between efficiency and latency was evaluated when scaling the model size of the PaLM family models (8B, 62B, and 540B) using either bfloat16 or int8 weights. The validation was performed using a context length of 2048, varying the batch size and number of chips.

[0256] To meaningfully compare throughput across multiple model sizes with different chip counts and batch sizes, we report the inference cost in terms of chip-seconds per token, calculated as shown in the formula below.

number

[0257] This can be directly proportional to operating costs and inversely proportional to MFU.

[0258] Figure 23 shows the relationship between model size, latency, and cost in the generation phase at the Pareto frontier of optimal batch size, number of chips, and partitioning strategy. The lowest cost is achieved with a batch size greater than approximately 512, and the cost is proportional to the number of parameters. Reducing the batch size improves latency but increases the cost per token. The minimum latency for generation is one-third of the batch 512 latency. In Figure 23, it is observed that int8 weight quantization achieves the minimum latency. For example, with a batch size of 64 in PaLM540B, 28.5 ms / token is achieved with int8 weights, while 36.9 ms / token is achieved with bfloat16 weights. For low latency targets, the cost is only slightly more than doubled because weight loading time accounts for the majority of the cost for low batch sizes. When the batch size is large, computation time accounts for the majority of the batch cost, and matrix multiplication still uses bfloat16 arithmetic, so the cost is roughly equivalent between int8 and bfloat16. Quantizing the activation to int8 could potentially enable further cost improvements.

[0259] Figure 24 shows the relationship among model size, latency, and cost in the prefill phase. The trade-off between batch size and latency is less severe in the prefill phase than in the generation phase, and even batch size 1 can be executed at a considerably low cost. Furthermore, the cost of prefill for batch 512 is half that of generation for batch 512, because the MFU of the weight-aggregated layout used during prefill increases. More detailed information on the relationship between model size and MFU is shown in Figures 25 and 26. [Table 2] [Table 3]

[0260] Tables 2 and 2 show several configurations from the Pareto frontiers of Figures 23 and 24 for PaLM 540B and PaLM 62B. In the low-latency scenario, prefill of batch 1 is combined with decoding of batches 32 to 64. Batch size 1 achieves the best latency in the prefill phase, but for the generation phase, the batch size can be increased up to 64 while the impact on latency remains negligible, and by doing so, the MFU for generation is dramatically improved. This mixing of batch sizes is practically feasible either by generating multiple samples from the same input text, or by pipelining a batch-1 prefill server to a batch-64 decode server.

[0261] In the high-throughput scenarios of Tables 2 and 3, a larger batch size is used to switch the split layout between prefill and decoding. Bfloat16 weights are used in the high-throughput scenarios, because the weighting time is not critical at large batch sizes, and because the software of the present invention lacks several optimizations for the large-scale int8 mode.

[0262] Comparing the 62B (Table 3) and 540B models (Table 2), the 540B model uses more chips, but exhibits similar batch sizes and the same partitioned layout. High-throughput MFU performance is similar across model sizes. Low-batch-size latency increases almost linearly with model size at the Pareto frontier in this case study. Larger models load proportionally more weights from memory, but they can be partitioned across more chips before communication becomes limited. Based on Figure 23, we estimate the approximate square root relationship between model size and latency.

[0263] Figure 27 records a comparison of the case study's performance measurements with those of the FasterTransformer benchmark across a wide range of batch sizes and prefill and generation configurations. There are several differences between the benchmark setup and the FasterTransformer benchmark, particularly the use of different chip types and chip counts. FasterTransformer uses 16-32 NVIDIA A100s with 80 GiB HBMs, while FasterTransformer uses 64 Google TPU v4 chips with 32 GiB HBMs. Therefore, throughput figures are reported with respect to MFUs, normalizing both chip count and chip FLOPS.

[0264] We benchmarked the Megatron530B model and the similarly sized PaLM540B model, which resulted in architectural optimizations including multi-querieor tension and parallel attention / feedforward layers. [Table 4]

[0265] This section reports the latency and MFU of both the PaLM 540B model and the MegatronTuring NLG 530B model running on 64 TPU v4 chips, compared to the FasterTransformer baseline. First, the differences in the above model architectures are described. Next, a complete set of comparisons of the three configurations within the FasterTransformer benchmark is reported, namely, 20 input tokens and 8 output tokens, 60 input tokens and 20 output tokens, and 128 input tokens and 8 output tokens. For each table, the Pareto frontier of latency and MFU is reported using bold font (overall frontier of all 500B class results) and underline (in particular the overall frontier of MT-NLG). This frontier is defined globally across the entire table, rather than being a row-by-row comparison. It is defined as follows: In other words, for all other benchmark results (latency, MFU2), if either latency ≤ latency 2 or MFU ≥ MFU2 (or both) is true, then the benchmark result (latency, MFU) is on the Pareto frontier. [Table 5] [Table 6] [Table 7]

[0266] The PaLM540B case study embodiment achieves the best absolute latency in comparison, and also provides the best MFU for the Megatron model for all but one latency target. FasterTransformer reports results for 8-, 16-, and 32-fold tensor parallel processing. The 32-fold tensor parallel processing achieves up to 33% MFU across all reported benchmarks compared to 46% MFU in the 16-fold tensor parallel configuration. This likely indicates a communication bottleneck in scaling tensor parallel processing beyond this point. In contrast, embodiments of the present invention can scale up to 64-fold tensor parallel processing while achieving a further 44% MFU. It should also be noted that the benchmarks across the case study include more challenging inference scenarios, such as context lengths ranging from 1024 to 4096, and report the inference latency for the generation and prefill phases separately (as they have different characteristics).

[0267] Figure 28 shows the cost-to-latency Pareto frontier for a case study where the sequence length was varied from 32 to 1024 at a batch size of 1.

[0268] Figure 29 shows a flowchart of method 2900 for improving the parallelization of an autoregressive machine learning-based sequence processing model according to an aspect of the present disclosure.

[0269] One or more parts of Exemplary Method 2900 can be implemented by a computing system including one or more computing devices, such as a computing system described with reference to other figures. Each part of Exemplary Method 2900 can be implemented by any (or any combination) of one or more computing devices. Furthermore, one or more parts of Exemplary Method 2900 can be implemented on the hardware components of the devices described herein, for example, to train one or more systems or models. Figure 29 shows elements performed in a specific order for illustrative and explanatory purposes. Those skilled in the art will understand, by using the disclosure provided herein, that any element of the methods described herein can be adapted, rearranged, extended, omitted, combined, or modified in various ways without departing from the scope of this disclosure. Figure 29 is described for illustrative purposes with reference to elements / terms described in relation to other systems and figures, and is not intended to limit it. One or more parts of Exemplary Method 2900 can be implemented by other systems, additionally or alternatively.

[0270] In 2902, exemplary method 2900 may include receiving an input request that processes multiple input sequences using a machine learning-based sequence processing model to generate multiple output sequences corresponding to each of the multiple input sequences.

[0271] In 2904, exemplary method 2900 may include generating a plurality of initial attention tensors for a plurality of input sequences. In exemplary method 2900, one or more respective initial attention tensors can be generated for each input sequence in parallel across the input elements of each input sequence. In exemplary method 2900, one or more respective initial attention tensors can be generated in one or more batches having a first batch size using a prefill system, the prefill system comprising one or more prefill computing devices and running one or more layers of a machine learning-based sequence processing model.

[0272] In 2906, exemplary method 2900 may include using a plurality of initial attention tensors to autoregressively generate a plurality of output elements for each of a plurality of output sequences in one or more batches having a second batch size. In exemplary method 2900, the plurality of output elements can be generated using a generation system comprising one or more generation computing devices. In exemplary method 2900, at least a portion of the machine learning-based sequence processing model can be partitioned across one or more generation computing devices along the batch dimension.

[0273] An exemplary method 2900 may include orchestrating inputs to a prefill system and outputs from a generation system using a router system configured to receive input requests.

[0274] In exemplary method 2900, at least one prefill computing device may differ from at least one generative computing device.

[0275] In the exemplary method 2900, the prefill system can be configured for workflows with computational bottlenecks.

[0276] In exemplary method 2900, the prefill system can be configured with lower memory bandwidth compared to the generation system.

[0277] In exemplary method 2900, the generation system can be configured for workflows with memory bandwidth bottlenecks.

[0278] In exemplary method 2900, the generation system may include a faster high-bandwidth memory (HBM) compared to the prefill system.

[0279] In exemplary method 2900, the generation system may include a larger static random access memory compared to the prefill system.

[0280] In exemplary method 2900, the generating computing device may have higher memory bandwidth than the prefill computing device.

[0281] In the exemplary method 2900, the generation system can implement more processing cores than the prefill system.

[0282] In the exemplary method 2900, the generative computing device can be optimized to suit the training workflow.

[0283] In the exemplary method 2900, the second batch size may be larger than the first batch size.

[0284] In the exemplary method 2900, the first batch size may be 1.

[0285] In the exemplary method 2900, one or more initial attention tensors can describe the relationships between each of the multiple input elements.

[0286] In exemplary method 2900, autoregressively generating multiple output elements may include using a generation system to process an initial attention tensor to determine a likely next output element. In exemplary method 2900, autoregressively generating multiple output elements may include selecting a likely next output element to include in the output sequence. In exemplary method 2900, autoregressively generating multiple output elements may include updating the initial attention tensor based on the selected output element.

[0287] An exemplary method 2900 may include routing an input sequence to a first group of prefill computing devices that implement a machine learning sequence processing model, based on the length of the input sequence, wherein at least a portion of the machine learning sequence processing model is partitioned according to a weight-intensive partition layout.

[0288] An exemplary method 2900 may include routing an input sequence to a second group of prefill computing devices that implement a machine learning sequence processing model, based on the length of the input sequence, wherein at least a portion of the machine learning sequence processing model is partitioned according to a fixed-weight partition layout.

[0289] An exemplary method 2900 may include routing an input sequence to a second group of prefill computing devices that implement a machine learning sequence processing model, based on the length of the input sequence, wherein at least a portion of the machine learning sequence processing model is partitioned according to a hybrid partition layout in which weights are fixed along at least one parallelization axis and transmitted along at least one other parallelization axis.

[0290] An exemplary method 2900 may include routing an input sequence to a second group of prefill computing devices implementing a machine learning sequence processing model if its length exceeds a threshold, wherein at least a portion of the machine learning sequence processing model is partitioned according to a hybrid partition layout with a first number of axes through which weights are transmitted.

[0291] Exemplary method 2900 may include routing an input sequence to a second group of prefill computing devices implementing a machine learning sequence processing model if its length is below a threshold, wherein at least a portion of the machine learning sequence processing model is partitioned according to a hybrid partition layout with a second number of axes through which weights are transmitted. In exemplary method 2900, the first number may be greater than the second number.

[0292] An exemplary method 2900 may include selecting a first group of generative computing devices to generate one or more output sequences based on the expected length of one or more output sequences, the first group of generative computing devices implementing a machine learning sequence processing model, and at least a portion of the machine learning sequence processing model being partitioned according to a weight-intensive partition layout.

[0293] An exemplary method 2900 may include selecting a second group of generative computing devices to generate one or more output sequences based on the expected lengths of one or more output sequences, the second group of generative computing devices implementing a machine learning sequence processing model, and at least a portion of the machine learning sequence processing model being partitioned according to a fixed-weight partition layout.

[0294] An exemplary method 2900 may include selecting a group of generative computing devices to generate one or more output sequences based on the expected length of one or more output sequences, the group of generative computing devices implementing a machine learning sequence processing model, at least a portion of the machine learning sequence processing model being partitioned according to a hybrid partition layout in which weights are fixed along at least one parallelization axis and transmitted along at least one other parallelization axis.

[0295] An exemplary method 2900 may include selecting a group of generative computing devices to generate one or more output sequences if the expected length exceeds a threshold, the group of generative computing devices implementing a machine learning sequence processing model, and at least a portion of the machine learning sequence processing model being partitioned according to a hybrid partition layout with a first number of axes on which weights are transmitted.

[0296] An exemplary method 2900 may include selecting a group of generative computing devices to generate one or more output sequences if the expected length is below a threshold, the group of generative computing devices implementing a machine learning sequence processing model, and at least a portion of the machine learning sequence processing model being partitioned according to a hybrid partition layout with a second number of axes on which weights are transmitted. In exemplary method 2900, the first number may be greater than the second number.

[0297] Exemplary method 2900 may include implementing a weighted fixed partition layout using multiple computing devices arranged in a three-dimensional toroidal configuration. In exemplary method 2900, the number of chips along the first dimension may be one-quarter of the number of chips in the product of the other two dimensions.

[0298] Exemplary method 2900 may include implementing a weight-intensive partition layout using multiple computing devices arranged in a three-dimensional toroidal configuration. In exemplary method 2900, the number of chips along the first dimension may be one-quarter of the number of chips in the product of the other two dimensions.

[0299] An exemplary method 2900 may include implementing a hybrid partitioned layout in which both weights and activations are partially transmitted along different axes.

[0300] An exemplary method 2900 may include sharing a weight layout between a weight-fixed layout and a weight-aggregated layout.

[0301] In exemplary method 2900, the feedforward network of a machine learning-trained sequence processing model can be partitioned according to a fixed-weight partition layout. In exemplary method 2900, the feedforward network of a machine learning-trained sequence processing model can be partitioned according to a weight-aggregated partition layout. In exemplary method 2900, the feedforward network of a machine learning-trained sequence processing model can be partitioned according to a combination of a fixed-weight partition layout and a weight-aggregated partition layout.

[0302] An exemplary method 2900 may include determining the expected ratio of input elements to output elements. Based on the expected ratio of input elements to output elements, an exemplary method 2900 may include determining the ratio of the number of prefill computing devices to the number of decode servers of the generation computing devices.

[0303] An exemplary method 2900 may include routing processing tasks to a group of generating computing devices based on the group's buffer size and expected output length.

[0304] An exemplary method 2900 may include, if it is determined that the actual output length exceeds the expected output length, shifting the processing task to a different group of generating computing devices with larger buffer sizes midway through completion.

[0305] Exemplary method 2900 may include incrementally generating an initial attention tensor by receiving a preceding attention tensor. Exemplary method 2900 may include incrementally generating an initial attention tensor by computing incremental attention tensor components in parallel with an incremental set of input elements. Exemplary method 2900 may include incrementally generating an initial attention tensor by combining a preceding attention tensor with incremental attention tensor components to obtain the initial attention tensor.

[0306] In exemplary method 2900, the initial attention tensor can be acquired incrementally over one or more turns in a multi-turn content generation session.

[0307] In exemplary method 2900, a multi-turn content generation session may include a chat conversation. In exemplary method 2900, a multi-turn content generation session may include a series of instructions to a tool (e.g., an image generation tool, a text generation tool, etc.).

[0308] Figure 30 shows a flowchart of method 3000 for improving the parallelization of an autoregressive machine learning-based sequence processing model according to an aspect of the present disclosure.

[0309] One or more parts of Exemplary Method 3000 can be implemented by a computing system including one or more computing devices, such as a computing system described with reference to other figures. Each part of Exemplary Method 3000 can be implemented by any (or any combination) of one or more computing devices. Furthermore, one or more parts of Exemplary Method 3000 can be implemented on the hardware components of the devices described herein, for example, to train one or more systems or models. Figure 30 shows elements performed in a specific order for illustrative and explanatory purposes. Those skilled in the art will understand, by using the disclosure provided herein, that any element of the methods described herein can be adapted, rearranged, extended, omitted, combined, or modified in various ways without departing from the scope of this disclosure. Figure 30 is described for illustrative purposes with reference to elements / terms described in relation to other systems and figures, and is not intended to limit it. One or more parts of Exemplary Method 3000 can be implemented by other systems, additionally or alternatively.

[0310] In 3002, exemplary method 3000 may include receiving input by a computing system comprising multiple hardware accelerator devices.

[0311] In 3004, exemplary method 3000 may include using multiple hardware accelerator devices to execute a forward path of an attention mechanism of a network, the attention mechanism being divided across the batch dimension of the network.

[0312] In 3006, exemplary method 3000 may include returning an output generated based on a forward pass.

[0313] For example, the attention mechanism could be a multi-queer attention mechanism of a machine learning-trained transformer block.

[0314] Figure 31 shows a flowchart of method 3100 for improving the parallelization of an autoregressive machine learning-based sequence processing model according to an aspect of the present disclosure.

[0315] One or more parts of Exemplary Method 3100 can be implemented by a computing system including one or more computing devices, such as a computing system described with reference to other figures. Each part of Exemplary Method 3100 can be implemented by any (or any combination) of one or more computing devices. Furthermore, one or more parts of Exemplary Method 3100 can be implemented on the hardware components of the devices described herein, for example, to train one or more systems or models. Figure 31 shows elements performed in a specific order for illustrative and explanatory purposes. Those skilled in the art will understand, by using the disclosure provided herein, that any element of the methods described herein can be adapted, rearranged, extended, omitted, combined, or modified in various ways without departing from the scope of this disclosure. Figure 31 is described for illustrative purposes with reference to elements / terms described in relation to other systems and figures, and is not intended to limit it. One or more parts of Exemplary Method 3100 can be additionally or alternatively implemented by other systems.

[0316] In 3102, exemplary method 3100 may include receiving input by a computing system comprising a plurality of hardware accelerator devices. In some embodiments, the plurality of hardware accelerator devices communicate along a topology characterized by one or more axes, and each hardware accelerator device of the plurality of hardware accelerator devices comprises one or more respective processor chips and each memory storing initial weight partitions of the weight tensor of a network of machine-trained models according to the initial partitioning of the weight tensor.

[0317] In 3104, exemplary method 3100 may include using a plurality of hardware accelerator devices to perform a first forward pass of a network using a first layout of weight tensors. The first layout may be a fixed-weight layout or a weight-aggregated layout.

[0318] In 3106, exemplary method 3100 may include using multiple hardware accelerator devices to perform a second forward pass of the network using a second layout of the weight tensor. The second layout may be a fixed-weight layout or a weight-aggregated layout. The second layout may differ from the first layout. The second layout may be a fixed-weight layout. The second layout may correspond to an initial partition of the weight tensor.

[0319] In 3108, the exemplary method 3100 may include returning an output generated based on a first forward pass and a second forward pass.

[0320] In some embodiments, a weight-aggregated layout is generated by broadcasting the weights across the partition axis to which the weight tensor is initially partitioned. In some embodiments, a weight-fixed layout is generated by broadcasting the weights across the partition axis to which the weight tensor is initially partitioned.

[0321] In some embodiments, performing a first forward pass includes obtaining a first input activation tensor of the network based on the input, the first input activation tensor being distributed across multiple hardware accelerator devices, and the first input activation tensor being partitioned across one or more first partition axes. In some embodiments, performing a first forward pass includes broadcasting each copy of the weights aggregated across one or more first partition axes to multiple hardware accelerators. In some embodiments, performing a first forward pass includes computing a first update activation tensor partitioned across one or more first partition axes, based on the processing of the first input activation tensor using each copy of the weights aggregated by the multiple hardware accelerators.

[0322] In some embodiments, performing a second forward pass involves obtaining a second input activation tensor of the network, which is partitioned across a first slice of hardware accelerator devices. In some embodiments, performing a second forward pass involves computing a second update activation tensor partitioned across the first slice, based on processing the second input activation tensor with partitions of each weight in multiple hardware accelerators.

[0323] Figure 32 shows a flowchart of a method 3200 for training one or more machine learning models according to an aspect of the present disclosure. For example, an exemplary machine learning model may include a machine learning sequence processing model implemented on a model host 106.

[0324] One or more parts of Exemplary Method 3200 can be implemented by a computing system including one or more computing devices, such as a computing system described with reference to other figures. Each part of Exemplary Method 3200 can be implemented by any (or any combination) of one or more computing devices. Furthermore, one or more parts of Exemplary Method 3200 can be implemented on the hardware components of the devices described herein, for example, to train one or more systems or models. Figure 32 shows elements performed in a specific order for illustrative and explanatory purposes. Those skilled in the art will understand, by using the disclosure provided herein, that any element of the methods described herein can be adapted, rearranged, extended, omitted, combined, or modified in various ways without departing from the scope of this disclosure. Figure 32 is described for illustrative purposes with reference to elements / terms described in relation to other systems and figures, and is not intended to limit it. One or more parts of Exemplary Method 3200 can be implemented by other systems, additionally or alternatively.

[0325] In 3202, exemplary method 3200 may include obtaining training instances. The training data set may include multiple training instances, which are divided among multiple datasets (e.g., a training dataset, a validation dataset, or a test dataset). Training instances may be labeled or unlabeled. Although referred to as “training” instances in exemplary method 3200, it should be understood that a training instance can also be formed when runtime estimation trains a model using an evaluation of the model’s performance against that runtime instance (e.g., online training / learning). Exemplary data types for training instances and various tasks associated therewith are described throughout this disclosure.

[0326] In 3204, exemplary method 3200 may include processing a training instance using one or more machine learning models to produce an output. The output may be obtained directly from one or more machine learning models, or it may be the result of a series of processing operations that include the outputs of one or more machine learning models.

[0327] In 3206, exemplary method 3200 may include receiving an evaluation signal associated with an output. The evaluation signal can be obtained using a loss function. Various methods for determining the loss can be used, such as mean squared error, likelihood loss, cross-entropy loss, hinge loss, contrastive loss, or various other loss functions. The evaluation signal can be computed using known ground truth labels (e.g., supervised learning), predicted or estimated labels (e.g., semi-supervised or self-supervised learning), or unlabeled (e.g., unsupervised learning). The evaluation signal may be a reward (e.g., a reward for reinforcement learning). The reward can be computed using a machine-learned reward model configured to generate a reward based on the received output. The reward can be computed using feedback data describing human feedback on the output.

[0328] In 3208, exemplary method 3200 may include updating a machine-trained model using an evaluation signal. For example, the parameter values ​​of a machine-trained model can be learned in some embodiments using various training or learning techniques, such as backpropagation. For example, an evaluation signal may be backpropagated from the output (or another source of the evaluation signal) through the machine-trained model to update one or more parameters of the model (for example, based on the gradient of the evaluation signal with respect to the parameter values). For example, a system including one or more machine-trained models can be trained in an end-to-end manner. Gradient descent can be used to iteratively update parameters over several training iterations. In some embodiments, performing backpropagation may include performing censored-time expanded backpropagation. Exemplary method 3200 includes performing several generalization techniques (e.g., weight decay, dropout, etc.) to improve the generalization ability of the trained model.

[0329] In some embodiments, exemplary method 3200 can be implemented to train a machine learning model from an initialized state to a fully trained state (for example, when the model exhibits a desired performance profile based on accuracy, precision, recall, etc.).

[0330] In some embodiments, exemplary method 3200 can be implemented for specific stages of a training procedure. For example, in some embodiments, exemplary method 3200 can be implemented to pre-train a machine learning model. Pre-training may include, for example, large-scale training on potentially noisy data to achieve a wide range of performance levels across various tasks / data types. In some embodiments, exemplary method 3200 can be implemented to fine-tune a machine learning model. Fine-tuning may include, for example, small-scale training on higher-quality data (e.g., labeled, curated, etc.). Fine-tuning may affect all or some of the parameters of the machine learning model. For example, different parts of the machine learning model may be “frozen” during a particular training stage. For example, parameters associated with the embedding space may be “frozen” during fine-tuning (e.g., to retain information learned from a broader domain than that present in the fine-tuning dataset). An exemplary fine-tuning approach includes reinforcement learning. Reinforcement learning is obtained based on user feedback on the model's performance in use.

[0331] Figure 33 is a block diagram of an exemplary processing flow for using a pre-machine-trained model 1 to process input 2 for generating output 3(or more). Any feature described herein with respect to pre-machine-trained model 1 should be understood as describing various attributes and features of the model described herein with respect to any of the figures, and pre-machine-trained model 1 is used as a representative example for clarity and conciseness.

[0332] A machine learning model(s)1 may be one or more machine learning models or model components, or may include them. An exemplary machine learning model may include a neural network (e.g., a deep neural network). An exemplary machine learning model may include a nonlinear model or a linear model. An exemplary machine learning model may use other architectures instead of, or in addition to, a neural network. An exemplary machine learning model may include a decision tree-based model, a support vector machine, a hidden Markov model, a Bayesian network, a linear regression model, a k-means clustering model, etc.

[0333] Exemplary neural networks may include feedforward neural networks (RNNs), recurrent neural networks (RNNs) (including long-shorter memory (LSTM)-based recurrent neural networks), convolutional neural networks (CNNs), propagation models, generative adversarial networks, or other forms of neural networks. Exemplary neural networks may also include deep neural networks. Some exemplary machine-learned models can leverage attention mechanisms such as self-attention. For example, some exemplary machine-learned models may include multi-head self-attention models.

[0334] A machine learning model(s) 1 may contain one or more instances of the same model configured to work on data from input(s) 2. A machine learning model(s) 1 may contain an ensemble of different models that can collaboratively interact to process data from input(s) 2. For example, a machine learning model(s) 1 may employ a mixed-expert structure. See, for example, Zhou et al., Mixture-of-Experts with Expert Choice Routing, ARXIV:2202.09368v2 (October 14, 2022).

[0335] Input(s) 2 can generally contain, or otherwise represent, various types of data. Input(s) 2 can contain one type of data or many different types of data. Output(s) 3 can be the same type(s) of data or different types of data compared to Input(s) 2. Output(s) 3 can contain one type of data or many different types of data.

[0336] Exemplary data types for input(s) 2 or output(s) 3 include natural language text data, software code data (e.g., source code, object code, machine code, or other forms of computer-readable instructions or programming languages), machine code data (e.g., binary code, assembly code, or other forms of machine-readable instructions that can be directly executed by a computer's central processing unit), assembly code data (e.g., low-level programming languages ​​that use symbolic representations of machine code instructions to program a processing unit), genetic data or other chemical or biochemical data, image data, audio data, audiovisual data, tactile data, biometric data, medical data, financial data, statistical data, geographic data, astronomical data, historical data, general sensor data (e.g., digital or analog values ​​such as voltage or other absolute or relative level measurements from actual or artificial inputs such as audio sensors, light sensors, displacement sensors, etc.). Data may be raw or processed and may be in any format or schema.

[0337] In multimodal input 2 or output 3, exemplary combinations of data types include image data and audio data, image data and natural language data, natural language data and software code data, image data and biometric data, sensor data and medical data, etc. Please understand that any combination of data types is possible in input 2 or output 3.

[0338] An exemplary input 2 may include one or more data types, such as the exemplary data types described above. An exemplary output 3 may include one or more data types, such as the exemplary data types described above. The data types of input 2 may be the same as or different from the data types of output 3. It should be understood that the exemplary data types described above are provided for illustrative purposes only. The data types conceivable within the scope of this disclosure are not limited to the examples described above.

[0339] Figure 34 is a block diagram of an exemplary embodiment of an exemplary machine learning model configured to process a sequence of information. For example, an exemplary embodiment of machine learning model 1 may include machine learning sequence processing model 4. The exemplary system can pass input 2 to sequence processing model 4. Sequence processing model 4 may include one or more machine learning components. Sequence processing model 4 can process data from input 2 to obtain input sequence 5. Input sequence 5 may include one or more input elements 5-1, 5-2, ..., 5-M, etc., obtained from input 2. Sequence processing model 4 can process input sequence 5 using predictive layer 6 to generate output sequence 7. Output sequence 7 may include one or more output elements 7-1, 7-2, ..., 7-N, etc., generated based on input sequence 5. The system can generate output 3 based on output sequence 7.

[0340] A sequence processing model (or multiple model) 4 may include one or more machine learning-based model components configured to ingest, generate, or otherwise infer sequences of information. For example, some exemplary sequence processing models in the text domain are called “Large-Scale Language Models,” or LLMs. See, for example, PaLM 2 Technical Report, Google, https: / / ai.google / static / documents / palm2techreport.pdf(nd). Other exemplary sequencing models can operate in other domains, such as the image domain (e.g., Dosovitskiy et al., An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale, ARXIV:2010.11929v2 (Jun. 3, 2021)), the audio domain (e.g., Agostinelli et al., MusicLM: Generating Music From Text, ARXIV:2301.11325v1 (Jan. 26, 2023)), and the biochemistry domain (e.g., Jumper et al., Highly accurate protein structure prediction with AlphaFold, 596 Nature 583 (Aug. 26, 2021)). A sequencing model(s)4 can process one or more types of data simultaneously. The sequence processing model(s)4 may include relatively large models (e.g., more parameters, higher computational cost, etc.), relatively small models (e.g., fewer parameters, lighter computational load, etc.), or both.

[0341] Generally, a sequence processing model 4 can use data from input 2 to obtain an input sequence 5. For example, input sequence 5 may contain a representation of the data from input 2 in a format understood by sequence processing model 4. One or more machine learning-trained components of sequence processing model 4 can take data from input 2, parse the data into fragments compatible with the processing architecture of sequence processing model 4 (e.g., via "tokenization"), and project the fragments into an input space associated with prediction layer 6 (e.g., via "embedding").

[0342] Sequence processing model 4 can take data from input 2 and parse the data into a sequence of elements to obtain input sequence 5. For example, a portion of the input data from input 2 can be broken down into fragments that collectively represent the content of a portion of the input data. These fragments can provide elements for a sequence.

[0343] Elements 5-1, 5-2, ..., 5-M may, in some cases, represent constituent units for capturing or representing meaningful information in a particular data domain. For example, an element may describe an “atomic unit” spanning one or more domains. For instance, in the case of a text input source, an element may correspond to a group of one or more word or subword components, such as one or more sets of characters.

[0344] For example, elements 5-1, 5-2, ..., 5-M may represent tokens obtained using a tokenizer. For example, a tokenizer can process a given portion of an input source and output a set of tokens representing that portion of the input source (e.g., corresponding to input elements 5-1, 5-2, ..., 5-M). Various approaches to tokenization can be used. For example, a text input source(s) can be tokenized using byte-pair encoding (BPE) techniques. See, for example, Kudo et al., SentencePiece: A simple and language-independent subword tokenizer and detokenizer for Neural Text Processing, PROCEEDINGS OF THE 2018 CONFERENCE ON EMPIRICAL METHODS IN NATURAL LANGUAGE PROCESSING (System Demonstrations), pages 66-71 (October 31-November 4, 2018), https: / / aclanthology.org / D18-2012.pdf. Image-based input sources (multiple sources are possible) can be tokenized by extracting patches from the images and serializing them.

[0345] In general, any data type can be serialized and processed to become input sequence 5. It should be understood that elements 5-1, 5-2, ..., 5-M can be tokens or their embedded representations.

[0346] The prediction layer(s) 6 can predict one or more output elements 7-1, 7-2, ..., 7-N based on the input elements. The prediction layer(s) 6 may include one or more trained machine learning model architectures, such as one or more layers of trained parameters that manipulate and transform the input(s) to extract higher-order meaning from the input(s) 5-1, 5-2, ..., 5-M and the relationships between those input elements. Thus, for example, the exemplary prediction layer(s) 6 can predict new output(s) taking into account the context provided by the input sequence 5.

[0347] The predictive layer(s) 6 can evaluate associations between parts of the input sequence 5 and specific output elements. These associations can provide information about the likelihood prediction of a particular output following the input context. For example, consider the text excerpt, "The carpenter's toolbox was small and heavy. It was full of ___." The example predictive layer(s) 6 can identify that "It" refers to "toolbox" by determining the relationships between each embedding. The example predictive layer(s) 6 can also link "It" to attributes of the toolbox such as "small" and "heavy." Based on these associations, the predictive layer(s) 6 can assign a higher probability to the word "nails" than to the word "sawdust," for example.

[0348] Transformers are an exemplary architecture that can be used in the prediction layer 4(or more). See, for example, Vaswani et al., Attention Is All You Need, ARXIV:1706.03762v7 (Aug. 2, 2023). Transformers are an example of a machine learning model architecture that uses an attention mechanism to compute associations between items within a context window. The context window may include an input sequence 5 and a sequence containing, possibly, one or more output elements 7-1, 7-2, ..., 7-N. A transformer block may include one or more attention layers and one or more post-attention layers (or more) (e.g., feedforward layers such as multilayer perceptrons).

[0349] The prediction layer(s) 6 may include, in addition to or instead of, a transformer-based architecture, other machine learning model architectures. For example, recurrent neural networks (RNNs) and long-term short-term memory (LSTM) models may be used, as well as convolutional neural networks (CNNs). In general, the prediction layer(s) 6 can leverage various types of artificial neural networks that can understand or generate sequences of information.

[0350] Output sequence 7 may contain, or otherwise represent, the same or different data types as input sequence 5. For example, input sequence 5 may represent text data, and output sequence 7 may represent text data. Input sequence 5 may represent image, audio, or audiovisual data, and output sequence 7 may represent text data (e.g., describing image, audio, or audiovisual data). It should be understood that any other intervening model component of the prediction layer 6 and sequence processing model 4 can be configured to receive various data types in input sequence 5 and output various data types in output sequence 7.

[0351] Output sequence 7 can have various relationships with input sequence 5. Output sequence 7 may be a continuation of input sequence 5. Output sequence 7 may complement input sequence 5. Output sequence 7 may translate, transform, extend, or otherwise modify input sequence 5. Output sequence 7 may respond to input sequence 5, evaluate, verify, or otherwise respond to input sequence 5. Output sequence 7 may implement (or write instructions for implementing) instructions provided via input sequence 5.

[0352] The output sequence 7 can be generated autoregressively. For example, in some applications, the output of one or more prediction layers 6 can pass through one or more output layers (e.g., softmax layers) to obtain a probability distribution over an output vocabulary (e.g., text vocabulary or symbolic vocabulary) conditional on a set of input elements in a context window. Thus, the output sequence 7 can be generated autoregressively, for example, by sampling the most likely elements to be output next, adding those elements to the context window, regenerating the probability distribution based on the updated context window, sampling the most likely elements to be output next, and so on.

[0353] Furthermore, output sequence 7 can be generated non-autoregressively. For example, multiple output elements of output sequence 7 can be predicted together without explicit sequential conditioning of each other. See, for example, Saharia et al., Non-Autoregressive Machine Translation with Latent Alignments, ARXIV:2004.07437v3 (Nov. 16, 2020).

[0354] Output sequence 7 may contain one or more parts or elements. In an exemplary content generation configuration, output sequence 7 may contain multiple elements corresponding to multiple parts of the generated output sequence (e.g., sentences of text, discretized waveform values, computer code, etc.). In an exemplary classification configuration, output sequence 7 may contain a single element associated with a classification output. For example, the output "Vocabulary" may contain a set of classes to which the input sequence is classified. For example, a visual transformer block may pass latent state information to a multilayer perceptron that outputs a likely class value associated with the input image.

[0355] Figure 35 is a block diagram of an exemplary technique for populating an exemplary input sequence 8. The input sequence 8 may include various functional elements that constitute part of the model infrastructure, such as element 8-0 obtained from a task indicator 9 that signals that a particular task is being performed (for example, to help adapt the performance of the model(s) to that particular task) to any model(s) that processes the input sequence 8. The input sequence 8 may include various data elements from different data modalities. For example, input modality 10-1 may include one modality of data. The data-sequence model 11-1 can process the data from input modality 10-1 so as to project that data into a format compatible with the input sequence 8 (for example, one or more vectors dimensionalized according to the dimensions of the input sequence 8) in order to obtain elements 8-1, 8-2, and 8-3. Other input modalities 10-2 may include different data modalities. Data-sequence model 11-2 can project data from input modality 10-2 into a format compatible with input sequence 8 in order to obtain elements 8-4, 8-5, and 8-6. Other input modalities 10-3 may include yet other different data modalities. Data-sequence model 11-3 can project data from input modality 10-3 into a format compatible with input sequence 8 in order to obtain elements 8-7, 8-8, and 8-9.

[0356] Input sequence 8 may be the same as or different from input sequence 5. Input sequence 8 may be a multimodal input sequence containing elements that represent data from different modalities using a common dimensional representation. For example, the embedding space may have P dimensions. Input sequence 8 can be configured to contain multiple elements having P dimensions. Thus, for example, exemplary embodiments may facilitate information extraction and inference across diverse data modalities by projecting data onto elements in the same embedding space for comparison, combination, or other computations between them.

[0357] For example, elements 8-0, ..., 8-9 may represent specific locations within a multidimensional embedding space. Some elements can be mapped to a discrete set of locations within the embedding space. For instance, elements corresponding to individual components of a given vocabulary of tokens can be mapped to discrete locations within the embedding space associated with those tokens. Other elements can be contiguously distributed across the embedding space. For example, some data types can be decomposed into contiguously defined parts (e.g., image patches) that can be described using contiguously distributed locations within the embedding space.

[0358] In some embodiments, the expressiveness of an embedding space may not be limited to the meaning associated with any particular set of tokens or other constituent units. For example, a continuous embedding space can encode a spectrum of higher-order information. Individual pieces of information (e.g., tokens) can be mapped to specific points within that space; for example, the token for the word "dog" may be projected onto an embedding value that points to a specific location in the embedding space associated with relevant information about dogs. Similarly, an image patch of a dog on grass may be projected onto the embedding space. In some embodiments, the projection of the dog image may be similar to the projection of the word "dog," and at the same time, it may also be similar to the projection of the word "grass," and at the same time, it may be different from both. In some embodiments, the projection of an image patch may not exactly match any single projection of either of the words. In some embodiments, the projection of an image patch can match a combination of projections of the words "dog" and "grass." Thus, for example, a higher-order embedding space can encode information that may be independent of the data modality in which the information is represented.

[0359] The task indicator 9 may include a model or model component configured to inject input values, represented by elements 8-0, into the input sequence 8, which identify the task being performed and signal which task is being performed. For example, the input values ​​may be provided as a data type associated with an input modality and projected together with that input modality (e.g., the input values ​​may be text task labels embedded in the input along with other text data, or pixel-based representations of tasks embedded in the input along with other image data, etc.). The input values ​​may be provided as a data type that is different from, or at least independent of, other inputs(s). For example, the input values ​​represented by elements 8-0 may be learned in a continuous embedding space.

[0360] Input modalities 10⁻¹, 10⁻², and 10⁻³ can be associated with various different data types (for example, as described above for input(s) 2 and output(s) 3).

[0361] The data-sequence models 11-1, 11-2, and 11-3 can be the same or different from each other. The data-sequence models 11-1, 11-2, and 11-3 can be adapted to their respective input modalities 11-1, 10-2, and 10-3. For example, a text data-sequence model can subdivide a portion of the input text and project that subdivided portion onto an element(s) in the input sequence 8 (e.g., elements 8-1, 8-2, 8-3, etc.). An image data-sequence model can subdivide an input image and project that subdivided portion onto an element(s) in the input sequence 8 (e.g., elements 8-4, 8-5, 8-6, etc.). A data-sequence model for any data type can subdivide the input of that data type and project that subdivided portion onto an element(s) in the input sequence 8 (e.g., elements 8-7, 8-8, 8-9, etc.).

[0362] The data-sequence models 11-1, 11-2, and 11-3 can form part of a machine learning-based sequence processing model 4. The data-sequence models 11-1, 11-2, and 11-3 can be trained in conjunction with or independently of the machine learning-based sequence processing model 4. The data-sequence models 11-1, 11-2, and 11-3 can be trained end-to-end using the machine learning-based sequence processing model 4.

[0363] Figure 36 is a block diagram of an exemplary model development platform 12 that facilitates the creation, adaptation, and improvement of exemplary machine learning models (e.g., machine learning model 1, sequence processing model 4, etc.). The model development platform 12 can provide several different toolkits that a developer system can employ in developing new or adapted machine learning models.

[0364] The model development platform 12 can provide one or more model libraries 13 containing the building blocks of a new model. The model library 13 may include one or more pre-trained foundational models 13-1 that can provide a processing power backbone across various tasks. The model library 13 may also include one or more pre-trained expert models 13-2 that may focus on performance in a specific domain of expertise. The model library 13 may also include various model primitives 13-3 that provide low-level architectures or components (optionally pre-trained) that can be assembled in various configurations as desired.

[0365] The model development platform 12 can receive selections of various model components 14. The model development platform 12 can pass the selected model components 14 to the workbench 15, which then incorporates the selected model components 14 into the development model 16.

[0366] The workbench 15 can facilitate further refinement and adaptation of the development model 16 by leveraging several different toolkits integrated with the model development platform 12. For example, the workbench 15 can use the model alignment toolkit 17 to facilitate alignment of the development model 16 with desired performance profiles for various tasks.

[0367] The model alignment toolkit 17 can provide several tools for causing the development model 16 to generate output consistent with desired behavioral characteristics. Alignment may include improving the accuracy, precision, recall, etc., of the model output. Alignment may include enforcing the application of output style, schema, or other preferred characteristics of the model output. Alignment may be general or domain-specific. For example, a pre-trained base model 13-1 can start at an initial performance level across multiple domains. Alignment of the pre-trained base model 13-1 may include improving performance in a specific domain of information or task (for example, at the expense of performance in other domains of information or task).

[0368] The model alignment toolkit 17 can integrate one or more datasets 17-1 for aligning the development model 16. The curated dataset(s) 17-1 may include labeled or unlabeled training data. The dataset(s) 17-1 can be obtained from public domain datasets. Alternatively, the dataset(s) 17-1 can be obtained from private datasets associated with one or more developer systems for aligning a bespoke, machine learning model(s) customized for a private case study.

[0369] The pre-training pipeline 17-2 may include a machine learning model training workflow configured to update the development model 16 across a large and potentially noisy dataset. For example, pre-training can leverage unsupervised learning techniques (e.g., denoising) to process a large number of training instances to update model parameters from an initialization state and achieve desired baseline performance. The pre-training pipeline 17-2 can leverage an unlabeled dataset of dataset 17-1 for pre-training. The workbench 15 can implement the pre-training pipeline 17-2 to pre-train the development model 16.

[0370] The fine-tuning pipeline 17-3 may include a machine learning model training workflow configured to improve the model parameters of the development model 16 using higher quality data. The fine-tuning pipeline 17-3 can update the development model 16 by performing supervised training using the labeled dataset(s) of dataset(s) 17-1. The fine-tuning pipeline 17-3 can update the development model 16 by performing reinforcement learning using reward signals from user feedback signals. The workbench 15 can implement the fine-tuning pipeline 17-3 to fine-tune the development model 16.

[0371] The prompt library 17-4 may include a set of inputs configured to induce behavior consistent with a desired performance criterion. The prompt library 17-4 may include few-shot prompts (e.g., inputs that provide examples of desired model outputs to prepend before a desired runtime query), thought chain prompts (e.g., inputs that provide stepwise reasoning in examples to facilitate thorough reasoning by the model), and so on.

[0372] Exemplary prompts can be retrieved from the available repository of prompt library 17-4. Exemplary prompts may be provided by one or more developer systems using workbench 15.

[0373] In some embodiments, a pre-trained or fine-tuned model can achieve satisfactory performance even when the input lacks examples. For example, a zero-shot prompt may contain an input lacking examples. A zero-shot prompt may be located within a domain in the training dataset, or outside the training domain(s).

[0374] The prompt library 17-4 may include one or more prompt engineering tools. The prompt engineering tools can provide workflows for extracting or learning optimized prompt values. The prompt engineering tools may facilitate direct learning of prompt values ​​(e.g., input element values) based on one or more training iterations. The workbench 15 can implement the prompt engineering tools in the development model 16.

[0375] The prompt library 17-4 may include a pipeline for prompt generation. For example, inputs can be generated using the development model 16 itself or other machine learning models. Thus, for example, the first model may process information about a task and output an input that the second model processes to perform the steps of the task. The second model may be the same as or different from the first model. The workbench 15 can implement the prompt generation pipeline in the development model 16.

[0376] The prompt library 17-4 may include a pipeline for context injection. For example, the performance of the development model 16 for a particular task can be improved if additional context is provided for performing that task. The prompt library 17-4 may include a software component configured to identify a desired context, retrieve the context from an external source (e.g., a database, sensor, etc.), and add the context to the input prompt. The workbench 15 can implement a pipeline for context injection in the development model 16.

[0377] While the various training examples described herein with respect to the model development platform 12 refer to "pre-training" and "fine-tuning," it should be understood that the model alignment toolkit 17 can generally support a variety of training techniques adapted for training various machine learning models. Exemplary training techniques may correspond to the exemplary training methods 3200 described above.

[0378] The model development platform 12 may include a model plugin toolkit 18. The model plugin toolkit 18 may include a variety of tools configured to extend the functionality of machine-learned models by integrating them with other systems, devices, and software components. For example, machine-learned models can use tools to improve the quality of their performance, where appropriate. For example, deterministic tasks can be offloaded to specialized tools instead of performing tasks probabilistically, which carries a higher risk of error. For example, instead of autoregressively predicting the solution to a system of linear equations, a machine-learned model can recognize which tool to call to obtain the solution and pass the system of equations to the appropriate tool. The tool could be a conventional system of equations solver that can act deterministically to solve the system of equations. The output of the tool may be returned in response to the original query. In this way, by using tools, some exemplary models may be able to enhance the performance of their models by focusing on the strengths of machine-learned models, such as understanding the intent of unstructured requests to tasks, while at the same time offloading specific tasks to more specialized tools for mechanically applying deterministic algorithms to well-defined problems.

[0379] The Model Plugin Toolkit 18 may include a validation tool 18-1. The validation tool 18-1 may include a tool that can parse and verify the output(s) of a machine learning model. The validation tool 18-1 may include engineered heuristics that establish specific thresholds to apply to the model output. For example, the validation tool 18-1 may justify the output of a machine learning model to a structured data source (e.g., to mitigate hallucination).

[0380] The model plugin toolkit 18 may include a tool package 18-2 for implementing one or more tools, which may include scripts or other executable code that can be run with the development model 16. The tool package 18-2 may include one or more inputs configured to cause a machine learning model(s) to implement the tool(s) (e.g., a fusion shot prompt that guides the model to output a tool call in the appropriate syntax). The tool package 18-2 may include, for example, fine-tuning training data for training the model to use the tool(s).

[0381] The model plug-in toolkit 18 may include an interface for calling an external application programming interface (API) 18-3. For example, in addition to directly implementing tool calls or tool code in the development model 16, or instead, the development model 16 may be configured to output instructions that initiate API calls to send or retrieve data via an external system.

[0382] The model plugin toolkit 18 can integrate with the prompt library 17-4 to build a catalog of available tools for use with the development model 16. For example, the model can receive a catalog of available tools as input, and the model can generate an output that selects a tool from the available tools and initiates a tool call to use that tool.

[0383] The model development platform 12 may include a computational optimization toolkit 19 for optimizing the computational performance of the development model 16. For example, tools for model compression 19-1 may enable reducing the size of the development model 16 while maintaining a desired performance level. For example, model compression 19-1 may include quantization workflows, weight pruning, and sparsification techniques. Tools for hardware acceleration 19-2 may facilitate the configuration of model storage and execution formats to work optimally on different hardware resources. For example, hardware acceleration 19-2 may include tools for optimally sharding models for distributed processing across multiple processors to increase bandwidth, reduce integrated memory requirements, etc. Tools for distillation 19-3 can provide training for lightweight models based on the knowledge encoded in the development model 16. For example, the development model 16 may be a very high-performance, large-scale machine learning model optimized using the model development platform 12. To obtain a lightweight model for execution in resource-constrained environments, a small model may be a "student model," which learns to mimic the development model 16 as a "teacher model." Thus, for example, the investment made in training the parameters and configuration of development model 16 can be efficiently repurposed for smaller models for more efficient inference.

[0384] Workbench 15 may implement one or more of the toolkits implemented in the model development platform 12, or it may not implement any of them. Workbench 15 can output an output model 20 based on the development model 16. The output model 20 may be an expanded version of the development model 16. The output model 20 may be a development or training checkpoint of the development model 16. The output model 20 may be a distilled, compressed, or otherwise optimized version of the development model 16.

[0385] Figure 37 is a block diagram of an exemplary training flow for training a machine learning-prepared development model 16. One or more parts of the exemplary training flow can be implemented by a computing system including one or more computing devices, such as the computing system described with reference to other figures. Each part of the exemplary training flow can be performed by any one (or any combination) of one or more computing devices. Furthermore, one or more parts of the exemplary training flow can be executed on the hardware components of the devices described herein, for example, to train one or more systems or models. The figures show elements performed in a particular order for illustrative and explanatory purposes. Those skilled in the art will understand, by using the disclosures provided herein, that any element of the methods described herein can be adapted, rearranged, extended, omitted, combined, or modified in various ways without departing from the scope of this disclosure. The figures are described for illustrative purposes with reference to other systems and elements / terms described in relation to the figures, and are not intended to be limiting. One or more parts of the exemplary training flow can be performed by other systems, additionally or alternatively.

[0386] First, the development model 16 can be maintained in its initial state as the initialization model 21. The development model 16 can be initialized with weight values. The initial weight values ​​can be random or based on an initialization schema. The initial weight values ​​can be based on prior pre-training on the same or different models.

[0387] The initialization model 21 may undergo pre-training in the pre-training stage 22. The pre-training stage 22 can be run using one or more pre-training pipelines 17-2 on data from dataset 17-1. For example, if the initialization model 21 is already pre-trained (e.g., the development model 16 is itself or based on a pre-trained foundational or expert model), then pre-training can be omitted.

[0388] Next, the pre-trained model 23 can become a new version of the development model 16, which can persist as development model 16 or as a new development model. The pre-trained model 23 can become the initial state if the development model 16 has already been pre-trained. The pre-trained model 23 can undergo fine-tuning in the fine-tuning stage 24. The fine-tuning stage 24 can be performed using one or more fine-tuning pipelines 17-3 on data from dataset 17-1(or more). For example, fine-tuning can be omitted if the performance of the pre-trained model is satisfactory, if the model has already been fine-tuned, or if another tuning approach is preferred.

[0389] Next, the fine-tuned model 29 can become a new version of the development model 16, which can persist as development model 16 or as a new development model. The fine-tuned model 29 can become the initial state if the development model 16 has already been fine-tuned. The fine-tuned model 29 can undergo improvements 26 based on user feedback. For example, improvements 26 based on user feedback may include reinforcement learning based on optional human feedback from human users of the fine-tuned model 25. Since reinforcement learning can be a form of fine-tuning, it should be understood that the fine-tuning stage 24 can incorporate a stage for improvements 26 based on user feedback. Improvements 26 based on user feedback may result in the creation of an improved model 27. The improved model 27 can be output to a downstream system 28 for deployment or further development.

[0390] In some embodiments, computational optimization operations can be applied before, during, or after each stage. For example, the initialized model 21 may undergo computational optimization 29-1 (e.g., using the computational optimization toolkit 19) before the pre-training stage 22. The pre-trained model 23 may undergo computational optimization 29-2 (e.g., using the computational optimization toolkit 19) before the fine-tuning stage 24. The fine-tuned model 25 may undergo computational optimization 29-3 (e.g., using the computational optimization toolkit 19) before the user feedback-based refinement 26. The refined model 27 may undergo computational optimization 29-4 (e.g., using the computational optimization toolkit 19) before outputting to a downstream system(s) 28. Computational optimizations 29-1, ..., 29-4(s) may all be the same, all be different, or include at least some different optimization techniques.

[0391] Figure 38 is a block diagram of an inference system for running one or more machine learning models 1 to perform inference (e.g., training and deployment). A model host 31 can receive machine learning models 1. A model host 31 can host one or more model instances 31-1, which may be one or more instances of one or more models. A model host 31 can host model instances 31-1 using available computing resources 31-2 associated with the model host 31.

[0392] Model host 31 may be an embodiment of model host system 106.

[0393] The model host 31 can perform inference on behalf of one or more clients 32. Clients 32 can communicate input requests 33 to the model host 31. Using the input requests 33, the model host 31 can obtain inputs 2 for input to machine-trained models 1. Machine-trained models 1 can process inputs 2 to produce outputs 3. Using outputs 3, the model host 31 can return an output payload 34 in response to the input requests 33 from clients 32. The output payload 34 may contain or be based on outputs 3.

[0394] The model host 31 can leverage various other resources and tools to extend its inference tasks. For example, the model host 31 can communicate with a tool interface 35 to facilitate the use of tools by model instances 31-1. The tool interface 35 may include local or remote APIs. The tool interface 35 may include integrated scripts or other software functions. The model host 31 can use online learning interfaces 36 to facilitate the continuous improvement of machine learning models 1. For example, online learning interfaces 36 can be used within a reinforcement learning loop to extract user feedback on inferences provided by the model host 31. The model host 31 can access runtime data sources 37 to extend inputs 2 with additional contextual information. For example, runtime data sources 37 may include a knowledge graph 37-1 that facilitates the extraction of structured information with respect to input requests 33 (e.g., search engine services) and associated information. The runtime data source(s) 37 may include public or private, external or local database(s) 37-2 that can store information associated with input requests(s) 33 to extend the input(s) 2. The runtime data source(s) 37 may also include account data(s) 37-3, which can be retrieved in association with user accounts corresponding to clients 32 to customize the behavior of the model host(s) 31 depending on the situation.

[0395] Model host 31 can be implemented by one or more computing devices or systems. Client(s) 2 can be implemented by one or more computing devices or systems, which may include computing devices or systems shared with model host 31.

[0396] For example, the model host 31 may operate on a server system that provides machine learning services to client devices 32 (for example, via a local or wide area network). Client devices 32 may be end-user devices used by individuals. Client devices 32 may be server systems that operate client devices 32 in order to provide various functions as services to downstream end-user devices.

[0397] In some embodiments, the model host 31 can operate on the same device or system as the client(s) 32. The model host 31 may be an on-device machine learning service that provides machine learning capabilities to one or more applications running on a client device, which may include applications that implement the client(s) 32. The model host 31 may be part of the same application as the client(s) 32. For example, the model host 31 may be a subroutine or method implemented by one part of the application, and the client(s) 32 may be another subroutine or method that uses the model host 31 to perform inference capabilities within the application. It should be understood that the model host 31 and the client(s) 32 may have a variety of different configurations.

[0398] A model instance 31-1 may contain one or more machine learning models available for inference. A model instance 31-1 may contain weights or other model components that are stored in persistent storage, temporarily cached, or loaded into fast memory. A model instance 31-1 may contain multiple instances of the same model (for example, to run more requests in parallel on the same model). A model instance 31-1 may contain instances of different models. A model instance 31-1 may contain cached intermediate states of active or inactive models used to speed up inference for those models. For example, an inference session with a particular model may generate a significant amount of computational results that can be reused for future inference runs (for example, using a KV cache for a transformer-based model). These computational results can be associated with and stored for that inference session, so that the session can run more efficiently when resumed.

[0399] Computational resources 31-2 may include one or more processors (such as a central processing unit, a graphical processing unit, a tensor processing unit, or a machine learning accelerator) connected to one or more memory devices. Computational resources 31-2 may include a dynamic pool of available resources shared with other processes. Computational resources 31-2 may include a memory device large enough to accommodate an entire model instance in a single memory instance. Computational resources 31-2 may also shard the model instance across multiple memory devices (e.g., using data parallelism or tensor parallelism). This can be done to improve parallelism or to run large models using multiple memory devices that may not individually be able to fit the entire model into memory.

[0400] Input request 33 may contain data for input(s) 2. Model host 31 can process input request 33 to obtain input(s) 2. Input(s) 2 can be obtained directly from input request 33 or retrieved using input request 33. Input request 33 can be submitted to model host 31 via API.

[0401] The model host 31 can perform inference in parallel across batches of input requests 33. For example, a model instance 31-1 can consist of an input structure having a batch dimension. Separate inputs 2 can be distributed across the batch dimension (e.g., rows of an array). Separate inputs 2 can contain completely different contexts. Separate inputs 2 can be multiple inference steps of the same task. Separate inputs 2 can be arranged alternately within the input structure, so that any given inference cycle can operate on different parts of each input 2. In this way, for example, the model host 31 can perform inference on batches in parallel, and as a result, the output 3 can also include a batch dimension and return the inference results of the batched inputs 2 in parallel. In this way, for example, batches of input requests 33 can be processed in parallel for higher throughput of the output payload 34.

[0402] The output payload 34 may contain, or be based on, the outputs 3 from machine learning model 1. The model host 31 can process the outputs 3 to obtain the output payload 34. This may involve chaining multiple inferences (e.g., iteratively, recursively, across the same model or different models) to arrive at the final output of the task returned in the output payload 34. The output payload 34 can be communicated to the client 32 via an API.

[0403] The online learning interface(s)36 can facilitate reinforcement learning of the machine learning model(s)1. The online learning interface(s)36 can facilitate reinforcement learning with human feedback (RLHF). The online learning interface(s)36 can facilitate federated learning of the machine learning model(s)1.

[0404] The model host 31 can run a machine learning model 1 to perform inference on various tasks using various types of data. For example, various different inputs 2 and outputs 3 can be used for various different tasks. In some embodiments, input 2 may be image data, or otherwise represent image data. The machine learning model 1 can process image data to produce an output. For example, the machine learning model 1 can process image data to produce an image recognition output (e.g., recognition of image data, latent embedding of image data, encoded representation of image data, hash of image data, etc.). As another example, the machine learning model 1 can process image data to produce an image segmentation output. As yet another example, the machine learning model 1 can process image data to produce an image classification output. As yet another example, the machine learning model 1 can process image data to produce an image data modification output (e.g., modification of image data, etc.). As another example, machine learning model 1 can process image data to generate encoded image data output (e.g., encoded and / or compressed representations of the image data). As yet another example, machine learning model 1 can process image data to generate upscaled image data output. As yet another example, machine learning model 1 can process image data to generate predictive output.

[0405] In some embodiments, the task is a computer vision task. In some cases, input 2 includes pixel data from one or more images, and the task is an image processing task. For example, the image processing task could be image classification, and the output would be a set of scores, each corresponding to a different object class, representing the likelihood that one or more images depict an object belonging to that object class. The image processing task could be object detection, and the image processing output would identify one or more regions within one or more images, and for each region, identify the likelihood that the region depicts an object of interest. Another example is image segmentation, where the image processing output would define, for each pixel in one or more images, the likelihood for each category within a given set of categories. For example, the set of categories could be foreground and background. Another example is that the set of categories could be object classes. Another example is depth estimation, where the image processing output would define, for each pixel in one or more images, the respective depth values. As another example, the image processing task could be motion estimation, where the network input includes multiple images, and the image processing output defines the motion of the scene depicted in the pixels between the images in the network input, for each pixel in the input images.

[0406] In some embodiments, input(s) 2 may be, or otherwise represent, natural language data. A machine learning model(s) 1 can process natural language data to produce an output. For example, machine learning model(s) 1 can process natural language data to produce a language encoding output. Another example is machine learning model(s) 1 can process natural language data to produce a latent text embedding output. Another example is machine learning model(s) 1 can process natural language data to produce a translation output. Another example is machine learning model(s) 1 can process natural language data to produce a classification output. Another example is machine learning model(s) 1 can process natural language data to produce a text segmentation output. Another example is machine learning model(s) 1 can process natural language data to produce an output representing semantic intent. Another example is machine learning model(s) 1 can process natural language data to produce an upscaled text or natural language output (e.g., text or natural language data of higher quality than the input text or natural language). As another example, a machine learning model(s)1 can process natural language data to produce predictive outputs (e.g., one or more predicted next parts of natural language content).

[0407] In some embodiments, input 2 may be, or otherwise represent, audio data (e.g., audio data, text data, etc., describing spoken natural language). A machine learning model 1 can process the audio data to produce an output. For example, machine learning model 1 can process the audio data to produce a speech recognition output. As another example, machine learning model 1 can process the audio data to produce a speech translation output. As yet another example, machine learning model 1 can process the audio data to produce a latent embedding output. As yet another example, machine learning model 1 can process the audio data to produce an encoded audio output (e.g., an encoded and / or compressed representation of the audio data). As yet another example, machine learning model 1 can process the audio data to produce an upscaled audio output (e.g., audio data of higher quality than the input audio data). As yet another example, machine learning model 1 can process the audio data to produce a text representation output (e.g., a text representation of the input audio data). As another example, machine learning model(s) 1 can process audio data to generate predictive outputs.

[0408] In some embodiments, input 2 may be, or otherwise represent, latent encoding data (e.g., a latent spatial representation of the input). A machine learning model 1 can process the latent encoding data to generate an output. For example, machine learning model 1 can process the latent encoding data to generate a recognition output. As another example, machine learning model 1 can process the latent encoding data to generate a reconstruction output. As yet another example, machine learning model 1 can process the latent encoding data to generate a search output. As yet another example, machine learning model 1 can process the latent encoding data to generate a reclustering output. As yet another example, machine learning model 1 can process the latent encoding data to generate a prediction output.

[0409] In some embodiments, input 2 may be statistical data, or may otherwise represent statistical data. Statistical data may be, represent, or otherwise include data computed and / or calculated from some other data source. A machine learning model 1 may process statistical data to produce an output. For example, machine learning model 1 may process statistical data to produce a recognition output. As another example, machine learning model 1 may process statistical data to produce a prediction output. As yet another example, machine learning model 1 may process statistical data to produce a classification output. As yet another example, machine learning model 1 may process statistical data to produce a segmentation output. As yet another example, machine learning model 1 may process statistical data to produce a visualization output. As yet another example, machine learning model 1 may process statistical data to produce a diagnostic output.

[0410] In some embodiments, input 2 may be, or otherwise represent, sensor data. A machine learning model 1 can process the sensor data to generate an output. For example, machine learning model 1 can process the sensor data to generate a recognition output. As another example, machine learning model 1 can process the sensor data to generate a prediction output. As yet another example, machine learning model 1 can process the sensor data to generate a classification output. As yet another example, machine learning model 1 can process the sensor data to generate a segmentation output. As yet another example, machine learning model 1 can process the sensor data to generate a visualization output. As yet another example, machine learning model 1 can process the sensor data to generate a diagnostic output. As yet another example, machine learning model 1 can process the sensor data to generate a detection output.

[0411] In some embodiments, a machine learning model(s)1 can be configured to perform a task that includes encoding input data for reliable and / or efficient transmission or storage (and / or corresponding decoding). For example, the task could be an audio compression task. The input may include audio data, and the output may include compressed audio data. In another example, the input may include visual data (e.g., one or more images or videos), and the output may include compressed visual data, and the task is a visual data compression task. In yet another example, the task may include generating embeddings for input data (e.g., input audio or visual data). In some cases, the input may include audio data representing spoken utterances, and the task is a speech recognition task. The output may include text output mapped to the spoken utterances. In some cases, the task may include encrypting or decrypting the input data. In some cases, the task may include a microprocessor performance task, such as branch prediction or memory address translation.

[0412] In some embodiments, the task is a generative task, and a machine-trained model(s)1 can be configured to output content generated considering input(s)2. For example, input(s)2 could be data from one or more modalities encoding the context for generating additional content, or otherwise representing them.

[0413] In some embodiments, the task may be a text completion task. A machine learning model(s) 1 can be configured to process an input(s) 2 representing text data and produce an output(s) 3 representing additional text data to complete a text sequence containing the input(s) 2. For example, the machine learning model(s) 1 can be configured to produce an output(s) 3 to complete a sentence, paragraph, or portion of text that follows the portion of text represented by the input(s) 2.

[0414] In some embodiments, the task may be an instruction-following task. A machine-trained model(s) 1 can be configured to process input(s) 2 representing instructions for performing a function and to generate output(s) 3 that advance the goal of fulfilling the instruction function (e.g., at least one step of a multi-step procedure for performing the function). Output(s) 3 may represent the same data as input(s) 2 or data of a different modality. For example, input(s) 2 may represent text data (e.g., natural language instructions for the task to be performed), and machine-trained model(s) 1 can process input(s) 2 to generate output(s) 3 that represent text data in response to the instructions (e.g., natural language responses, programming language responses, machine language responses, etc.). Input(s) 2 may represent image data (e.g., image-based instructions for a task to be performed, optionally accompanied by text instructions), and a machine learning model(s) 1 may process Input(s) 2 to generate Output(s) 3, which represent text data (e.g., natural language responses, programming language responses, machine language responses, etc.) in response to the instructions. One or more Output(s) 3 may be generated iteratively or recursively to sequentially process and achieve steps toward achieving the requested function. For example, an initial output may be executed by an external system or processed by a machine learning model(s) 1 to complete the initial steps toward performing the function. Multiple steps may be performed, and a final output in response to the initial instructions is obtained.

[0415] In some embodiments, the task may be a question-answering task. A machine-trained model (or model) 1 can be configured to process an input (or model) 2 representing a question to be answered and to produce an output (or model) 3 that advances the goal of returning an answer to the question (e.g., at least one step of a multi-step procedure for performing a function). The output (or model) 3 may represent data of the same or different modalities as the input (or model) 2. For example, the input (or model) 2 may represent text data (e.g., natural language instructions for the task to be performed), and the machine-trained model (or model) 1 can process the input (or model) 2 to produce an output (or model) 3 representing text data in response to the question (e.g., natural language response, programming language response, machine language response, etc.). Input(s) 2 may represent image data (e.g., image-based instructions for a task to be performed, optionally accompanied by text instructions), and a machine learning model(s) 1 may process Input(s) 2 to generate Output(s) 3 representing text data (e.g., natural language responses, programming language responses, machine language responses, etc.) in response to a question. One or more Output(s) 3 may be generated iteratively or recursively to sequentially process steps toward answering the question. For example, an initial output may be executed by an external system or processed by machine learning model(s) 1 to complete the first step in obtaining an answer to the question (e.g., querying a database, performing a calculation, executing a script, etc.). Multiple steps may be taken to obtain a final output that answers the question.

[0416] In some embodiments, the task may be an image generation task. A machine learning model 1 can be configured to process an input 2 that represents a context about a desired portion of an image content. The context may include text data, image data, audio data, etc. The machine learning model 1 can be configured to produce an output 3 that represents image data depicting an image related to the context. For example, the machine learning model 1 can be configured to generate pixel data for an image. The values ​​of the channels associated with the pixels in the pixel data can be selected based on the context (for example, based on probabilities determined based on the context).

[0417] In some embodiments, the task may be an audio generation task. A machine learning model 1 can be configured to process an input 2 that represents a context about a desired portion of audio content. The context may include text data, image data, audio data, etc. The machine learning model 1 can be configured to produce an output 3 that represents an audio image related to the context. For example, the machine learning model 1 can be configured to produce waveform data in image format (e.g., a spectrogram). The channel values ​​associated with the pixels of the image may be selected based on the context. The machine learning model 1 can be configured to produce waveform data in the form of a sequence of discrete samples of a continuous waveform. The sequence values ​​may be selected based on the context (e.g., based on probabilities determined based on the context).

[0418] In some embodiments, the task may be a data generation task. A machine learning model(s) 1 can be configured to process input(s) 2 representing context about a desired portion of the data (e.g., data from various data domains, such as sensor data, image data, multimodal data, statistical data, etc.). The desired data may be, for example, synthetic data for training other machine learning models. The context may include any data type(s). The machine learning model(s) 1 can be configured to produce output(s) 3 representing data consistent with the desired data. For example, the machine learning model(s) 1 can be configured to generate data values ​​for injecting into a dataset. The values ​​of the data objects(s) may be selected based on the context (e.g., based on probabilities determined based on the context).

[0419] Figure 39 is a block diagram of an exemplary network computing system that can perform an exemplary embodiment of the present disclosure. The system may include a plurality of computing devices and systems that are communicably coupled through a network 49. An exemplary computing device 50 is described to provide an example of a computing device that can perform any embodiment of the present disclosure (e.g., implementing a model host 31, a client(s) 32, or both). An exemplary server computing system 60 is described as an example of a server computing system that can perform any embodiment of the present disclosure (e.g., implementing a model host 31, a client(s) 32, or both). The computing device 50 and the server computing system(s) 60 can interact cooperatively (e.g., through the network 49) to perform any embodiment of the present disclosure (e.g., implementing a model host 31, a client(s) 32, or both). A model development platform system 70 is an exemplary system that can host or provide a model development platform(s) 12 for developing machine learning models. The third-party system(s) 80 is an exemplary system(s) that can interact with any of the computing device(s) 50, server computing system(s) 60, or model development platform system(s) 70 when performing various aspects of the disclosure (e.g., involving third-party tools, accessing third-party databases or other resources).

[0420] Network 49 can be any type of communication network, such as a local area network (e.g., an intranet), a wide area network (e.g., the Internet), or a combination thereof, and may include any number of wired or wireless links. In general, communication through Network 49 can be transmitted over any type of wired or wireless connection using a wide variety of communication protocols (e.g., TCP / IP, HTTP, SMTP, FTP), encodings or formats (e.g., HTML, XML), or protection methods (e.g., VPN, Secure HTTP, SSL). Network 49 can also be implemented via a system bus. For example, one or more devices or systems may be located in the same place as one or more other devices or systems, may be housed in them, or otherwise integrated with them.

[0421] The computing device 50 may be any type of computing device, such as a personal computing device (e.g., a laptop or desktop), a mobile computing device (e.g., a smartphone or tablet), a game console or controller, a wearable computing device, an embedded computing device, a server computing device, a virtual machine running on a host device, or any other type of computing device. The computing device 50 may be a client computing device. The computing device 50 may be an end-user computing device. The computing device 50 may be a computing device of a service provider that provides services to an end user (the end user may use other computing devices to interact with the computing device 50).

[0422] The computing device 50 may include one or more processors 51 and memory 52. ​​The processor(s) 51 may be any suitable processing device (e.g., a processor core, microprocessor, ASIC, FPGA, controller, microcontroller, etc.) and may be one processor or multiple processors connected in an operable manner. The memory 52 may include one or more non-temporary computer-readable storage media such as HBM, RAM, ROM, EEPROM, EPROM, flash memory devices, magnetic disks, etc., and combinations thereof. The memory 52 may store data 53 and instructions 54, and the instructions 54 may be executed by the processor(s) 51 to cause the computing device 50 to perform an operation. The operation may perform any one or more features described herein. The operation may perform exemplary methods and techniques described herein.

[0423] The computing device 50 may also include one or more input components that receive user input. For example, a user input component may be a touch-sensitive component (e.g., a touch-sensitive display screen or touchpad) that is sensitive to the touch of a user input object (e.g., a finger or stylus). The touch-sensitive component may function to implement a virtual keyboard. Other exemplary user input components include a microphone, a camera, LiDAR, a physical keyboard or other buttons, or other means by which the user can provide user input.

[0424] The computing device 50 can store or may contain one or more machine learning models 55. The machine learning models 55 may include one or more machine learning models 1, such as a sequence processing model 4. The machine learning models 55 may include one or more model instances 31-1. The machine learning models 55 can be received from server computing systems 60, model development platform systems 70, third-party systems 80 (e.g., application distribution platforms), or developed locally on the computing device 50. The machine learning models 55 may be loaded into memory 52 and used by processors 51, or otherwise implemented. The computing device 50 can implement multiple parallel instances of the machine learning models 55.

[0425] A server computing system (or multiple) 60 may include one or more processors 61 and a memory 62. The processor (or multiple) 61 may be any suitable processing device (e.g., a processor core, microprocessor, ASIC, FPGA, controller, microcontroller, etc.) and may be one processor or multiple processors connected in an operable manner. The memory 62 may include one or more non-temporary computer-readable storage media such as HBM, RAM, ROM, EEPROM, EPROM, flash memory devices, magnetic disks, etc., and combinations thereof. The memory 62 can store data 63 and instructions 64, and the instructions 64 can be executed by the processor (or multiple) 61 to cause the server computing system (or multiple) 60 to perform operations. The operations may perform any one or more features described herein. The operations may perform exemplary methods and techniques described herein.

[0426] In some embodiments, the server computing system 60 includes one or more server computing devices, or is otherwise implemented by them. In examples where the server computing system 60 includes multiple server computing devices, such server computing devices can operate according to a sequential computing architecture, a parallel computing architecture, or some combination thereof.

[0427] The server computing system 60 can store, or otherwise include, one or more machine learning models 65. A machine learning model 65 may be the same as, or different from, a machine learning model 55. A machine learning model 65 may include one or more machine learning models 1, such as a sequence processing model 4. A machine learning model 65 may include one or more model instances 31-1. A machine learning model 65 can be received from a computing device 50, a model development platform system 70, a third-party system 80, or developed locally on the server computing system 60. A machine learning model 65 may be loaded into memory 62 and used by a processor 61, or otherwise implemented. The server computing system 60 can implement multiple parallel instances of a machine learning model 65.

[0428] In an exemplary configuration, the machine learning model 65 may be contained in, or otherwise stored and implemented by, the server computing system 60 to establish a client-server relationship with the computing device 50 for providing model inference. For example, the server computing system 60 may implement the model host 31 on the computing device 50 in place of the client 32. For example, the machine learning model 65 may be implemented by the server computing system 60 as part of a web service (e.g., a remote machine learning model host service such as an online interface for performing machine learning model operations over a network on the server computing system 60). For example, the server computing system 60 may communicate with the computing device 50 via a local intranet or internet connection. For example, computing device 50 may be a workstation or endpoint communicating with server computing system 60, and embodiments of the machine learning model 65 are managed by server computing system 60 to perform inference remotely (e.g., at runtime or for training operations), with outputs returned to computing device 50 (e.g., cast, streamed, etc.). The machine learning model 65 can work collaboratively or interactively with machine learning model 55 on computing device 50 to perform various tasks.

[0429] A model development platform system 70 may include one or more processors 71 and a memory 72. The processor(s) 71 may be any suitable processing device (e.g., a processor core, microprocessor, ASIC, FPGA, controller, microcontroller, etc.) and may be one processor or multiple processors connected in an operable manner. The memory 72 may include one or more non-temporary computer-readable storage media such as HBM, RAM, ROM, EEPROM, EPROM, flash memory devices, magnetic disks, etc., and combinations thereof. The memory 72 can store data 73 and instructions 74, and the instructions 74 can be executed by the processor(s) 71 to cause the model development platform system(s) 70 to perform operations. The operations can perform any one or more features described herein. The operations can perform exemplary methods and techniques described herein. Exemplary operations include the functions described herein with respect to the model development platform 12. These functions and other functions can be implemented by developer tools 75.

[0430] A server computing system (or multiple systems) 80 may include one or more processors 81 and memory 82. A processor (or multiple systems) 81 may be any suitable processing device (e.g., a processor core, microprocessor, ASIC, FPGA, controller, microcontroller, etc.) and may be one processor or multiple processors connected in an operable manner. Memory 82 may include one or more non-temporary computer-readable storage media such as HBM, RAM, ROM, EEPROM, EPROM, flash memory devices, magnetic disks, etc., and combinations thereof. Memory 82 can store data 83 and instructions 84, and instructions 84 can be executed by a processor (or multiple systems) 81 to cause a third-party system (or multiple systems) 80 to perform an operation. The operation may perform any one or more of the features described herein. The operation may perform exemplary methods and techniques described herein. Exemplary operations include the functions described herein relating to tools and other external resources (e.g., third-party resources) 85 that are invoked when training or inferring using machine learning models 1, 4, 16, 20, 55, 65, etc.

[0431] Figure 39 shows one exemplary configuration of a computing system that can be used to implement this disclosure. Other computing system configurations can be used similarly. For example, in some embodiments, one or both of the computing system 50 or server computing system 60 can perform all or part of the operation of the model development platform system 70. For example, the computing system 50 or server computing system 60 can implement developer tools 75 (or extensions thereof) to develop, update / train, or improve machine learning models 1, 4, 16, 20, 55, 65, etc., using one or more techniques described herein with respect to the model alignment toolkit 17. Thus, for example, the computing system 50 or server computing system 60 can develop, update / train, or improve machine learning models based on local datasets (for example, for personalization / customization of the model, as permitted by user data preference selection).

[0432] Figure 40 is a block diagram of an exemplary computing device 98 implemented according to an exemplary embodiment of the present disclosure. The computing device 98 may be a user computing device or a server computing device (e.g., computing device 50, server computing system 60, etc.). The computing device 98 may implement a model host 31. For example, the computing device 98 may include several applications (e.g., applications 1 to N). Each application may include its own machine learning library and machine-trained models 1 or 1. For example, each application may include machine-trained models. Exemplary applications include a text messaging application, an email application, a dictation application, a virtual keyboard application, a browser application, etc. As shown in Figure 40, each application may communicate with several other components of the computing device, such as one or more sensors, a context manager, a device state component, or additional components. In some embodiments, each application may communicate with each device component using an API (e.g., a public API). In some embodiments, the API used by each application is specific to that application.

[0433] Figure 41 is a block diagram of an exemplary computing device 99 implemented according to an exemplary embodiment of the present disclosure. Computing device 99 may be the same as or different from computing device 98. Computing device 99 may be a user computing device or a server computing device (e.g., computing device 50, server computing system 60, etc.). Computing device 98 may implement a model host 31. For example, computing device 99 may include several applications (e.g., applications 1 to N). Each application may communicate with a central intelligence layer. Exemplary applications include a text messaging application, an email application, a dictation application, a virtual keyboard application, a browser application, etc. In some embodiments, each application may communicate with a central intelligence layer (and models stored therein) using an API (e.g., a common API across all applications).

[0434] The central intelligence layer may include several machine learning models. For example, as shown in Figure 41, each machine learning model may be provided by each application and managed by the central intelligence layer. In other embodiments, two or more applications may share a single machine learning model. For example, in some embodiments, the central intelligence layer may provide a single model to all applications. In some embodiments, the central intelligence layer may be contained within or otherwise implemented by the operating system of the computing device 99.

[0435] The central intelligence layer can communicate with the central device data layer. The central device data layer may be a centralized repository of data from the computing device 99. As shown in Figure 41, the central device data layer can communicate with several other components of the computing device, such as one or more sensors, a context manager, a device state component, or additional components. In some embodiments, the central device data layer can communicate with each device component using an API (e.g., a private API).

[0436] The technologies described herein refer to servers, databases, software applications, and other computer-based systems, as well as actions performed on such systems and information transmitted to and from such systems. The inherent flexibility of computer-based systems allows for a wide variety of feasible configurations, combinations, and divisions of tasks and functions between and across components. For example, the processes described herein can be performed using a single device or component, or multiple devices or components working together. Databases and applications may be implemented on a single system or distributed across multiple systems. Distributed components may operate sequentially or in parallel.

[0437] While the subject matter of this disclosure has been described in detail with respect to various specific exemplary embodiments, each example is provided for illustrative purposes only and does not limit the disclosure. Those skilled in the art will readily be able to understand the foregoing and create modifications, variations, and equivalents to such embodiments. Therefore, this disclosure does not exclude such modifications, variations, or additions to the subject matter of this disclosure that would be readily understood by those skilled in the art. For example, features illustrated or described as part of one embodiment can be used in conjunction with other embodiments to give rise to further embodiments. Therefore, this disclosure is intended to extend to such modifications, variations, and equivalents.

[0438] The aspects of this disclosure have been described in relation to their exemplary embodiments. Any and all of the following claims and features should not be construed as limiting the scope of possible combinations of features disclosed herein by the dependency of the exemplary claims enumerated herein, so that the combinations include combinations of claims not expressly enumerated, and can be combined or rearranged in any possible way. Therefore, the scope of this disclosure is illustrative and not limiting, and the disclosure of this subject matter does not preclude such modifications, variations, or additions to the subject matter, as would be readily apparent to those skilled in the art. Furthermore, terms are described herein using lists of exemplary elements joined by conjunctions such as “and,” “or,” and “but.” It should be understood that such conjunctions are provided for illustrative purposes only. For example, clauses and other sets of items joined by certain conjunctions such as “or” may refer to “and / or,” “at least one of,” “any combination of,” etc., with respect to the exemplary elements enumerated therein. Terms such as "based on" should be understood as "based at least in part on."

[0439] The term "can" should be understood as referring to the potential of features in various embodiments, and not as defining a capability that necessarily exists in all embodiments. For example, the phrase "X can do Y" should be understood as indicating that in various embodiments, X may be configured to do Y, and not as indicating that in all examples, X must always be able to do Y. It should be understood that in various embodiments, X may not be able to do Y and may remain within the scope of this disclosure.

[0440] The term "may" should be understood as referring to the possibility of features in various embodiments, and not as prescribing a capability that necessarily exists in all embodiments. For example, the phrase "X may do Y" should be understood as indicating that in various embodiments, X may be configured to do Y, and not as indicating that in all examples, X must always be able to do Y. It should be understood that in various embodiments, X may not be able to do Y and may remain within the scope of this disclosure.

Claims

1. A computer-implementable method for improving the parallelization of machine learning-based sequence processing models, To generate multiple output sequences corresponding to multiple input sequences, the system receives input requests for processing the multiple input sequences using a machine learning-based sequence processing model, The method involves generating a plurality of initial attention tensors for each of the plurality of input sequences, One or more initial attention tensors are generated in parallel across the input elements of each input sequence, for each input sequence. Each of the one or more initial attention tensors is generated in one or more batches having a first batch size using a prefill system, the prefill system comprising one or more prefill computing devices, and generating and executing one or more layers of the machine learning-based sequence processing model. The process includes using the plurality of initial attention tensors to autoregressively generate a plurality of output elements for each of the plurality of output sequences in one or more batches having a second batch size, A method wherein the plurality of output elements are generated using a generation system comprising one or more generation computing devices.

2. The method according to claim 1, wherein at least a portion of the machine learning-trained sequence processing model is divided across one or more generative computing devices along the batch dimension.

3. The method according to any one or more of claims 1 to 2, comprising orchestrating the input to the prefill system and the output from the generation system using a router system configured to receive the aforementioned input requests.

4. The method according to any one or more of claims 1 to 3, wherein at least one of the prefill computing devices is different from at least one of the generation computing devices.

5. The method according to any one or more of claims 1 to 4, wherein the prefill system is configured for a workflow having a computation bottleneck.

6. The method according to any one or more of claims 1 to 5, wherein the prefill system is configured with a lower memory bandwidth compared to the generation system.

7. The method according to any one or more of claims 1 to 6, wherein the generation system is configured for a workflow having a memory bandwidth bottleneck.

8. The method according to any one or more of claims 1 to 7, wherein the generation system includes a faster or higher bandwidth memory (HBM) compared to the prefill system.

9. The method according to any one or more of claims 1 to 8, wherein the generation system comprises a larger static random access memory compared to the prefill system.

10. The method according to any one or more of claims 1 to 9, wherein the generating computing device includes a higher memory bandwidth than the prefill computing device.

11. The method according to any one or more of claims 1 to 10, wherein the generation system implements more processing cores than the prefill system.

12. The method according to any one or more of claims 1 to 11, wherein the prefill system implements more processing cores than the generation system.

13. The method according to any one or more of claims 1 to 12, wherein the second batch size is larger than the first batch size.

14. The method according to any one or more of claims 1 to 13, wherein the first batch size is 1.

15. The method according to any one or more of claims 1 to 14, wherein each of the one or more initial attention tensors describes the relationships between each of the multiple input elements.

16. The above-mentioned multiple output elements are generated autoregressively, Using the generation system, the initial attention tensor is processed to determine the most likely next output element, Selecting the next most likely output element to include in the aforementioned output sequence, The initial attention tensor is updated based on the selected output elements, The method according to any one or more of claims 1 to 15, including the method described above.

17. The method according to any one or more of claims 1 to 16, comprising routing the input sequence to a first group of prefill computing devices that implement the machine learning sequence processing model, based on the length of the input sequence, wherein at least a portion of the machine learning sequence processing model is partitioned according to a weight-intensive partition layout.

18. The method according to any one or more of claims 1 to 17, comprising routing the input sequence to a second group of prefill computing devices that implement the machine-learned sequence processing model, based on the length of the input sequence, wherein at least a portion of the machine-learned sequence processing model is partitioned according to a weighted partition layout.

19. The method according to any one or more of claims 1 to 18, comprising routing the input sequence to a second group of prefill computing devices implementing the machine-learned sequence processing model based on the length of the input sequence, wherein at least a portion of the machine-learned sequence processing model is partitioned according to a hybrid partition layout in which weights are fixed along at least one parallelization axis and transmitted along at least one other parallelization axis.

20. If the length exceeds a threshold, the input sequence is routed to a second group of prefill computing devices implementing the machine learning sequence processing model, wherein at least a portion of the machine learning sequence processing model is routed according to a hybrid partition layout with a first number of axes through which weights are transmitted. or If the length falls below a threshold, the input sequence is routed to a second group of prefill computing devices implementing the machine learning sequence processing model, wherein at least a portion of the machine learning sequence processing model is routed according to a hybrid partition layout with a second number of axes through which weights are transmitted. The method according to any one or more of claims 1 to 19, wherein the first number is greater than the second number.

21. The method according to any one or more of claims 1 to 20, comprising selecting a first group of generating computing devices to generate the one or more output sequences based on the expected length of the one or more output sequences, wherein the first group of generating computing devices implements the machine learning sequence processing model, and at least a portion of the machine learning sequence processing model is partitioned according to a weight-intensive partition layout.

22. The method according to any one or more of claims 1 to 21, comprising selecting a second group of generating computing devices to generate the one or more output sequences based on the expected length of the one or more output sequences, wherein the second group of generating computing devices implements the machine learning sequence processing model, and at least a portion of the machine learning sequence processing model is partitioned according to a weighted partition layout.

23. The method according to any one or more of claims 1 to 22, comprising selecting a group of generating computing devices to generate the one or more output sequences based on the expected length of the one or more output sequences, the group of generating computing devices implementing the machine learning sequence processing model, and at least a portion of the machine learning sequence processing model being partitioned according to a hybrid partition layout in which weights are fixed along at least one parallelization axis and transmitted along at least one other parallelization axis.

24. If the expected length exceeds a threshold, select a group of generating computing devices to generate one or more output sequences, wherein the group of generating computing devices implements the machine learning sequence processing model, and at least a portion of the machine learning sequence processing model is partitioned according to a hybrid partition layout with a first number of axes through which weights are transmitted. or If the expected length is below a threshold, the selection includes selecting a group of generating computing devices to generate one or more output sequences, wherein the group of generating computing devices implements the machine learning sequence processing model, and at least a portion of the machine learning sequence processing model is partitioned according to a hybrid partition layout with a second number of axes through which weights are transmitted. The method according to any one or more of claims 1 to 23, wherein the first number is greater than the second number.

25. The method according to any one or more of claims 1 to 24, comprising implementing a weighted partition layout using a plurality of computing devices arranged in a three-dimensional toroidal configuration, wherein the number of chips along a first dimension is one-quarter of the number of chips in the product of the other two dimensions.

26. The method according to any one or more of claims 1 to 25, comprising implementing a weight-intensive partition layout using a plurality of computing devices arranged in a three-dimensional toroidal configuration, wherein the number of chips along a first dimension is one-quarter of the number of chips in the product of the other two dimensions.

27. The method according to any one or more of claims 1 to 26, comprising implementing a hybrid split layout in which both weights and activations are partially transmitted along different axes.

28. The method according to any one or more of claims 1 to 27, comprising sharing a weight layout between the fixed-weight layout and the weight-aggregated layout.

29. The feedforward network of the aforementioned machine learning-trained sequence processing model is Fixed-weight partition layout, Weight-intensive partition layout, or The method according to any one or more of claims 1 to 28, divided according to a combination thereof.

30. Determining the expected ratio of input elements to output elements, Based on the expected ratio of the input elements to the output elements, the ratio of the number of prefill computing devices to the number of decode servers of the generation computing devices is determined. A method according to any one or more of claims 1 to 29, including the method described above.

31. The method according to any one or more of claims 1 to 30, comprising routing processing tasks to a group of generating computing devices based on the buffer size and expected output length of the group of generating computing devices.

32. The method according to any one or more of claims 1 to 31, comprising shifting the processing task to a different group of generating computing devices with larger buffer sizes midway through completion if it is determined that the actual output length exceeds the expected output length.

33. This includes incrementally generating an initial attention tensor, and the generation is Receiving the preceding attention tensor, The incremental attention tensor components are computed in parallel for each incremental set of input elements, In order to obtain the initial attention tensor, the preceding attention tensor is combined with the incremental attention tensor component, The method according to any one or more of claims 1 to 32, as performed by...

34. The method according to any one or more of claims 1 to 33, wherein the initial attention tensor is acquired incrementally over one or more turns in a multi-turn content generation session.

35. The aforementioned multi-turn content generation session is Chat conversation, or The method according to any one or more of claims 1 to 34, comprising a series of instructions to a tool (e.g., an image generation tool, a text generation tool).

36. One or more non-temporary computer-readable media storing instructions that can be executed by one or more processors to cause a computing system to perform an operation, the operation being: One or more non-temporary computer-readable media comprising the method according to any one or more of claims 1 to 35.

37. A computing system, One or more processors, A computing system comprises one or more non-temporary computer-readable media that store instructions executable by one or more processors to cause the computing system to perform an operation, wherein the operation is A computing system comprising the method according to any one or more of claims 1 to 36.