Batch Inference in Azure Machine Learning

Published 05-26-2020 09:49 AM 3,539 Views
Microsoft

Today, we are announcing the general availability of Batch Inference in Azure Machine Learning service, a new solution called ParallelRunStep that allows customers to get inferences for terabytes of structured or unstructured data using the power of the cloud. ParallelRunStep provides parallelism out of the box and makes it extremely easy to scale fire-and-forget inference to large clusters of machines, thereby increasing development productivity and decreasing end-to-end cost.

 

Batch inference is now being widely applied to businesses, whether to segment customers, forecast sales, predict customer behaviors, predict maintenance, or improve cyber security. It is the process of generating predictions on a high volume of instances without the need of instant responses. The predictions are stored and accessible for further usage. Often times, data scientists and engineers want to generate many predictions at once. But it’s challenging to take advantage of scalable compute resource to parallelize the large workload to achieve this. For example, how to partition the large amounts of input data? How to distribute and coordinate workloads across a cluster of machines? How to consolidate the output results? How to manage the machine cluster to avoid unnecessary cost? What if a task fails or machine dies?

 

ParallelRunStep, the new solution we provide for batch inference, handles all these for you. It simplifies scaling up and out large machine learning workloads so data scientists and engineers can spend less time developing computer programs and focus on business objectives.

 

ParallelRunStep includes capabilities that enable parallel processing and easy management of your large workloads:

  • Managed stack with out-of-the-box parallelism
  • Resiliency with failure tolerance
  • Fully composable with Azure Machine Learning Pipelines
  • Flexible design for a variety of workloads

 

Managed stack with out-of-the-box parallelism

ParallelRunStep is a managed stack with out-of-the-box parallelism. You only need to provide full data inputs, scoring script, and necessary configures, the left will be taken care of.

 

tracych_0-1590463172382.png

 

Partition input data

Let’s start with input data partitioning. You have 10K invoices to be extracted using your form recognizer model. To parallelize the workload, you want to combine 10 invoices as a mini batch and send to one machine for execution. You will have 1000 mini batches in total. In another use case, you have a 5GB csv file containing customer data to predict churn score per each record. You need to split the big file into smaller ones for parallel processing. For example, 500 files with the size of 10MB for each. With ParallelRunStep, you can easily achieve both above partition strategy.

 

ParallelRunStep accepts data inputs through Azure Machine Learning datasets. Dataset is a resource for exploring, transforming, and managing data. Partition your data by setting the mini batch size and leveraging the two types of dataset.

 

FileDataset represents single or multiple files with any format. For the invoice extraction case, use FileDataset and define mini batch size as 10 will automatically partition the workload into 1000 mini batches.

 

TabularDataset represents data in a tabular format by parsing the provided file or list of files. It can be created from csv, tsv, parquet files, SQL query results, etc. For the churn score calculation case, use TabularDataset and specify mini batch size as 10MB to get 500 mini batch workloads created.

 

Distribute workloads to managed machine cluster

After the entire input data is partitioned into multiple mini batches, ParallelRunStep distributes the mini batch workloads to a managed Azure Machine Learning compute cluster.

 

The Azure Machine Learning compute cluster is created and managed by Azure Machine Learning. It can be auto scaled each time you run a job. Such autoscaling ensures that machines are shut down when your job is completed to save your cost. It supports for both CPU and GPU resources. You can also choose low priority virtual machines to save resources for other latency sensitive jobs and reduce your costs further.

 

One mini batch workload will be sent to one compute node for execution. The more compute nodes you use, the more parallelism you will get. Execution efficiency for each mini batch workload is determined by the power of the compute node.

 

Consolidate the results

Processed results from each mini batch workload are collected, stored, and made available to you for further analysis. You will also get a job run summary and a performance report.

 

Resiliency with failure tolerance

ParallelRunStep is a resilient and highly available solution. While the system manages the strategy, you also have the control of when to timeout your job, how many times to retry and how many errors to tolerant.

 

Timeout setting is provided per mini batch workload invocation. You can tune this timeout properly to fail fast and avoid waiting forever in case of failures.

 

Automatic retry is embedded.The system by default retries three times for each mini batch workload if it fails and you can customize the max retry count. Even with several failed mini batch workloads, you can still get the partial results from other successful mini batch workloads.

 

You can control how many errors to tolerant through the error threshold configure. It’s defined as the number of files or records processing errors the entire job can tolerant. When the error threshold is reached, your job will be terminated. You can also choose to ignore all errors and allow your job to process all inputs.

 

Fully composable in Azure Machine Learning Pipelines

ParallelRunStep is available through Azure Machine Learning pipelines. Pipelines are constructed from multiple steps, which are distinct computational units in the pipeline. ParallelRunStep is one of such steps. Existing Azure ML Pipeline customers can easily add or switch to ParallelRunStep to run batch inference.

 

