Distributed Computing

Chapter 14
Distributed AI and Intelligent Systems

Post Graduate Program in IT Engineering
Distributed Computing   •   Post Graduate

Distributed AI and Intelligent Systems

Introduction and Context

Distributed artificial intelligence (AI) combines machine-learning algorithms with distributed systems that coordinate data, computation, storage, networking, and operational control across multiple machines or sites. Modern AI systems rarely depend on a single server. Large language models, recommender systems, autonomous platforms, fraud-detection services, and scientific models may require thousands of accelerators, geographically dispersed data, and continuous deployment pipelines.

The central engineering challenge is not simply to increase computational power. A distributed AI system must obtain useful parallelism while controlling communication overhead, maintaining numerical and operational correctness, protecting data, managing heterogeneous accelerators, and providing reliable inference. These requirements create trade-offs among speed, cost, privacy, fairness, reproducibility, and model quality.

This chapter examines distributed training, data and model parallelism, parameter-server architectures, federated learning, inference serving, and MLOps. It also evaluates communication costs, privacy and bias, reproducibility, accelerator scheduling, and reliable AI operations.

Learning Objectives

After studying this chapter, a student should be able to:

1. Explain the principal architectures used for distributed AI training.

2. Distinguish data parallelism, model parallelism, pipeline parallelism, and hybrid strategies.

3. Estimate communication and synchronization costs in distributed training.

4. Compare parameter servers with collective-communication architectures.

5. Design a federated-learning workflow while identifying privacy and statistical limitations.

6. Analyse inference-serving architectures and accelerator-scheduling policies.

7. Apply MLOps principles to reproducibility, monitoring, governance, and incident response.

8. Critically evaluate distributed AI systems for performance, fairness, security, and reliability.

1. Foundations of Distributed AI

A distributed AI system has four interacting planes:

  • Data plane: storage, ingestion, preprocessing, feature computation, and data movement.
  • Training plane: workers, accelerators, optimizers, parameter synchronization, checkpointing, and experiment execution.
  • Serving plane: model packaging, routing, batching, inference execution, and response delivery.
  • Control plane: scheduling, orchestration, configuration, identity, monitoring, governance, and recovery.

A useful distinction is between distributed learning and distributed intelligence. Distributed learning concerns how a model is trained across computational or organizational boundaries. Distributed intelligence is broader: it includes systems in which perception, reasoning, decision-making, and adaptation occur across devices, services, or agents.

The principal performance quantities are:

  • Throughput: training examples or inference requests processed per unit time.
  • Latency: elapsed time from request arrival to response; tail latency, such as the 95th or 99th percentile, is often more important than the mean.
  • Scalability: the degree to which performance improves when resources are added.
  • Efficiency: achieved performance relative to ideal linear scaling.
  • Availability: proportion of time the service is usable.
  • Cost efficiency: useful work obtained per monetary or energy unit.

Distributed AI adds failure modes absent from a single-device experiment: worker stragglers, network partitions, stale parameters, corrupted checkpoints, inconsistent software environments, accelerator faults, and silent data or label changes.

2. Parallelism Strategies

2.1 Data Parallelism

In synchronous data parallelism, every worker stores a complete copy of the model. A global minibatch is divided among workers. Each worker computes gradients on its local minibatch, and the gradients are aggregated before the model is updated.

For worker set W and local gradients g_i, the averaged gradient is

g = (1/|W|) Σ_i g_i.

The expression assumes that all workers compute gradients for the same model parameters and that the aggregation operation is completed before the update. If each worker has b examples, the effective global minibatch is B = |W|b, assuming equal minibatch sizes. Unequal batches require a weighted average based on the number of examples represented by each worker.

Synchronous data parallelism provides a clear training semantics but waits for the slowest worker. It is therefore vulnerable to stragglers. Asynchronous data parallelism permits workers to update a shared model independently; it can improve utilization but introduces stale gradients and makes convergence and reproducibility more difficult.

2.2 Model Parallelism

Model parallelism partitions the model across devices. It is necessary when model parameters or intermediate activations cannot fit on one accelerator. Partitioning may follow layers, tensor dimensions, attention heads, or expert modules.

