Cloud Computing for AI

Chapter 6
Cloud AI Platforms and Model Development

Bachelors Program in AI & ML
Cloud Computing for AI   •   Bachelor

Cloud AI Platforms and Model Development

Introduction and Context

Cloud AI platforms provide managed infrastructure, software tools, and services for developing, training, deploying, and monitoring machine-learning (ML) systems. They have changed AI development from an activity requiring ownership of specialised hardware and complex software stacks into a service-oriented process. A student or organisation can now obtain a notebook, prepare data, train a model on accelerators, expose predictions through an application programming interface (API), and monitor the system using a cloud console or software development kit (SDK).

The major cloud providers offer broadly similar capabilities, although their interfaces, pricing models, regional availability, security controls, and proprietary services differ. Typical platform components include object storage, managed notebooks, data-processing services, distributed-training frameworks, model registries, feature stores, deployment endpoints, monitoring systems, AutoML tools, and foundation-model services.

Cloud platforms do not remove the need for technical judgement. A managed service can reduce operational work but may restrict portability, obscure system behaviour, or create unexpected costs. Therefore, professional AI developers must evaluate not only model accuracy but also performance, reliability, governance, security, cost, and vendor dependence.

Learning Objectives

By the end of this chapter, students should be able to:

1. Explain the architecture and purpose of managed cloud AI platforms.

2. Describe the roles of notebooks, pipelines, model registries, endpoints, and monitoring.

3. Distinguish single-node, distributed, and accelerator-based training.

4. Compare pretrained models, foundation-model services, AutoML, and custom development.

5. Apply build-versus-buy reasoning to an AI project.

6. Evaluate cloud AI solutions using performance, cost, portability, and governance criteria.

7. Identify risks associated with vendor dependence, data protection, and responsible AI.

1. The Managed AI Platform Model

A cloud AI platform is best understood as a layered system rather than a single product.

1.1 Infrastructure layer

This layer supplies virtual machines, containers, CPUs, GPUs, tensor-processing units, high-performance networks, disks, and object storage. Users generally rent these resources rather than purchase them. Elastic provisioning allows capacity to increase during training and decrease afterwards.

1.2 Data and engineering layer

Services in this layer support data ingestion, storage, transformation, labelling, feature computation, data-quality checks, and access control. Object storage is often used for large datasets and model artefacts, while databases or data warehouses support structured analytical data.

1.3 Development and training layer

Managed notebooks provide interactive environments containing languages such as Python, libraries, experiment tools, and access to cloud resources. Training services package code and data into repeatable jobs. They may support frameworks such as PyTorch, TensorFlow, scikit-learn, XGBoost, or custom containers.

1.4 Model-management layer

A model registry records model versions, metadata, evaluation results, approval status, and deployment history. It supports reproducibility and controlled promotion from development to production.

1.5 Serving and operations layer

A trained model may be deployed as a real-time endpoint, batch job, embedded application, or edge artefact. Monitoring systems collect operational indicators such as latency, error rate, throughput, resource utilisation, prediction distributions, and data drift.

This architecture supports a machine-learning lifecycle:

data preparation → experimentation → training → evaluation → registration → deployment → monitoring → retraining or retirement

The lifecycle is not necessarily linear. Monitoring may reveal drift, fairness problems, or performance degradation, causing the team to revise the data or model.

2. Managed Notebooks and Reproducible Development

A cloud notebook combines executable code, documentation, visualisations, and outputs. It is valuable during exploration because a developer can inspect data, test a preprocessing operation, plot results, and compare models interactively.

However, notebooks also create risks. Execution order can become unclear, hidden state can influence results, dependencies may be installed manually, and sensitive data may be copied into outputs. A notebook that works for its author may fail on a production system.

Professional practice separates exploration from production:

  • Use notebooks for investigation and communication.
  • Move stable logic into version-controlled modules and pipelines.
  • Record package versions, container images, data versions, random seeds, and configuration values.
  • Avoid storing credentials in notebook code.
  • Shut down idle compute resources.
  • Restrict access to sensitive datasets and notebook instances.

Reproducibility has several dimensions. Computational reproducibility means that the same code and environment can be executed again. Statistical reproducibility means that results remain comparable despite randomness in sampling or optimisation. Operational reproducibility means that the training and deployment process can be repeated through automation.

A useful experiment record includes the dataset identifier, feature-processing version, model code, hyperparameters, hardware type, training duration, evaluation metrics, and software environment. Experiment-tracking tools can record these automatically.

3. Training Models in the Cloud

3.1 Single-node training

