Skip to content

Improve on-device clarification generation - #2

Open
AndreasInk wants to merge 3 commits into
mainfrom
codex/improve-clarification-generation
Open

Improve on-device clarification generation#2
AndreasInk wants to merge 3 commits into
mainfrom
codex/improve-clarification-generation

Conversation

@AndreasInk

Copy link
Copy Markdown
Owner

Summary

  • simplify clarification into one reasoning-first guided generation request
  • use concise conditional instructions, focused app context, and 1024px screenshot preprocessing
  • enable moderate reasoning through an iOS 27 Profile only when the active model advertises the reasoning capability; otherwise keep the simpler static session
  • keep greedy sampling for stable stop-or-ask decisions and mechanically stop exact repeated questions or responses
  • add regression eval controls and a local-package demo app for on-device prompt debugging

Verification

  • swift build
  • swift test --skip FeedbackClarificationEvaluationTests (51 tests passed)
  • targeted Liquid Glass regression passed with the reasoning-first schema
  • screenshot eval subset improved from 11/12 at full resolution to 12/12 at 1024px

Remaining eval note

The local Foundation Model reports reasoning=false. After the schema experiments, later model-backed runs intermittently stalled in the system model service, so the complete 33-case model eval was not rerun successfully on this final commit. The demo logs whether the active device model supports reasoning so the final prompt can be debugged on iPhone.

"""
static func instructions(hasClarificationHistory: Bool) -> String {
let task = hasClarificationHistory
? """

@AndreasInk AndreasInk Aug 22, 2026

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be as simple as:

"""
Given abstract feedback on an iOS app, learn from the user by asking questions about the user's feedback so the developer can more easily implement the user's feedback.
"""

"""

return """
You help an everyday app user give actionable feedback.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be as simple as:

"""
Given abstract feedback on an iOS app, learn from the user by asking questions about the user's feedback so the developer can more easily implement the user's feedback.
"""


@Guide(description: "True for vague negative feedback when one answer would help, including slow, confusing, hard to use, looks wrong, or does not make sense; false for clear positive feedback, false for a concrete product suggestion that names what should change and the desired direction, false after a substantive answer to a visual, content, usability, or accessibility follow-up, and false when a functional report already states the action, observed result, expected result, and frequency")
var needsClarification: Bool
@Guide(description: "One exact excerpt from supplied text")

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary can be removed

@@ -755,37 +583,44 @@ private enum GeneratedFeedbackIssueCategory {

enum FeedbackAnalysisPrompt {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We likely don't need this step, its content can be included in the TestFlight feedback. Doesn't need to be analyzed on the edge device.

@AndreasInk

Copy link
Copy Markdown
Owner Author

Implemented the AndreasInk review feedback in 8952d74:

  • replaced the conditional instruction tree with the suggested one-sentence prompt
  • removed model-generated summary and the duplicate On-device summary report section while retaining the public summary property for source compatibility
  • removed app context, app state, diagnostics, and metadata from the on-device prompt; they remain in the prepared TestFlight report
  • kept only original feedback plus prior questions and answers in model input

Verification:

  • swift build passed
  • 50 deterministic tests passed
  • full 33-case Foundation Models eval completed without stalls: 22/33, or 66.7% (previous branch result was 63.6%)

The remaining misses are mostly over-questioning already-actionable feedback. The domain-context case also fails now because context is intentionally no longer sent to the edge model.

@AndreasInk

Copy link
Copy Markdown
Owner Author

Updated the branch to enforce at most one generated follow-up (commit 36af9f3). The original feedback is response 1; after the tester answers the single clarification, the conversation finalizes without invoking the model again. Existing response-3/4 notification routing remains readable for upgrade cleanup, but older stored conversations are finalized at the new limit.\n\nValidation:\n- swift build: passed\n- 51 deterministic tests: passed\n- iOS Simulator package build: passed\n- production-path Foundation Models eval: 20/29 = 69.0% (the eval intentionally remains red because its target is 100%)\n\nThe default eval set now includes only cases where production actually calls the model: the initial feedback before the one allowed clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant