Transformations > Machine Learning transformation > Configuring bulk requests
  

Configuring bulk requests

Configure bulk requests to optimize performance by combining multiple requests into one request that the Machine Learning transformation sends to the machine learning model. Bulk requests can improve performance by reducing processing overhead and the amount of time that it takes to communicate with the model.
To create a bulk request, the Machine Learning transformation selects the highest-level array field in the request schema. In the JSON request body for the bulk request, the transformation combines request rows as elements of the selected array field so that one JSON request body contains data for multiple requests. You can configure bulk request options to determine how much data each bulk request contains.
For example, the request schema might have the following structure:
The request schema contains a struct called instances. The instances struct contains a nested array called data which contains another nested array called features.
The Machine Learning transformation selects the data array as the highest-level array field to combine requests. If you configure each bulk request to send 2 MB of data to the machine learning model, the Machine Learning transformation configures the data array in the JSON request body to include data for 2 MB of request rows.
The highest-level array cannot have sibling array fields. If the highest-level array has a sibling field of a primitive data type, the data in the sibling field will not be combined. Instead, one random record in the sibling field will be sent to the machine learning model.
To create a bulk response, the machine learning endpoint must combine response rows as elements of the highest-level array in the response schema. The Machine Learning transformation parses the array into output rows. Review the bulk request options to verify which field the Machine Learning transformation will parse.
To use bulk requests in the Machine Learning transformation, the machine learning endpoint must be configured to accept bulk requests and send bulk responses.

Bulk request options

Bulk request options determine the fields that the Machine Learning transformation uses to combine requests and parse responses. They also determine how much data each bulk request contains.
The following table describes the bulk request options:
Option
Description
Combine Requests on Field
The transformation combines request rows as elements of this array field and sends one request to the machine learning model. The request schema determines this field automatically.
Request Size
Maximum size of each request. To choose a size, consult the best practices on your machine learning platform.
Parse Requests on Field
The machine learning endpoint combines response rows as elements of this array field. Then, the transformation parses the array into output rows. The response schema determines this field automatically.