Neural Network Diagram vs Serving-Path Diagram: Mapping ML Inference Latency

A neural network diagram shows layers; a serving-path diagram shows the stages, owners, budgets and traces that locate latency and throughput bottlenecks.

Neural Network Diagram vs Serving-Path Diagram: Mapping ML Inference Latency
Written by TechnoLynx Published on 11 Jul 2026

A neural network diagram shows the model: its layers, how they connect and how tensors move between them. A serving-path diagram shows everything a request passes through between arriving and getting a prediction back: parsing, feature fetches, preprocessing, the scheduling queue, the batcher, model execution, postprocessing and every network hop between services. You need the first to understand the model. You need the second to see where request time goes, because in the small vision models and face pipeline measured below, a large share of end-to-end time falls outside the layers a neural network diagram draws. A serving diagram built to locate bottlenecks names each stage, the team that owns it, the slice of the latency budget it gets, and the trace point that measures it.

Neural Network Diagram Versus Serving-Path Diagram

Tools built for neural network diagrams draw the model’s architecture. NN-SVG, published by LeNail in the Journal of Open Source Software in 2019, produces publication-ready schematics of neural network architectures. Netron is a viewer for model files and supports ONNX, TensorFlow Lite, PyTorch, TorchScript, TensorFlow, Core ML, OpenVINO, Keras and other formats.

Richins et al. (ACM TOCS) describe a ladder of abstraction: layers combine into a model, one or more models plus supporting compute make an AI task, and AI tasks spread across a data centre make the complete application. At the top of that ladder, networking equipment, storage, communication protocols and coordination software all become part of the AI application. Algorithmic’s guide to real-time inference architecture puts it more bluntly: a useful inference architecture starts with the serving path, not the checkpoint, because the checkpoint sits inside that path and the path defines how production behaves.

Aspect Neural network diagram Serving-path diagram
Unit drawn Layers, operators, tensor shapes Services, stages, queues, network hops
Question it answers What does the model compute? Where does a request spend its time, and who owns that time?
Example tools NN-SVG, Netron Request traces and per-stage metrics (Triton trace, perf_analyzer)
Carries time? No Yes: a budget and a measured latency per stage
Carries ownership? No Yes: an owner, a metric and a failure response per stage
Finds production bottlenecks? Only those inside model execution Also preprocessing, queueing, transfer and inter-stage waits

What Belongs on the Diagram Beyond the Model’s Layers?

Beyond the layers, a production serving diagram has to show the stages that run around the model, because those stages carry latency and can cap throughput. At minimum, we would draw these elements:

  • Preprocessing and postprocessing as their own boxes. For ML to be useful it needs supporting compute on both sides of the model. KServe makes this explicit: its Transformer component runs preprocess, predict and postprocess handlers in sequence, with each handler’s output passed to the next.
  • The scheduling queue and the batcher. In Triton, queue time is the time a request waits in the scheduling queue for a model instance to become available.
  • Every process or network boundary. In the face recognition pipeline Richins et al. studied, video frames and face crops crossed the network between containers, coordinated through Apache Kafka brokers. The protocol on a hop matters too: KServe’s documentation shows a transformer-to-predictor call taking 92 ms over REST against 55 ms over gRPC for the same tensor.
  • Fan-out points. Where one input produces a variable number of outputs (one frame, several faces), the downstream stage’s load varies with the data, and that junction is where load balancing and congestion happen.
  • An owner, a metric and a failure response for each control point.

The diagram has a companion artefact worth keeping next to it. Algorithmic calls it a runtime bill of materials: a list of every service in the inference path with its owner, timeout, retry policy and failure mode, plus whether it sits in the critical path for paid traffic. The diagram shows the order of stages. The bill of materials holds each service’s owner, timeout, retry policy and failure mode.

How Do I Map a Request from Arrival to Returned Prediction?

Map the path in the order a single request actually travels, and attach a measurement point to every box as you draw it. The procedure below follows that order.

  1. Start from the serving contract. Write down the maximum input size, output format, p95 and p99 latency targets, fallback behaviour and cost ceiling for the use case, so that the map has a target to be measured against.
  2. Draw the client-to-server edge. Amazon SageMaker’s CloudWatch documentation, for example, splits total response time into network latency, overhead latency (moving the request to the model container and back) and model latency.
  3. Draw the request handling in the server. Triton’s trace timestamps give a ready vocabulary: HTTP receive, handler, queue, compute and send, with compute split into input copy (including the copy to the GPU), infer and output copy.
  4. Draw the stages outside the inference server. In Algorithmic’s allocation, authentication with request parsing, feature fetches and postprocessing each get their own budget slice and owner.
  5. Mark every hop across a container, node or broker, and every fan-out where the work downstream depends on the data.
  6. Attach a trace point to each box. A minimal Triton trace has a top-level span, a model span and a compute span, and an ensemble adds model and compute spans for each composing model. Event-based logging of the high-level steps (ingestion, detection, broker wait, identification) is what let Richins et al. track a frame’s progress across the whole cluster rather than a single node.
  7. Give each box an owner and a budget, as set out further down.

How to draw queues, caches and hops so the picture stays readable is a separate drafting question. The stage list above is what has to be on the map before it can locate anything.

The Batching Stage: Throughput Bought with Waiting Time

Batching belongs on the diagram as a stage of its own, because it trades per-request waiting time for throughput. Batching lets one load of model parameters serve many requests, which raises throughput. TensorFlow Serving’s documentation says batching is needed to get the high throughput that GPUs and other accelerators are capable of. Modular’s inference handbook describes three variants:

  • Static batching waits for a fixed number of requests and processes them together.
  • Dynamic batching sets a time window and runs whatever has arrived, launching early if the size limit is reached first.
  • Continuous (in-flight) batching lets each sequence finish independently and replaces it straight away, changing the batch at each decoding iteration so the GPU does not sit idle waiting for the slowest sequence.

The batcher’s settings govern latency as well as throughput. In TensorFlow Serving, max_batch_size sets the throughput/latency trade-off, batch_timeout_micros caps how long a batch waits before running underfull (used to rein in tail latency), and max_enqueued_batches bounds queueing delay by turning requests away rather than building a backlog. TensorFlow Serving’s guide says the best batch_timeout_micros is typically a few milliseconds and depends on context. In the DeepRecSys study (Gupta et al., 2020), choosing the optimal batch size in a production data centre cut p95 and p99 tail latency by 1.39× and 1.31× against a fixed batch size. The guide adds that the best batching values depend on model, system and latency goals. Modular’s handbook says the same about chunked prefill sizes for LLM serving: no value is best everywhere. TechnoLynx can map LLM and agent serving paths the same way through its Generative & Agentic AI R&D work. Which side of the trade you favour depends on the route, which is the subject of choosing between throughput and latency as the optimisation target.

Splitting a p95 Budget Across the Stages

A single latency target hides who owns it, so a serving-path diagram works best when the target is divided across the stages. Algorithmic gives a worked allocation for a 1,000 ms p95 budget on an interactive feature, and assigns an owner to each component. The trace column shows where we would read each stage from in a Triton-based stack.

Stage Budget Owner Trace point
Authentication and request parsing 80 ms API platform team (gateway time) Gateway timing; HTTP receive and overhead in the server trace
Feature fetch 120 ms Data platform team Feature-store call latency
Model inference 500 ms ML platform team (model execution and queue delay) Triton queue, compute input, compute infer and compute output
Postprocessing 100 ms Product engineering KServe postprocess handler timing
Network overhead and queue tolerance 200 ms Not assigned in the allocation Client-observed minus server latency

The arithmetic closes: 80 + 120 + 500 + 100 + 200 = 1,000 ms. Under this scheme a model version that exceeds its slice is downgraded or rolled back rather than promoted. Algorithmic also recommends a route SLO ledger recording the budget, owner, current p95, current p99, error budget and rollback trigger for each path. The figures are one practical allocation. A route serving checkout fraud and a route serving asynchronous document review will divide their time differently.

Which Stages Usually Dominate End-to-End Latency?

For small and mid-sized vision models, the stages around the model often take more time than the model itself. A 2024 analysis of DNN server overheads for computer vision (arXiv 2403.12981) found that preprocessing, queueing, data transfer and postprocessing dominate inference requests for most models under 5 GFLOPs, ResNet-50 included, and still take 16–49% of latency for models above 10 GFLOPs. In the same study, preprocessing reached up to 56% of latency for medium-sized images with CPU preprocessing, and at concurrencies between 64 and 512 queueing took 34–91% of latency. At 25 faces per frame in a face pipeline, a disk-backed Kafka broker took 71% of total latency, against 6% for an in-memory Redis broker.

The Smol study (Kang et al., VLDB 2021) reached the same conclusion from the throughput side: on an AWS instance with an NVIDIA T4, preprocessing ran at 7.1× lower throughput than ResNet-50 execution. In one configuration, preprocessing, DNN execution and end-to-end inference reached 5.9k, 4.2k and 3.6k images per second respectively.

This does not mean the model never dominates. For ViT-base the inference stage was often the bottleneck, and preprocessing took over only with larger images. Model size, input size, where preprocessing runs and concurrency together decide which box is the heaviest. That is why the diagram should draw every box rather than assume which one matters.

Worked Example: A Face Recognition Pipeline, Stage by Stage

Richins et al. measured a face recognition application deployed as Docker containers communicating through Kafka, with an end-to-end latency of 351 ms. The per-stage averages were:

Stage Average latency
Ingestion (video to frames) 18.8 ms
Face detection 74.8 ms
Waiting between stages (brokers) 126.1 ms
Identification 131.5 ms

Adding the four rows gives 18.8 + 74.8 + 126.1 + 131.5 = 351.2 ms, which matches the reported end-to-end figure. Waiting accounts for 126.1 / 351.2, about 36%: more than a third of a frame’s life is spent in no stage a neural network diagram would draw. The tail is worse. The authors found that end-to-end tail latency came almost entirely from broker waiting time, driven by congestion when detection produced more faces than identification could absorb. Even inside the detection box, only 42% of time went on executing the model in TensorFlow, while cropping and resizing faces took 25%.

The lesson for diagramming is that the wait between two stages is a stage of its own, with its own latency, its own owner and its own fix. In this pipeline the tail sat in broker waiting, not in the model.

How Does a Serving-Path Diagram Help Locate Latency and Throughput Bottlenecks?

A serving-path diagram turns “inference is slow” into a question about one box, because each box has a measured number to compare with its budget. Triton’s perf_analyzer reports the server-side breakdown directly; its documentation shows an example of 12,005 µs average request latency split into overhead 36 µs, queue 42 µs, compute input 164 µs, compute infer 11,748 µs and compute output 15 µs. Read against the diagram, that request is model-bound at that load: queue and copies are negligible and compute infer is almost all of it. The same tool reports client-side latency separately, so the gap between client and server time points at the network and protocol edge.

Algorithmic recommends testing at 1×, 2× and 3× expected launch traffic and measuring queue time separately from model time. When concurrency rises and the queue box grows while compute infer stays roughly flat, requests are waiting for a free instance. The 2024 overheads study shows how fast the queue can take over: up to 3 seconds of queueing at a concurrency of 4,096. Keep raw traces from the test, because aggregates hide the long-tail paths, and a sample of the slowest 100 requests usually points to the work that matters. Triton’s trace sampling rate traces one request in every N.

For throughput, the map answers a different question: which stage caps the pipeline. End-to-end throughput tends to line up with either the preprocessing or the inference stage, whichever is slower. When preprocessing is the limit, extra GPUs sit idle waiting for input from the CPU. Speeding up the model also hits a ceiling: Richins et al. calculated that detection, at 42% AI time, can never exceed a 1.74× overall speedup however fast the AI part gets. Our guide to profiling AI inference covers how to read the kernel-level numbers once the map has narrowed the search to the model box, and the piece on what APM tools show and miss for AI inference covers the monitoring layer that feeds the per-stage metrics.

All of this depends on a design choice made before anyone draws a box. Stages that are separate, inspectable and instrumented are what let a team say where a failure happened and why. That is our default preference for modular, observable systems over opaque end-to-end ones.

When a Faster Model Makes the System Slower

Drawing the whole path matters because speeding up one box can overwhelm another. When Richins et al. simulated 8× faster AI compute in the face recognition application, latency grew without bound: faces entered the system faster than the brokers could pass them on, and storage bandwidth went past 67% of capacity while network use stayed under 6%. In those acceleration runs, waiting reached 79.1% of a frame’s latency at 6×. That failure sits in the brokers and storage, outside the model. A serving-path diagram with a broker box and its waiting time exposes it, as only an end-to-end view does.

So before buying faster accelerators or adopting machine learning compilers, find which box on your map is closest to its budget under production-shaped load. Performance engineering for production AI covers that wider discipline.

FAQ

What Is the Structure of a Neural Network?

A neural network is built from layers that compute through common operations such as matrix multiplication, and those layers combine to form a model. In a deployed application, that model is one component among the preprocessing, postprocessing and other models that together produce a result.