For small and moderate datasets, a single virtual machine may be sufficient. This approach is simple and often easiest to debug. It can use CPUs for many classical models or GPUs for neural networks and other parallel workloads.

The main advantages are low coordination overhead and straightforward implementation. Limitations include restricted memory, finite compute capacity, and possible underutilisation of expensive accelerators.

3.2 Distributed training

Distributed training divides computation across multiple devices or machines. In data parallelism, each worker receives a copy of the model but processes a different mini-batch. Workers then exchange gradients or parameter updates. In model parallelism, different portions of a large model are placed on different devices. Hybrid approaches combine both methods.

For synchronous data-parallel training, workers generally perform the following cycle:

1. Read a different mini-batch.

2. Compute a local loss and gradient.

3. Communicate gradients, often through an all-reduce operation.

4. Apply a consistent parameter update.

5. Continue to the next mini-batch.

The ideal speedup from using multiple workers is not fully achieved because communication, data loading, coordination, and unequal workloads introduce overhead. A simplified performance model is:

\[

T_{parallel} \approx T_{compute} + T_{communication} + T_{input} + T_{coordination}

\]

Here, each term represents elapsed time for computation, inter-worker communication, input processing, and coordination. The equation is a conceptual decomposition, not a universal prediction formula; the terms may overlap in real systems.

A common measure is speedup:

\[

S(n)=\frac{T_1}{T_n}

\]

where \(T_1\) is the training time using one worker and \(T_n\) is the time using \(n\) workers under comparable conditions. If one worker requires 10 hours and four workers require 3 hours, speedup is \(10/3\approx3.33\), not 4. The parallel efficiency is:

\[

E(n)=\frac{S(n)}{n}

\]

Thus, the example has efficiency \(3.33/4\approx0.83\), or 83%. These measures assume that the training task, convergence criterion, data, and quality target are comparable.

3.3 Accelerators

GPUs are effective for operations that can be performed in parallel, especially matrix multiplication and tensor operations. Cloud providers may also offer specialised accelerators designed for neural-network workloads. The choice depends on model architecture, batch size, memory requirements, software support, availability, and price.

An accelerator is not automatically beneficial. Data-loading bottlenecks, small models, unsupported operations, or excessive communication can cause a GPU to be poorly utilised. Developers should measure utilisation and end-to-end throughput rather than selecting hardware solely by theoretical peak performance.

3.4 Distributed-training risks

Distributed jobs introduce failure modes such as worker loss, network congestion, inconsistent software environments, and checkpoint corruption. Practical controls include:

  • periodic checkpoints;
  • automatic retry policies;
  • deterministic or controlled data partitioning;
  • compatible library and driver versions;
  • monitoring of worker health and accelerator utilisation; and
  • validation that scaling improves useful throughput rather than only resource consumption.

4. Pretrained Models, Foundation Models, and AutoML

4.1 Pretrained models

A pretrained model has learned representations or parameters from a previous dataset and can be adapted to a new task. Examples include image encoders, speech-recognition models, language encoders, and embedding models. Transfer learning often reduces data and training requirements.

Adaptation strategies include:

  • using the model as a fixed feature extractor;
  • fine-tuning selected layers;
  • fine-tuning the complete model; and
  • adding a task-specific prediction head.

The choice depends on dataset size, similarity between source and target domains, compute budget, and risk of overfitting.

4.2 Foundation-model services

Foundation models are large models trained on broad datasets and adapted to many tasks. Cloud services may provide access through an API, a hosted model, or a platform for fine-tuning and retrieval-augmented generation (RAG). A foundation-model service may provide text generation, embeddings, summarisation, image generation, speech processing, or code assistance.

Using such a service can accelerate development, but the organisation may have limited control over model updates, training data, internal representations, safety filters, output latency, and geographic processing location. API contracts and model-version policies must therefore be examined carefully.

RAG combines a language model with an external retrieval system. Relevant documents are retrieved and supplied as context to the model. This can improve access to organisation-specific information without retraining the entire model. It does not guarantee truth: poor retrieval, incomplete documents, or ambiguous prompts can still produce incorrect outputs.

4.3 AutoML

AutoML automates some model-development tasks, such as data preparation suggestions, feature selection, algorithm selection, hyperparameter search, and deployment. It is useful when a team lacks specialised expertise or needs a strong baseline quickly.

AutoML does not eliminate the need for domain knowledge. The user remains responsible for defining the prediction target, preventing leakage, selecting appropriate evaluation metrics, validating fairness, interpreting errors, and determining whether the model is suitable for operational use. An automated search can optimise a metric while producing a system that is costly, opaque, or unsuitable under real-world conditions.

