Online and edge inference
Quick answer
Online inference answers individual requests under a service contract; edge inference runs closer to the device or data source, where compute, memory, power and connectivity may be constrained. Examples use standard-library Python; optional ONNX execution is not tested. ByteMind execution is unverified.
Versioned output
import jsonprint(json.dumps({"version":1,"prediction":7},sort_keys=True))Expected output (locally tested): {"prediction": 7, "version": 1}. A response declares its output contract.
How it works
An HTTP endpoint accepts a bounded request, checks content type and schema, runs a fixed approved model, and returns a versioned output or a structured error. A simple lab can bind to 127.0.0.1 on a temporary port and shut down after its synthetic tests; Python http.server is not a production server. A real service additionally needs authentication, authorization, encrypted transport, rate limits, isolation, resource budgets, observability, rollout and rollback. A timeout is not proof that work was cancelled; track request lifecycle explicitly. On edge devices, validate supported operators, precision, model size, latency, battery and offline behavior on representative hardware. Quantization can reduce storage but may alter numerical and decision parity; verify both. A failed version or integrity check must stop model activation, and a missing approved model must not silently substitute an unknown one.
Quantization can flip a decision
score=0.496; compressed=round(score,2)print(score>=0.5,compressed>=0.5)Expected output (locally tested): False True. A small score change may alter a decision.
Common mistakes
Do not bind a teaching endpoint to all interfaces, expose real data, or claim loopback is a full security boundary. Do not return raw tracebacks or load model files named by requests.
Practice and next steps
Run the loopback lab and inspect valid and invalid responses. Change a request version and verify that no inference is executed.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Online and edge inference — knowledge check
Apply online and edge inference to small examples and debugging scenarios.
Where should the teaching server bind?
What can quantization change?
What must production add?
What happens on failed artifact validation?
What establishes edge performance?