Model parallelism reduces replicated memory but increases communication between partitions. Activation tensors must cross device boundaries during the forward pass, while gradients cross them during backpropagation. Partition quality depends on balanced memory and computation, low communication volume, and a topology that supports the required links.

2.3 Pipeline Parallelism

Pipeline parallelism divides a model into sequential stages and divides a minibatch into microbatches. While one stage processes a later microbatch, another can process an earlier one. This overlaps computation but creates a pipeline bubble, during which some stages are idle during filling and draining. More microbatches generally reduce the relative bubble, but may increase activation memory and scheduling complexity.

Pipeline schedules include ordinary forward-then-backward schedules and interleaved schedules. The correct choice depends on memory capacity, activation recomputation, stage balance, and the required consistency of parameter versions.

2.4 Mixture-of-Experts and Sparse Computation

A mixture-of-experts model contains many expert subnetworks, while a routing mechanism activates only a subset for each token or example. This increases parameter capacity without activating every parameter for every input. However, distributed routing can generate substantial all-to-all communication and load imbalance. Expert-capacity limits, routing regularization, and topology-aware placement are therefore important.

2.5 Hybrid Parallelism

Large-scale systems commonly combine data, tensor/model, and pipeline parallelism. A conceptual configuration may use tensor parallelism within a node, pipeline parallelism across groups of nodes, and data parallelism across replicated pipelines. The design must account for communication hierarchy: high-bandwidth local links are preferable for frequent tensor exchanges, whereas slower inter-node links may carry less frequent synchronization.

3. Communication Cost and Scaling

Communication frequently determines whether adding accelerators improves performance. A simple iteration model is

T_iteration ≈ T_compute + T_communication + T_input + T_overhead,

where the terms represent computation, synchronization or tensor transfer, data input, and scheduling or framework overhead. The terms are not always strictly additive because communication and input processing may overlap with computation.

For a ring all-reduce that aggregates a tensor of size S bytes across P workers, a commonly used bandwidth-dominated approximation for the communicated volume per worker is

V_ring ≈ 2(P−1)S/P.

This describes the reduce-scatter and all-gather phases under a ring algorithm. It assumes equal-sized messages, reliable collective participation, and a bandwidth-dominated regime. Actual time also depends on link bandwidth, latency, topology, software implementation, and contention. A simplified estimate is

T_comm ≈ V_ring / R + L,

where R is effective per-worker bandwidth and L represents aggregate latency and protocol overhead. This is an estimate, not a universal performance law.

Worked example. Suppose 8 workers synchronise a 400 MB gradient tensor using ring all-reduce. The per-worker communication volume is

2(8−1)(400 MB)/8 = 700 MB.

If effective bandwidth is 25 GB/s and protocol latency is approximated as 2 ms, the bandwidth component is 0.700/25 seconds = 0.028 seconds, or 28 ms. The approximate communication time is therefore 30 ms. If local computation takes 20 ms and cannot overlap with communication, synchronization dominates the iteration. Gradient compression, larger computation per synchronization, hierarchical collectives, or a different parallelism strategy may be considered.

A useful strong-scaling measure is speedup S(P) = T(1)/T(P), where T(P) is completion time using P workers. Parallel efficiency is E(P) = S(P)/P. These definitions assume the workload is held constant. In weak scaling, the workload grows with the number of workers, so a different question is whether completion time remains approximately stable.

4. Parameter Servers and Collective Architectures

A parameter server stores model parameters or optimizer state. Workers pull parameters, compute gradients, and push updates. A centralized server is conceptually simple, while sharded or replicated servers distribute memory and traffic.

Parameter servers support asynchronous updates and can accommodate workers with different speeds. Their disadvantages include hotspots, server failures, stale gradients, and high network load near aggregation points. Consistency policies include:

  • Synchronous consistency: an update proceeds after an expected group of workers reports.
  • Asynchronous consistency: each update is applied when it arrives.
  • Bounded staleness: delayed workers may lag only within a specified limit.

Collective architectures, especially all-reduce, allow workers to exchange gradients directly. They avoid a central aggregation bottleneck and often provide high performance on homogeneous clusters. They require coordinated participation and are less naturally suited to highly dynamic or intermittently connected workers.

The architectural choice should consider model size, network topology, fault model, worker heterogeneity, update semantics, privacy requirements, and operational complexity—not only benchmark throughput.

5. Federated Learning