5. Model Deployment and Serving Patterns

A model can be delivered in several ways.

Online inference provides a response to an individual request, typically with a latency objective. It is appropriate for fraud screening, recommendations, conversational applications, and interactive prediction.

Batch inference processes many records at scheduled intervals. It is often cheaper and simpler when immediate responses are unnecessary, such as monthly risk scoring or overnight image classification.

Streaming inference processes events continuously. It requires event handling, state management, and careful treatment of late or duplicated messages.

Edge or embedded inference places the model near the data source, reducing network latency and supporting operation with limited connectivity. It may require model compression, quantisation, or hardware-specific optimisation.

Important serving metrics include latency, throughput, availability, error rate, and cost per prediction. The relevant latency statistic is not only the average; high percentiles such as p95 or p99 can reveal poor experiences for a minority of users.

A deployment should separate model code from configuration, support rollback to a known version, and use staged release methods such as shadow testing, canary deployment, or blue-green deployment. A shadow deployment receives production traffic but does not influence user outcomes, allowing comparison before full release.

6. Evaluating Cloud AI Platforms

A platform decision should be based on the complete system rather than a single feature.

Capability and performance

Evaluate supported frameworks, accelerator availability, data locality, training time, inference latency, throughput, reliability, and maximum model size. Benchmark using representative data and realistic workloads. A vendor’s advertised hardware performance may not predict application performance.

Cost

Cloud cost commonly includes compute time, storage, data transfer, managed-service charges, endpoint uptime, API calls, and monitoring. A simple estimate for a training run is:

\[

C_{training}=r \times t \times k + C_{storage}+C_{transfer}+C_{services}

\]

where \(r\) is the hourly price per resource unit, \(t\) is runtime in hours, \(k\) is the number of resource units, and the remaining terms represent other charges. This estimate assumes a constant price and resource allocation; actual bills may include discounts, tiered rates, licensing, and ancillary services.

For example, a four-accelerator job running for 6 hours at $2.00 per accelerator-hour has direct accelerator cost:

\[

4\times6\times\$2.00=\$48.

\]

This is not the total project cost because storage, CPUs, data transfer, engineering labour, failed runs, and deployment must also be included.

Portability

Portability is the ability to move data, code, models, and workflows between environments. It is improved by open formats, containers, standard ML frameworks, portable orchestration, infrastructure-as-code, and independent experiment metadata.

Portability is never purely technical. Data-residency rules, network architecture, service-level agreements, staff skills, and migration costs also affect practical portability.

Vendor dependence

Vendor dependence, or lock-in, occurs when migration becomes difficult or expensive. It can result from proprietary APIs, platform-specific model formats, exclusive accelerator support, unique identity systems, managed databases, or accumulated operational knowledge.

Lock-in is not always undesirable. A proprietary service may offer superior performance, safety controls, or productivity. The appropriate question is whether the benefit justifies the switching risk. Organisations should identify exit requirements, export data and model artefacts where possible, document dependencies, and periodically test an alternative deployment path.

7. Build-versus-Buy Analysis

The build-versus-buy decision compares developing and operating a capability internally with purchasing or consuming an external service. A third option, adapt, uses a purchased base model or platform but adds organisation-specific data and logic.

Relevant criteria include:

  • strategic importance and differentiation;
  • availability of internal expertise;
  • data sensitivity and regulatory constraints;
  • required control and explainability;
  • expected demand and scale;
  • time to market;
  • total cost of ownership;
  • integration complexity;
  • reliability and support requirements; and
  • exit and portability risk.

A purchased API is often appropriate for a general capability that is not a source of competitive advantage. Building may be justified when the model is central to the product, the data is highly specialised, requirements are unusual, or long-term unit economics favour ownership. Adapting a pretrained or foundation model is often a middle path.

The analysis should include hidden costs. Buying may involve API charges, data-transfer fees, provider changes, and contractual restrictions. Building may involve recruitment, hardware, MLOps, security, model evaluation, and continuous maintenance. A low initial purchase price does not necessarily mean low total cost.

8. Illustrative Case: Cloud-Based Defect Detection

Background

A fictional manufacturer, Northstar Components, inspects metal parts using cameras. Human inspectors currently identify surface defects, but inspection speed and consistency vary between shifts.

Problem

The company needs a system that classifies images as acceptable or defective. It has 180,000 labelled images, strict confidentiality requirements, and a target of less than 200 milliseconds for an online decision. The team includes software engineers but only one ML specialist.

Analysis

A fully custom computer-vision model would provide control but would require substantial experimentation and maintenance. A generic external vision API could be deployed quickly, but sending factory images to an external service raises confidentiality and data-residency concerns. An internal AutoML or transfer-learning service offers a compromise.

The team first creates a representative validation set containing different lighting conditions, production lines, materials, and defect types. It measures precision and recall by defect category rather than relying only on overall accuracy. This is important because a rare but dangerous defect may be hidden by a high overall accuracy score.

Approach and solution

The team uses a managed notebook for exploration, stores images in a controlled object-storage bucket, and trains a transfer-learning image classifier on a private accelerator job. Training code is moved into a version-controlled container. A model registry records the dataset version, image-processing code, metrics, and approval decision.

The model is deployed to a private endpoint near the production data source. A canary release sends a small fraction of decisions to the model while inspectors continue to make the official decision. Predictions and confidence scores are logged, but images are retained only according to the company’s approved policy. Monitoring checks latency, image-quality failures, class distribution, and disagreement with inspectors.

Outcome

The pilot meets the latency target and reduces routine inspection workload. However, monitoring reveals lower recall for a newly introduced material. The model is not declared universally reliable; instead, the deployment is restricted to approved product lines, and a retraining process is created.

Learning points

The successful result depended on more than selecting a model. Data representativeness, private deployment, human oversight, versioning, monitoring, and a controlled rollout were equally important. The case also demonstrates that a model’s performance is conditional on its operating environment.

9. Governance, Ethics, and Regulation

Cloud AI systems process data across organisational and sometimes national boundaries. Governance should address data classification, lawful processing, retention, access control, encryption, audit logs, incident response, and deletion. Sensitive personal data may require additional safeguards, contractual controls, or prohibited-use analysis.

Responsible AI evaluation should consider bias, explainability, human oversight, misuse, accessibility, and security. Foundation-model applications require additional controls for prompt injection, data leakage, fabricated outputs, unsafe content, and unauthorised tool use. Outputs should not be treated as reliable merely because they are fluent.

Model cards, data documentation, risk assessments, and approval gates improve accountability. A production system should identify an owner, define acceptable use, record limitations, and specify what happens when the model is uncertain or unavailable.

Regulatory obligations vary by jurisdiction and application. High-impact uses such as employment, credit, healthcare, education, or public services may require stronger documentation, transparency, human review, and risk management. Cloud selection must therefore include legal and compliance review, not just technical comparison.

10. Best Practices and Contemporary Developments

Effective cloud AI development commonly follows these practices:

1. Start with a measurable business or operational problem.

2. Establish a simple baseline before adopting a complex model.

3. Keep training, validation, and test data separate and prevent leakage.

4. Track data, code, dependencies, configurations, and model versions.

5. Use infrastructure-as-code and automated testing for repeatable environments.

6. Benchmark complete workflows, including data loading and serving.

7. Design for failure, rollback, and graceful degradation.

8. Monitor both technical behaviour and real-world outcomes.

9. Estimate total cost and automatically shut down idle resources.

10. Document proprietary dependencies and maintain an exit strategy.

Current developments include serverless inference, specialised inference accelerators, multimodal foundation models, retrieval-augmented systems, smaller models optimised for edge deployment, confidential computing, and increasingly automated model-evaluation pipelines. These developments improve accessibility but also increase the importance of model provenance, security testing, and lifecycle governance.

Chapter Summary

Cloud AI platforms integrate infrastructure, data services, development environments, training systems, model registries, deployment endpoints, and monitoring. Managed notebooks accelerate experimentation but must be complemented by version control and reproducible pipelines. Distributed training and accelerator clusters can reduce training time, although communication and input bottlenecks limit ideal scaling.

Pretrained models, foundation-model services, and AutoML reduce development effort, but they do not eliminate the need for data quality, evaluation, governance, and domain expertise. Deployment may use online, batch, streaming, or edge inference, each with different latency, cost, and operational requirements.

Platform selection should evaluate capability, performance, cost, portability, security, compliance, and vendor dependence. Build-versus-buy decisions should include total ownership cost and strategic value. Responsible cloud AI requires controlled access, documentation, human oversight, monitoring, rollback, and explicit treatment of uncertainty and failure.

Key Terms

Managed AI platform: Cloud environment providing integrated services for AI development and operation.

Managed notebook: Hosted interactive coding environment for data science and model development.

Model registry: System that stores model versions, metadata, evaluation results, and approval status.

Model endpoint: Service interface through which applications request predictions.

Distributed training: Training a model using multiple processors, accelerators, or machines.

Data parallelism: Method in which workers process different data batches using replicated models.

Model parallelism: Method in which different model components are placed on different devices.

Accelerator: Hardware specialised for parallel operations used in AI workloads.

Transfer learning: Reusing knowledge from a pretrained model for a new task.

Foundation model: Broadly trained model adaptable to many downstream tasks.

AutoML: Automated selection or optimisation of data-processing and modelling steps.

RAG: Retrieval-augmented generation using retrieved external information as model context.

Online inference: Prediction returned in response to an individual request.

Batch inference: Predictions generated for a collection of records at scheduled times.

Model drift: Change in data or relationships that reduces model suitability over time.

Portability: Ability to move an AI workload between platforms or environments.

Vendor lock-in: Dependence that makes changing providers difficult or expensive.

Canary deployment: Limited release used to evaluate a new version before full rollout.

Total cost of ownership: Complete cost of acquiring, operating, maintaining, and replacing a system.

Model governance: Policies and controls governing model development, use, monitoring, and retirement.

Review Questions

Short Answer Questions

1. What are the main layers of a managed cloud AI platform?

2. Why should notebook-based exploration be separated from production code?

3. Distinguish data parallelism from model parallelism.

4. What is the purpose of a model registry?

5. Name two causes of vendor lock-in.

Long Answer Questions

1. Explain the machine-learning lifecycle in a managed cloud platform, from data preparation through monitoring.

2. Compare online, batch, streaming, and edge inference, including suitable use cases.

3. Discuss the advantages and limitations of pretrained models, foundation-model services, and AutoML.

4. Explain how cost, performance, portability, and governance should influence platform selection.

5. Describe best practices for making cloud AI development reproducible and operationally reliable.

Analytical / Application Questions

1. A training job uses six accelerators for five hours at $1.80 per accelerator-hour. Calculate the direct accelerator cost and explain why it is not the project’s total cost.

2. An organisation can buy a general-purpose language-model API or build a specialised internal model for a regulated application. Analyse the decision using at least five build-versus-buy criteria.

3. Design a deployment and monitoring plan for a defect-detection model whose input distribution changes when a new factory product is introduced.

Multiple Choice Questions with Answers

Question 1

Which component primarily records model versions, metadata, and approval status?

A. Model registry

B. Object storage bucket

C. Load balancer

D. DNS service

Correct Answer: A. Model registry

Question 2

In data parallelism, workers generally process:

A. Different parts of the model with no replicated parameters

B. Different data batches using replicated model copies

C. Only the same single record

D. Only deployment traffic

Correct Answer: B. Different data batches using replicated model copies

Question 3

A four-accelerator training job runs for 6 hours at $2 per accelerator-hour. What is its direct accelerator cost?

A. $12

B. $24

C. $48

D. $96

Correct Answer: C. $48

Question 4

Which inference pattern is most suitable when immediate responses are unnecessary for millions of records?

A. Batch inference

B. Online inference

C. Interactive notebook inference

D. Canary inference

Correct Answer: A. Batch inference

Question 5

What is a major purpose of transfer learning?

A. To remove the need for evaluation

B. To reuse knowledge from a pretrained model for a new task

C. To guarantee fairness

D. To eliminate data storage

Correct Answer: B. To reuse knowledge from a pretrained model for a new task

Question 6

Which practice most directly improves portability across cloud providers?

A. Using only proprietary APIs

B. Avoiding version control

C. Using containers and open model or data formats

D. Keeping undocumented manual configurations

Correct Answer: C. Using containers and open model or data formats

Question 7

What does a canary deployment do?

A. Deletes the previous model immediately

B. Releases a new version to a limited portion of traffic first

C. Trains only on rare examples

D. Encrypts all training labels

Correct Answer: B. Releases a new version to a limited portion of traffic first

Question 8

Which issue is especially relevant when using a foundation-model API?

A. The API cannot ever be monitored

B. The provider may change model behaviour or version policies

C. The model requires no governance

D. The service always runs offline

Correct Answer: B. The provider may change model behaviour or version policies

Question 9

If one worker takes 10 hours and four workers take 3 hours, what is the approximate speedup?

A. 0.30

B. 1.33

C. 3.33

D. 12.00

Correct Answer: C. 3.33

Question 10

Why can AutoML not replace domain expertise?

A. It cannot perform any optimisation

B. It does not determine whether targets, metrics, and real-world use are appropriate

C. It always requires handwritten hardware drivers

D. It cannot store models

Correct Answer: B. It does not determine whether targets, metrics, and real-world use are appropriate

Cloud Computing for AI
Chapter 6 of 14