A pipeline is reusable after it is designed and published. Defining the input dataset or parameters as the type PipelineParameter gives you the ability to use dynamic input for each run, and fine tune your pipeline for better performance.

 

You can run a pipeline on recurring schedule based on elapsed time, or on data changes. For example, if you want to get a monthly customer churn score, you can create a time-based schedule to kick off your batch inference job every month. 

 

Flexible design for a variety of workloads

ParallelRunStep is flexibly designed for a variety of workloads. It’s not just for batch inference, but also other workloads which necessitate parallel processing, e.g. training many models concurrently, or processing large amount of data.

 

Get started

Get started with Azure Machine Learning for free today!

 

Learn more:

%3CLINGO-SUB%20id%3D%22lingo-sub-1417010%22%20slang%3D%22en-US%22%3EBatch%20Inference%20in%20Azure%20Machine%20Learning%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1417010%22%20slang%3D%22en-US%22%3E%3CP%3EToday%2C%20we%20are%20announcing%20the%20general%20availability%20of%26nbsp%3BBatch%20Inference%20in%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fmachine-learning-service%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Machine%20Learning%20service%3C%2FA%3E%2C%20a%20new%20solution%20called%20ParallelRunStep%20that%20allows%20customers%20to%20get%20inferences%20for%20terabytes%20of%20structured%20or%20unstructured%20data%20using%20the%20power%20of%20the%20cloud.%20ParallelRunStep%20provides%20parallelism%20out%20of%20the%20box%20and%20makes%20it%20extremely%20easy%20to%20scale%20fire-and-forget%20inference%20to%20large%20clusters%20of%20machines%2C%20thereby%20increasing%20development%20productivity%20and%20decreasing%20end-to-end%20cost.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBatch%20inference%20is%20now%20being%20widely%20applied%20to%20businesses%2C%20whether%20to%20segment%20customers%2C%20forecast%20sales%2C%20predict%20customer%20behaviors%2C%20predict%20maintenance%2C%20or%20improve%20cyber%20security.%20It%20is%20the%20process%20of%20generating%20predictions%20on%20a%20high%20volume%20of%20instances%20without%20the%20need%20of%20instant%20responses.%20The%20predictions%20are%20stored%20and%20accessible%20for%20further%20usage.%20Often%20times%2C%20data%20scientists%20and%20engineers%20want%20to%20generate%20many%20predictions%20at%20once.%20But%20it%E2%80%99s%20challenging%20to%20take%20advantage%20of%20scalable%20compute%20resource%20to%20parallelize%20the%20large%20workload%20to%20achieve%20this.%20For%20example%2C%20how%20to%20partition%20the%20large%20amounts%20of%20input%20data%3F%20How%20to%20distribute%20and%20coordinate%20workloads%20across%20a%20cluster%20of%20machines%3F%20How%20to%20consolidate%20the%20output%20results%3F%20How%20to%20manage%20the%20machine%20cluster%20to%20avoid%20unnecessary%20cost%3F%20What%20if%20a%20task%20fails%20or%20machine%20dies%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EParallelRunStep%2C%20the%20new%20solution%20we%20provide%20for%20batch%20inference%2C%20handles%20all%20these%20for%20you.%20It%20simplifies%20scaling%20up%20and%20out%20large%20machine%20learning%20workloads%20so%20data%20scientists%20and%20engineers%20can%20spend%20less%20time%20developing%20computer%20programs%20and%20focus%20on%20business%20objectives.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EParallelRunStep%20includes%20capabilities%20that%20enable%20parallel%20processing%20and%20easy%20management%20of%20your%20large%20workloads%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EManaged%20stack%20with%20out-of-the-box%20parallelism%3C%2FLI%3E%0A%3CLI%3EResiliency%20with%20failure%20tolerance%3C%2FLI%3E%0A%3CLI%3EFully%20composable%20with%20Azure%20Machine%20Learning%20Pipelines%3C%2FLI%3E%0A%3CLI%3EFlexible%20design%20for%20a%20variety%20of%20workloads%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1329446836%22%20id%3D%22toc-hId--1329446842%22%3EManaged%20stack%20with%20out-of-the-box%20parallelism%3C%2FH2%3E%0A%3CP%3EParallelRunStep%20is%20a%20managed%20stack%20with%20out-of-the-box%20parallelism.%20You%20only%20need%20to%20provide%20full%20data%20inputs%2C%20scoring%20script%2C%20and%20necessary%20configures%2C%20the%20left%20will%20be%20taken%20care%20of.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22tracych_0-1590463172382.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194350iFEB6A19912D2FF05%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22tracych_0-1590463172382.png%22%20alt%3D%22tracych_0-1590463172382.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--638885362%22%20id%3D%22toc-hId--638885368%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22toc-hId-1848627471%22%20id%3D%22toc-hId-1848627465%22%3EPartition%20input%20data%3C%2FH3%3E%0A%3CP%3ELet%E2%80%99s%20start%20with%20input%20data%20partitioning.%20You%20have%2010K%20invoices%20to%20be%20extracted%20using%20your%20form%20recognizer%20model.%20To%20parallelize%20the%20workload%2C%20you%20want%20to%20combine%2010%20invoices%20as%20a%20mini%20batch%20and%20send%20to%20one%20machine%20for%20execution.%20You%20will%20have%201000%20mini%20batches%20in%20total.%20In%20another%20use%20case%2C%20you%20have%20a%205GB%20csv%20file%20containing%20customer%20data%20to%20predict%20churn%20score%20per%20each%20record.%20You%20need%20to%20split%20the%20big%20file%20into%20smaller%20ones%20for%20parallel%20processing.%20For%20example%2C%20500%20files%20with%20the%20size%20of%2010MB%20for%20each.%20With%20ParallelRunStep%2C%20you%20can%20easily%20achieve%20both%20above%20partition%20strategy.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EParallelRunStep%20accepts%20data%20inputs%20through%20Azure%20Machine%20Learning%20datasets.%20Dataset%20is%20a%20resource%20for%20exploring%2C%20transforming%2C%20and%20managing%20data.%20Partition%20your%20data%20by%20setting%20the%20mini%20batch%20size%20and%20leveraging%20the%20two%20types%20of%20dataset.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFileDataset%20represents%20single%20or%20multiple%20files%20with%20any%20format.%20For%20the%20invoice%20extraction%20case%2C%20use%20FileDataset%20and%20define%20mini%20batch%20size%20as%2010%20will%20automatically%20partition%20the%20workload%20into%201000%20mini%20batches.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETabularDataset%20represents%20data%20in%20a%20tabular%20format%20by%20parsing%20the%20provided%20file%20or%20list%20of%20files.%20It%20can%20be%20created%20from%20csv%2C%20tsv%2C%20parquet%20files%2C%20SQL%20query%20results%2C%20etc.%20For%20the%20churn%20score%20calculation%20case%2C%20use%20TabularDataset%20and%20specify%20mini%20batch%20size%20as%2010MB%20to%20get%20500%20mini%20batch%20workloads%20created.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-41173008%22%20id%3D%22toc-hId-41173002%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22toc-hId--1766281455%22%20id%3D%22toc-hId--1766281461%22%3EDistribute%20workloads%20to%20managed%20machine%20cluster%3C%2FH3%3E%0A%3CP%3EAfter%20the%20entire%20input%20data%20is%20partitioned%20into%20multiple%20mini%20batches%2C%20ParallelRunStep%20distributes%20the%20mini%20batch%20workloads%20to%20a%20managed%20Azure%20Machine%20Learning%20compute%20cluster.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20Azure%20Machine%20Learning%20compute%20cluster%20is%20created%20and%20managed%20by%20Azure%20Machine%20Learning.%20It%20can%20be%20auto%20scaled%20each%20time%20you%20run%20a%20job.%20Such%20autoscaling%20ensures%20that%20machines%20are%20shut%20down%20when%20your%20job%20is%20completed%20to%20save%20your%20cost.%20It%20supports%20for%20both%20CPU%20and%20GPU%20resources.%20You%20can%20also%20choose%20low%20priority%20virtual%20machines%20to%20save%20resources%20for%20other%20latency%20sensitive%20jobs%20and%20reduce%20your%20costs%20further.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOne%20mini%20batch%20workload%20will%20be%20sent%20to%20one%20compute%20node%20for%20execution.%20The%20more%20compute%20nodes%20you%20use%2C%20the%20more%20parallelism%20you%20will%20get.%20Execution%20efficiency%20for%20each%20mini%20batch%20workload%20is%20determined%20by%20the%20power%20of%20the%20compute%20node.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-721231378%22%20id%3D%22toc-hId-721231372%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22toc-hId--1086223085%22%20id%3D%22toc-hId--1086223091%22%3EConsolidate%20the%20results%3C%2FH3%3E%0A%3CP%3EProcessed%20results%20from%20each%20mini%20batch%20workload%20are%20collected%2C%20stored%2C%20and%20made%20available%20to%20you%20for%20further%20analysis.%20You%20will%20also%20get%20a%20job%20run%20summary%20and%20a%20performance%20report.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1096726189%22%20id%3D%22toc-hId--1096726195%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId-1390786644%22%20id%3D%22toc-hId-1390786638%22%3EResiliency%20with%20failure%20tolerance%3C%2FH2%3E%0A%3CP%3EParallelRunStep%20is%20a%20resilient%20and%20highly%20available%20solution.%20While%20the%20system%20manages%20the%20strategy%2C%20you%20also%20have%20the%20control%20of%20when%20to%20timeout%20your%20job%2C%20how%20many%20times%20to%20retry%20and%20how%20many%20errors%20to%20tolerant.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETimeout%20setting%20is%20provided%20per%20mini%20batch%20workload%20invocation.%20You%20can%20tune%20this%20timeout%20properly%20to%20fail%20fast%20and%20avoid%20waiting%20forever%20in%20case%20of%20failures.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAutomatic%20retry%20is%20embedded.The%20system%20by%20default%20retries%20three%20times%20for%20each%20mini%20batch%20workload%20if%20it%20fails%20and%20you%20can%20customize%20the%20max%20retry%20count.%20Even%20with%20several%20failed%20mini%20batch%20workloads%2C%20you%20can%20still%20get%20the%20partial%20results%20from%20other%20successful%20mini%20batch%20workloads.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20control%20how%20many%20errors%20to%20tolerant%20through%20the%20error%20threshold%20configure.%20It%E2%80%99s%20defined%20as%20the%20number%20of%20files%20or%20records%20processing%20errors%20the%20entire%20job%20can%20tolerant.%20When%20the%20error%20threshold%20is%20reached%2C%20your%20job%20will%20be%20terminated.%20You%20can%20also%20choose%20to%20ignore%20all%20errors%20and%20allow%20your%20job%20to%20process%20all%20inputs.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--416667819%22%20id%3D%22toc-hId--416667825%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId--550352543%22%20id%3D%22toc-hId--550352549%22%3EFully%20composable%20in%20Azure%20Machine%20Learning%20Pipelines%3C%2FH2%3E%0A%3CP%3EParallelRunStep%20is%20available%20through%20Azure%20Machine%20Learning%20pipelines.%20Pipelines%20are%20constructed%20from%20multiple%20steps%2C%20which%20are%20distinct%20computational%20units%20in%20the%20pipeline.%20ParallelRunStep%20is%20one%20of%20such%20steps.%20Existing%20Azure%20ML%20Pipeline%20customers%20can%20easily%20add%20or%20switch%20to%20ParallelRunStep%20to%20run%20batch%20inference.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EA%20pipeline%20is%20reusable%20after%20it%20is%20designed%20and%20published.%20Defining%20the%20input%20dataset%20or%20parameters%20as%20the%20type%20PipelineParameter%20gives%20you%20the%20ability%20to%20use%20dynamic%20input%20for%20each%20run%2C%20and%20fine%20tune%20your%20pipeline%20for%20better%20performance.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20run%20a%20pipeline%20on%20recurring%20schedule%20based%20on%20elapsed%20time%2C%20or%20on%20data%20changes.%20For%20example%2C%20if%20you%20want%20to%20get%20a%20monthly%20customer%20churn%20score%2C%20you%20can%20create%20a%20time-based%20schedule%20to%20kick%20off%20your%20batch%20inference%20job%20every%20month.%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1937160290%22%20id%3D%22toc-hId-1937160284%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId-129705827%22%20id%3D%22toc-hId-129705821%22%3EFlexible%20design%20for%20a%20variety%20of%20workloads%3C%2FH2%3E%0A%3CP%3EParallelRunStep%20is%20flexibly%20designed%20for%20a%20variety%20of%20workloads.%20It%E2%80%99s%20not%20just%20for%20batch%20inference%2C%20but%20also%20other%20workloads%20which%20necessitate%20parallel%20processing%2C%20e.g.%20training%20many%20models%20concurrently%2C%20or%20processing%20large%20amount%20of%20data.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1677748636%22%20id%3D%22toc-hId--1677748642%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId-809764197%22%20id%3D%22toc-hId-809764191%22%3EGet%20started%3C%2FH2%3E%0A%3CP%3EGet%20started%20with%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Ffree%2Fai%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Machine%20Learning%3C%2FA%3E%20for%20free%20today!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELearn%20more%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fmachine-learning%2Fhow-to-use-parallel-run-step%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EHow%20to%20use%20ParallelRunStep%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Faka.ms%2Fbatch-inference-notebooks%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ESample%20notebooks%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fchannel9.msdn.com%2FShows%2FAI-Show%2FHow-to-do-Batch-Inference-using-AML-ParallelRunStep%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAI%20Show%3A%20How%20to%20do%20Batch%20Inference%20using%20AML%20ParallelRunStep%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1417010%22%20slang%3D%22en-US%22%3E%3CP%3ELearn%20about%20the%20new%20Batch%20Inference%20capabilities%20in%20Azure%20Machine%20Learning%2C%20now%20generally%20available!%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1417010%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Machine%20Learning%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMachine%20Learning%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎May 26 2020 09:48 AM
Updated by: