Cancelling local generation should keep the interface responsive and prevent unwanted output from appearing later. It also needs a truthful definition of whether the runtime stopped immediately, will stop at a supported boundary, or can only suppress delivery.
Separate user intent, execution interruption, result handling, and resource cleanup. A cancel button is incomplete if it only changes the visible spinner while computation continues without limits.
Review the runtime's actual cancellation contract
Inspect the current official runtime and package documentation for supported interruption, thread rules, callbacks, and resource release. The Google AI Edge reference is a starting point for that stack, not a universal guarantee for every local engine.
Give each generation a stable identity and associate its output with the input revision and feature owner. A late token or completion from an old request must not enter a new lesson or another account's workspace.
Cancel a fictional lesson draft
Suppose a teacher starts a draft, notices the wrong chapter was selected, and cancels. The app records cancellation intent, requests supported interruption, and preserves the original source selection and any user edits.
Test cancellation before execution, during output, near final completion, and during model loading. Immediately start another request and verify no old output mixes with the new result. Test repeated cancel actions and closing the screen during settlement.
Decide whether partial generated text remains as a clearly labelled draft or is discarded. Either can be valid, but the policy should not silently replace reviewed material with an incomplete response.
Keep cleanup and responsiveness measurable
Move blocking work according to the runtime and platform contract, then verify the interface can still process cancellation and navigation. Check memory and resource state after repeated start-cancel cycles using supported tools.
No device benchmark or successful interruption is claimed here. Record actual model, runtime, device, input size, and observations before asserting cancellation latency or resource behaviour.
The tradeoff is rapid user feedback versus execution certainty. The interface can acknowledge the request immediately while clearly showing that stopping is pending. Do not report resources released before the runtime establishes that state.
The ChalkLens case study documents on-device lesson generation. This cancellation matrix is a proposed exercise and does not describe its internal runtime behaviour or measured performance.
Questions about local generation cancellation
Does hiding output stop computation?
Not necessarily. Delivery suppression and runtime interruption are separate mechanisms with different resource consequences.
Should partial output be saved automatically?
Only under an explicit draft policy that keeps it distinct from reviewed material and preserves the user's intent.
What should a review test first?
Cancel near completion, start a new request, and inspect mixed output and resources. Bring the trace to a local inference lifecycle review.