Federated learning trains a shared model while keeping raw training data on client devices or within participating organizations. In a basic cross-device workflow, a coordinator selects clients, distributes the current model, clients train locally, and the coordinator aggregates updates.

If client k has n_k training examples and local model parameters w_k, a weighted aggregation is

w_new = Σ_k (n_k / Σ_j n_j) w_k.

This form assumes that participating client models are aligned to the same parameterization and that example counts are an appropriate weighting basis. In practice, the coordinator may aggregate updates rather than complete parameters, and local optimization can make the relationship between local training and global objective more complex.

Federated learning faces non-independent and identically distributed data: clients may differ in language, geography, hardware, behaviour, or label quality. Client availability is intermittent, communication is expensive, and local computation is uneven. More local steps reduce communication but can increase client drift, particularly under heterogeneous data.

Privacy and Security

Keeping raw data local does not guarantee privacy. Model updates can leak information through reconstruction, membership inference, or unintended correlations. Defences include secure aggregation, differential privacy, encryption, access control, and robust aggregation. Secure aggregation hides an individual client’s update from the coordinator while allowing a sum to be computed. Differential privacy limits the influence of any one record or client by adding calibrated randomness; privacy guarantees must be stated using a formal privacy budget and accounting method.

Federated systems also face poisoning, Sybil clients, malicious coordinators, compromised devices, and model-replacement attacks. Robust aggregation can reduce the impact of outliers but may reduce statistical efficiency or fail against adaptive adversaries. Security controls must therefore be combined with authentication, anomaly detection, client attestation, and incident response.

Fairness and Representation

A globally accurate model can perform poorly for minority clients. Weighting by example count may favour large clients, while equal client weighting may give disproportionate influence to small clients. Evaluation should report subgroup performance, calibration, error asymmetry, and participation patterns. Fairness is not achieved by a single universal metric; the appropriate criterion depends on the application and legally or ethically relevant harms.

6. Distributed Inference Serving

Training and inference have different objectives. Training often values maximum throughput and can tolerate long jobs; inference must meet latency, availability, and cost targets for unpredictable demand.

A production inference path commonly includes a request gateway, authentication, routing, model registry, feature service, preprocessing, model runtime, post-processing, and observability. Models may be deployed as dedicated services, shared multi-model servers, serverless functions, or edge components.

Important techniques include:

  • Dynamic batching: combines requests arriving within a short interval to improve accelerator utilization. Excessive batching increases latency.
  • Model replication: places copies on multiple devices for capacity and fault tolerance.
  • Quantization: represents parameters or activations with lower precision, reducing memory and often increasing throughput, subject to accuracy validation.
  • Caching: reuses results or intermediate representations when inputs and validity conditions permit.
  • Autoscaling: adjusts replicas according to queue length, utilization, throughput, or tail latency.
  • Canary deployment: exposes a new model to a small traffic fraction before wider release.
  • Fallback models: provide degraded but safe functionality during overload or dependency failure.

Queueing effects are especially important. As utilization approaches full capacity, waiting time can increase sharply. Consequently, a service designed solely around average load may violate tail-latency objectives during bursts. Capacity planning should use realistic arrival distributions, service-time measurements, failure scenarios, and explicit service-level objectives.

7. Accelerator Scheduling

Accelerators differ in memory, compute capability, interconnect, power consumption, and support for numerical formats. Scheduling decisions include placement, partitioning, preemption, admission control, and priority.

A scheduler may use:

  • First-available placement: simple and responsive, but potentially topology-unaware.
  • Bin packing: improves utilization by fitting jobs into available capacity, but may cause fragmentation.
  • Gang scheduling: starts a distributed job’s workers together, reducing partial allocation but lowering flexibility.
  • Priority or deadline scheduling: protects latency-sensitive services, potentially starving batch jobs.
  • Fair-share scheduling: allocates resources over time according to quotas or weights.
  • Topology-aware scheduling: places communicating processes near one another.

A robust policy separates training and serving reservations, accounts for memory rather than only accelerator count, supports checkpoint-aware preemption, and measures energy and cost. Multi-tenant environments require isolation because one job’s memory pressure, network traffic, or thermal behaviour can affect another.

8. MLOps and Reproducibility

MLOps extends DevOps practices to data, models, experiments, and continuously changing statistical environments. A mature lifecycle contains:

1. data acquisition and validation;

2. versioned feature and label definitions;

3. reproducible training pipelines;

4. model evaluation and approval;

5. registry and deployment automation;

6. production monitoring;

7. feedback, retraining, and rollback.

Reproducibility requires more than recording a random seed. It may require versioned code, data snapshots or immutable references, dependency manifests, compiler and accelerator information, hyperparameters, distributed topology, preprocessing logic, checkpoint identifiers, and evaluation scripts. Floating-point reduction order can produce small numerical differences across hardware and execution schedules; exact bitwise reproducibility may be expensive or impossible. The operational goal should therefore be explicit: bitwise repeatability, statistical repeatability, or traceable provenance.

Monitoring should cover:

  • system metrics: utilization, memory, network, temperature, and failures;
  • service metrics: throughput, error rate, latency percentiles, and saturation;
  • data metrics: missingness, schema changes, distribution shift, and label delay;
  • model metrics: accuracy, calibration, subgroup performance, drift, and abstention rate;
  • governance metrics: access, approvals, audit events, and policy violations.

A model can remain operationally healthy while becoming statistically unsafe, or maintain accuracy while violating privacy. Monitoring must therefore combine technical, statistical, and governance signals.

9. Reliability Engineering for AI

Reliable AI operations treat models as probabilistic software embedded in deterministic infrastructure. Failure handling should include checkpointing, retry policies, idempotent jobs, durable metadata, versioned artifacts, health checks, circuit breakers, rollback, and disaster recovery.

Checkpoint intervals involve a trade-off. Frequent checkpoints reduce lost work after failure but increase storage and I/O overhead. A simple expected-loss approximation is that, for a constant failure rate and checkpoint interval τ, average recomputation after a failure is approximately τ/2, assuming failures are equally likely within an interval and restart overhead is ignored. This is only a planning approximation; correlated failures and checkpoint costs require empirical analysis.

Training jobs should record the exact state needed for resumption, including optimizer state, learning-rate schedule, data position where feasible, random-number states where supported, and distributed-training configuration. Inference services should use immutable model artifacts and support safe rollback to a previously validated version.

10. Ethical, Legal, and Governance Considerations

Distributed AI can cross organizational and national boundaries. Governance must address lawful data use, purpose limitation, retention, access rights, security, explainability where required, and accountability for automated decisions. Federated learning does not remove obligations concerning consent, data minimization, or fairness.

Bias can enter through sampling, labels, historical decisions, client participation, preprocessing, or optimization. A distributed architecture may obscure responsibility because data owners, infrastructure providers, model developers, and service operators each control different parts of the system. A governance framework should assign ownership, define escalation paths, preserve audit trails, document intended and prohibited uses, and establish human oversight for high-impact decisions.

Environmental impact is also relevant. Accelerator manufacture, electricity consumption, cooling, and repeated experimentation create costs beyond cloud invoices. Efficient architectures, smaller models, carbon-aware scheduling, reuse of checkpoints, and evaluation before large-scale training can reduce unnecessary resource use.

11. Illustrative Case: Federated Clinical Risk Prediction

Background

Consider a fictional consortium of six hospitals seeking to predict patient deterioration. Hospitals cannot transfer identifiable patient records to a central repository because of legal, ethical, and institutional constraints. The hospitals have different patient populations, electronic-record systems, and computing capacity.

Problem

A centrally trained model is not permissible, while independently trained models have insufficient data and inconsistent performance. The consortium must improve prediction without exposing raw records, maintain a clinically acceptable false-negative rate, and provide evidence that performance is not concentrated in the largest hospital.

Analysis

The problem is statistically heterogeneous: case mix, coding practices, prevalence, and missingness differ by hospital. Equal weighting by patient count would cause the largest hospital to dominate. Equal weighting by hospital would give each institution influence but might increase variance for small sites. Communication is limited because hospitals can participate only during scheduled windows. Clinical inference requires high availability and auditable model versions.

Approach

The consortium uses a cross-silo federated workflow. A coordinator distributes a signed model artifact. Each hospital validates incoming data schemas, trains locally for a bounded number of epochs, clips the update, and submits it through secure aggregation. The coordinator applies a privacy mechanism and records the privacy accounting. Hospital-level validation is mandatory before a model can progress. The evaluation dashboard reports discrimination, calibration, false-negative rate, missingness sensitivity, and subgroup results by clinically relevant categories.

A small independent test set, governed separately from training sites, is used for final assessment. Deployment begins with a shadow mode, in which predictions are logged but do not influence clinical workflow. After review, a canary release is introduced with rollback capability. Model drift, alert volume, and clinician override patterns are monitored.

Outcome

The approach improves average predictive performance relative to independent models, but performance remains lower for one hospital with unusual coding practices. The consortium therefore delays full deployment, improves local preprocessing, and documents the limitation rather than presenting the average score as universal success. Secure aggregation reduces exposure of individual updates, but it does not by itself solve bias, poisoning, or institutional accountability.

Learning Points

The case demonstrates that distributed AI is an organizational and statistical problem as well as a systems problem. Privacy mechanisms, aggregation rules, validation design, and deployment governance must be selected together. A high global metric is insufficient when local harms or operational constraints are material.

12. Contemporary Directions and Best Practices

Current research and industry practice are moving toward memory-efficient large-model training, parameter-efficient adaptation, retrieval-augmented systems, confidential computing, edge inference, carbon-aware scheduling, and automated evaluation. These developments do not eliminate foundational trade-offs. Retrieval systems introduce data freshness and access-control concerns; parameter-efficient methods reduce training cost but may complicate adapter management; confidential hardware can protect computation while introducing trust and performance assumptions.

Best practices include:

1. Measure end-to-end throughput and tail latency rather than accelerator utilization alone.

2. Select parallelism according to memory, topology, communication, and failure characteristics.

3. Define update semantics explicitly in distributed training.

4. Treat privacy as a quantified property, not merely a consequence of data locality.

5. Evaluate local and subgroup performance, not only global averages.

6. Version code, data references, features, models, configurations, and evaluation results.

7. Test recovery, rollback, partial failure, and overload before production release.

8. Separate training, serving, and governance responsibilities while maintaining clear ownership.

9. Use canary and shadow deployment for high-impact models.

10. Record limitations and uncertainty as part of the model artifact.

Chapter Summary

Distributed AI coordinates data, computation, models, and operational controls across machines or organizations. Data parallelism replicates models and synchronizes gradients; model and tensor parallelism partition model computation; pipeline parallelism overlaps stages; hybrid methods combine these approaches. Communication cost, worker stragglers, topology, and synchronization semantics determine scalability.

Parameter servers offer flexible aggregation but may create hotspots and stale updates, whereas collective methods such as all-reduce are efficient on coordinated homogeneous clusters. Federated learning keeps raw data local but must address non-identical client data, privacy leakage, poisoning, fairness, and client availability. Inference serving emphasizes tail latency, batching, replication, quantization, autoscaling, and safe deployment.

MLOps provides provenance, lifecycle automation, monitoring, and rollback. Reliable AI operations require checkpointing, fault recovery, statistical monitoring, governance, and explicit accountability. Privacy, bias, reproducibility, energy use, and legal obligations are architectural concerns rather than afterthoughts. Effective distributed AI is therefore a joint optimisation of systems performance, model quality, security, fairness, and operational reliability.

Key Terms

Distributed AI: AI in which data, computation, models, or decisions are coordinated across multiple nodes or sites.

Data parallelism: Replication of a model across workers using different data partitions.

Model parallelism: Partitioning model parameters or computation across devices.

Pipeline parallelism: Splitting a model into sequential stages processed on microbatches.

All-reduce: A collective operation that reduces values across workers and distributes the result to all workers.

Parameter server: A service that stores and aggregates model parameters or updates.

Gradient staleness: The delay between computing a gradient and applying it to current parameters.

Straggler: A slow worker that delays synchronized distributed computation.

Federated learning: Collaborative model training in which raw client data remains local.

Secure aggregation: A protocol that reveals an aggregate update without revealing each individual update.

Differential privacy: A formal privacy framework limiting the effect of an individual record or participant.

Client drift: Divergence caused by local optimisation on heterogeneous client data.

Dynamic batching: Combining requests arriving close together for more efficient inference.

Tail latency: A high-percentile response time, such as the 95th or 99th percentile.

MLOps: Practices for developing, deploying, monitoring, and governing machine-learning systems.

Data drift: Change in the distribution or properties of production data.

Canary deployment: Gradual release of a model to a small traffic fraction before expansion.

Checkpoint: A saved training state from which execution can resume.

Model registry: A controlled repository of versioned model artifacts and metadata.

Pipeline bubble: Idle time created while a pipeline fills or drains.

Review Questions

Short Answer Questions

1. What is the principal difference between synchronous and asynchronous data parallelism?

2. Why can model parallelism increase communication requirements?

3. What problem does secure aggregation address in federated learning?

4. Define tail latency and explain its importance in inference serving.

5. Name four categories of metrics that should be monitored in MLOps.

Long Answer Questions

1. Compare data, model, pipeline, and hybrid parallelism, including their memory and communication trade-offs.

2. Explain parameter-server and all-reduce architectures and identify situations in which each is appropriate.

3. Analyse the statistical and privacy challenges of federated learning with heterogeneous clients.

4. Design an MLOps lifecycle for a high-impact distributed AI application.

5. Discuss how accelerator scheduling, topology, checkpointing, and failure recovery affect reliable AI operations.

Analytical / Application Questions

1. Eight workers synchronise a 400 MB tensor using ring all-reduce. Derive the per-worker communication volume and explain which assumptions may make the estimate inaccurate.

2. Design an evaluation plan for a federated model whose global accuracy improves while performance for a minority hospital declines.

3. A latency-sensitive inference service competes with large batch-training jobs for accelerators. Propose a scheduling and deployment policy, and justify the trade-offs among utilisation, fairness, cost, and service-level objectives.

Multiple Choice Questions with Answers

Question 1

In synchronous data parallelism, what normally happens before a model update is applied?

A. Each worker discards its gradient

B. Gradients are aggregated across the participating workers

C. Only the fastest worker updates the model

D. The model is permanently partitioned across workers

Correct Answer: B. Gradients are aggregated across the participating workers

Question 2

For ring all-reduce with P workers and tensor size S, which expression approximates per-worker communication volume?

A. S/P

B. (P−1)S

C. 2(P−1)S/P

D. 2PS

Correct Answer: C. 2(P−1)S/P

Question 3

Which is a characteristic weakness of a centralized parameter server?

A. It cannot store parameters

B. It may become a traffic or failure bottleneck

C. It prevents asynchronous updates

D. It requires every client to hold raw data centrally

Correct Answer: B. It may become a traffic or failure bottleneck

Question 4

Why is federated learning not automatically private merely because raw data remains local?

A. Local data is always publicly visible

B. Model updates can leak information

C. It requires removal of authentication

D. It eliminates encryption

Correct Answer: B. Model updates can leak information

Question 5

What is dynamic batching primarily intended to improve?

A. Accelerator utilisation and throughput

B. Training-label correctness

C. Client authentication

D. Checkpoint durability

Correct Answer: A. Accelerator utilisation and throughput

Question 6

Which metric is most directly associated with worst-case user experience during overloaded inference serving?

A. Mean parameter count

B. Tail latency

C. Number of training epochs

D. Dataset cardinality alone

Correct Answer: B. Tail latency

Question 7

What does a canary deployment do?

A. Deletes the previous model immediately

B. Exposes a new model to a limited traffic fraction first

C. Prevents model monitoring

D. Aggregates private client updates

Correct Answer: B. Exposes a new model to a limited traffic fraction first

Question 8

Why can equal client weighting in federated learning be preferable to example-count weighting?

A. It gives every institution or client comparable influence

B. It guarantees identical data distributions

C. It eliminates communication costs

D. It prevents all poisoning attacks

Correct Answer: A. It gives every institution or client comparable influence

Question 9

If eight workers use ring all-reduce on a 400 MB tensor, what is the approximate per-worker volume?

A. 50 MB

B. 400 MB

C. 700 MB

D. 3,200 MB

Correct Answer: C. 700 MB

Question 10

Which item is essential for meaningful experiment reproducibility?

A. Only the random seed

B. Only accelerator utilisation

C. Versioned code, data references, dependencies, and configuration

D. A larger minibatch in every experiment

Correct Answer: C. Versioned code, data references, dependencies, and configuration

Distributed Computing
Chapter 14 of 15