Try It: Edge ML vs Cloud ML Comparison
Try Change Network round-trip (ms), then press Calculate.
Observe After Calculate, compare Latency, Accuracy, and Fits on device.
Explain Describe how Network round-trip (ms) changes cloud Latency after Calculate.
Calculate
Reset
Technical boundaries. Edge latency depends only on the selected device; cloud latency adds 30 ms to network round-trip. Accuracy and device fit depend only on model size.
viewof inferModelSize = Inputs. select (["2 MB (TFLite micro)" , "5 MB (TFLite)" , "10 MB (ONNX quantized)" , "100 MB (Full TF)" , "500 MB (Large model)" ], {value : "5 MB (TFLite)" , label : "Model size" })
viewof inferEdgeDevice = Inputs. select (["ESP32 (240 MHz)" , "Cortex-M4 (168 MHz)" , "Raspberry Pi 4 (1.5 GHz)" , "Jetson Nano (GPU)" ], {value : "Cortex-M4 (168 MHz)" , label : "Edge device" })
viewof inferNetworkLatency = Inputs. range ([10 , 500 ], {value : 100 , step : 10 , label : "Network round-trip (ms)" })
inferEdgeLatency = inferEdgeDevice === "ESP32 (240 MHz)" ? 200 :
inferEdgeDevice === "Cortex-M4 (168 MHz)" ? 50 :
inferEdgeDevice === "Raspberry Pi 4 (1.5 GHz)" ? 15 :
5
inferEdgeAccuracy = inferModelSize === "2 MB (TFLite micro)" ? 82 :
inferModelSize === "5 MB (TFLite)" ? 88 :
inferModelSize === "10 MB (ONNX quantized)" ? 91 :
inferModelSize === "100 MB (Full TF)" ? 95 :
97
inferCloudLatency = inferNetworkLatency + 30
inferCloudAccuracy = inferModelSize === "2 MB (TFLite micro)" ? 82 :
inferModelSize === "5 MB (TFLite)" ? 88 :
inferModelSize === "10 MB (ONNX quantized)" ? 91 :
inferModelSize === "100 MB (Full TF)" ? 96 :
98
inferEdgeFits = (inferModelSize === "2 MB (TFLite micro)" || inferModelSize === "5 MB (TFLite)" || inferModelSize === "10 MB (ONNX quantized)" )
html `<div style="background: var(--bs-light, #f8f9fa); padding: 1rem; border-radius: 8px; border-left: 4px solid #9B59B6; margin-top: 0.5rem;">
<h4 style="color: #2C3E50; margin-top: 0;">Edge vs Cloud Inference</h4>
<div class="edge-processing-compare-grid">
<div class="edge-processing-compare-card" style="background: white; padding: 0.75rem; border-radius: 6px; border: 2px solid #16A085;">
<h5 style="color: #16A085; margin-top: 0;">Edge Inference</h5>
<p><strong>Latency:</strong> ${ inferEdgeLatency} ms</p>
<p><strong>Accuracy:</strong> ~ ${ inferEdgeAccuracy} %</p>
<p><strong>Fits on device:</strong> ${ inferEdgeFits ? "Yes" : "No (too large)" } </p>
<p><strong>Works offline:</strong> Yes</p>
</div>
<div class="edge-processing-compare-card" style="background: white; padding: 0.75rem; border-radius: 6px; border: 2px solid #3498DB;">
<h5 style="color: #3498DB; margin-top: 0;">Cloud Inference</h5>
<p><strong>Latency:</strong> ${ inferCloudLatency} ms</p>
<p><strong>Accuracy:</strong> ~ ${ inferCloudAccuracy} %</p>
<p><strong>Fits on device:</strong> N/A (cloud GPU)</p>
<p><strong>Works offline:</strong> No</p>
</div>
</div>
<p style="color: #7F8C8D; font-size: 0.9em; margin-top: 0.75rem;"> ${ inferEdgeLatency < inferCloudLatency ? "Edge wins on latency by " + (inferCloudLatency - inferEdgeLatency) + " ms." : "Cloud is faster in this scenario." } ${ inferEdgeFits ? "" : "Warning: selected model is too large for this edge device -- cloud or a more powerful edge device is recommended." } </p>
</div>`
Back to the chapter