In Physician, (learn how to) heal thyself, I shared my experiences getting a laptop-class on-device model to debug a crash report in a (temporarily embarrassed) running application. I’ve done some more experiments, none of them worked, and I’m putting it aside for the moment.
That’s not to say that the principle is unsound. Shirudo uses the Codex model (unspecified version) to dynamically alter the bytecode of a running Java application to patch an exploited vulnerability. As shared in my previous post, I want to use on-device inference so that the software’s user remains in full control of the data their software sends to other providers. It just isn’t—currently—feasible with on-device models (unless there’s another approach entirely that I didn’t think of, that’s better than trying to tweak the approach I created).
The remaining experiments I tried are:
- Generating multiple patches at non-zero temperature, and trying them all. This vastly increases inference time and doesn’t significantly change the probability of success from the ~12% I already observed.
- Splitting inference into two steps: generating the explanation of the failure, and generating the patch. The explanations already aren’t high-quality so the patches don’t get any better.
- Increasing the amount of internal information available to the LLM. Instead of just showing the exception and the call frame at the crash site, the LLM gets the whole backtrace: receiver class, selector names, typed local, instance, and argument variables. None of this matters except in one narrow instance, where the crash is caused by a misspelled selector. Even then, the improvement is below two standard deviations.
- Generating Objective-C patches and translating to AppScript to install. This helped the Codestral model go from “really bad” to “quite bad”, it didn’t help Qwen3.8 or Bonsai 27B which were both already ahead of Codestral.
- Naming common reasons for patch rejection in the prompt. This improved patch syntax for Qwen and made it worse for Bonsai, and didn’t improve the recovery rate.
- Rejecting failed patches and sending them back to the LLM for a second pass. Qwen did repair some of its patches, and the main result was that it pulled the “baseline” success rate up to 10% when the success rate with the long-form AppScript syntax guide in the prompt is already at 12%.
- Ensuring the program source uses the “Intent Revealing Method Name” pattern. The point here is to provide “comments” on what the methods are supposed to do, without actually providing comments because those might get used for prompt injection. No significant improvement.
- A few-shot prompt (the Give Examples pattern from Patterns in AI-Augmented Software Development). This improved both models’ performance for some problems and regressed it at others, with no overall benefit.
- Fine-tuning the Qwen3.8 model. The validation loss started at 1.399, and got to 0.076 after 112 iterations at a learning rate of 1e-5. This actually did have an impact! But we got from 12% success to 13%, so not one that makes the product usable.
There are other applications of on-device LLMs to AppScript, so I’m rejecting the crash-recovery feature but evaluating other capabilities. In fact, I’m not rejecting it at all, I’m deferring it, until either I have a situation where using a frontier model is acceptable, or I have a more capable on-device model.

