FullStack AI Hub
Studio
lesson depth
Mastery
not started · 0%

Response Feedback Collection for AI Chat

Capture response ratings against stable response IDs, collect optional reasons with consent, and deduplicate retries before feedback enters evaluation datasets.

Freshness: current•12 min read•AI User Experience and Human-AI Interaction
Full Technical Reference Document

Mental model

Response feedback is an annotation event linked to one immutable answer version, not a direct vote on the model or proof that the answer is correct. A reliable collection path preserves response identity, the user's rating, consent, and an event ID, then deduplicates retries before a signal enters an evaluation dataset.

Theory

Model a rating as a user-selected event bound to a specific response revision. The event has a stable identity so retries are idempotent, while its meaning stays narrow: it records a preference observation, not correctness or safety. The analysis layer must preserve unrated responses as a separate state and report the vote denominator, because opt-in feedback is vulnerable to self-selection and duplicate events.

Mechanism: feedback is an observation, not a label of truth

A thumbs-up records that one person chose a positive control in one context. It does not show that the answer was factually correct, useful to every reader, or safe to reuse as supervised training data. Treat the rating as an observation about a user and a particular rendered response. Keep it separate from evaluator labels, groundedness checks, safety review, and task completion measures. The Microsoft human-AI interaction guidelines support clear user control and feedback at useful moments; they do not turn a self-selected vote into a representative quality score.

The response must have a stable identity before the feedback control appears. Give each generated answer a response ID and a revision number. If regeneration changes the answer, the new output needs a different revision even when it occupies the same visual card. The feedback event should name that exact version so a later evaluator can reconstruct which answer was rated. Never identify an answer by its text: repeated wording, edits, and privacy-sensitive content make text a poor key.

An event can contain a random event ID, response ID, response revision, rating value, optional reason code, a consent or product-policy version, and a timestamp. Keep user identity pseudonymous or scoped to the signed-in account, and collect only fields required by the evaluation purpose. Free-text reasons are useful for discovering failure patterns, but they may contain names, secrets, or copied prompts. Make them optional, explain how they will be used, enforce a short limit, and run the product's existing privacy and retention policy before exporting them.

Controls and persistence

Place clear, labeled positive and negative controls beside the completed response they rate. A user can navigate them with the keyboard and understand their pressed state; the control must not move focus when a background response finishes. If a user selects the same rating twice, the interface should show one selected state rather than enqueueing two votes. If the user changes a rating for the same response revision, append a correction event that supersedes the earlier event and atomically replace the effective rating keyed by account, response ID, and revision. Keep the audit history, but aggregate only the latest valid rating for that key so a change does not count as two votes.

The API should authenticate the account, check that the referenced response belongs to an allowed conversation, validate the response revision and rating, and enforce a per-account rate limit. Give every click a client-generated event ID. The server stores that ID under a uniqueness constraint so that a retry after a dropped acknowledgement cannot create a second observation. RFC 9110 defines 409 Conflict for a request that conflicts with the target resource's current state; it is not a generic success response. If the endpoint uses 409 for an idempotent replay, its contract must say so explicitly and confirm that this exact event ID and payload were already durably accepted. Any other 409 means the current rating state conflicts and the client must refresh or surface the conflict.

An asynchronous evaluation pipeline can copy accepted events into an analysis store, but it must preserve the event ID and response revision. The UI can tell the user that feedback was recorded once the write is durable, even if downstream aggregation is delayed. Monitoring should include accepted event count, rejected events, duplicate idempotency hits, queue age, and the proportion of rated responses. NIST's AI Risk Management Framework treats measurement and monitoring as lifecycle activities; this event stream is one input to those activities, not a replacement for them.

Identify the completed answer revision
Expose accessible rating controls
Create a consent-aware event
Deduplicate the durable write
Replace the effective rating for corrections
Conceptual teaching model synthesized from:human-ai-guidelines,nist-ai-rmf,rfc9110-http-semantics,w3c-wcag22,w3c-aria-apg-alert-pattern

Worked example: read the denominator

A team generates 2,400 answers in a week. Users submit 164 positive and 76 negative ratings, so 240 answers have a recorded vote. The positive fraction among submitted votes is 164 / 240 = 0.683, or 68.3%. It is not correct to report that 68.3% of all answers were good: 2,160 answers received no rating, and people who choose to vote may differ from people who do not.

For a rough uncertainty calculation, the standard error of a sample proportion is the square root of p times (1 - p) divided by n. With p = 0.683 and n = 240, the standard error is about 0.030, or three percentage points. A normal approximation gives a 95% interval of roughly 62.4% to 74.2%. That interval describes sampling noise under the approximation; it does not repair self-selection bias or establish factual accuracy. For small samples, use a Wilson interval and report the vote count alongside the percentage.

Failure modes and misconceptions

FailureWhy it misleadsProduction response
Counting a click before the write succeedsBrowser state can vanish before durable storageShow pending, saved, or retry states from the API result
Retrying with a new event IDA timeout can duplicate one user actionReuse the event object and event ID for that action
Joining feedback to the conversation's latest answerA regeneration can change the card under the controlStore response ID and revision in the event
Treating every missing vote as negativeSilence has many causes, including no exposureKeep no-rating as a distinct state
Exporting unrestricted free textA reason may contain personal or confidential dataMake it optional, limit it, redact, and apply retention rules

Trade-offs

More fields improve analysis but increase privacy and governance costs. A reason taxonomy is easy to aggregate and can surface issues such as stale citations or formatting failures, but it may miss an unanticipated problem. Free text captures nuance but needs stronger access controls and review. A compact initial design can use one required rating choice and an optional short reason selected from a small taxonomy, with free text added only when the evaluation team can protect and review it.

Quantitative model

p+=n+n++n−,SE⁡(p+)=p+(1−p+)n++n−p_{+} = \frac{n_{+}}{n_{+} + n_{-}}, \qquad \operatorname{SE}(p_{+}) = \sqrt{\frac{p_{+}(1-p_{+})}{n_{+}+n_{-}}}

Here n+ and n- are counts of positive and negative recorded votes for a defined response cohort; p+ and its standard error are dimensionless proportions, often displayed as percentages. Do not include unrated answers in this denominator, and do not compare cohorts without stating their time window and vote count.

Implementation pattern

The client creates one event for one user action and reuses it if the request must be retried. The backend should enforce event-ID uniqueness, authorization, consent policy, and response ownership; this client code only defines the transport contract.

typescript
type Rating = "positive" | "negative";
​
type FeedbackEvent = { eventId: string; responseId: string; responseRevision: number; rating: Rating; reasonCode?: string; replacesEventId?: string };
​
export function createFeedbackEvent(response: { id: string; revision: number; complete: boolean }, rating: Rating, reasonCode?: string, previousEventId?: string): FeedbackEvent {
if (!response.complete) throw new Error("Rate a completed response");
return {
eventId: crypto.randomUUID(),
responseId: response.id,
responseRevision: response.revision,
rating,
...(reasonCode ? { reasonCode } : {}),
...(previousEventId ? { replacesEventId: previousEventId } : {}),
};
}
​
async function fingerprint(event: FeedbackEvent): Promise<string> {
const bytes = new TextEncoder().encode(JSON.stringify(event));
const digest = await crypto.subtle.digest("SHA-256", bytes);
return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
}
​
export async function submitFeedback(event: FeedbackEvent): Promise<void> {
const payloadHash = await fingerprint(event);
const result = await fetch("/api/response-feedback", {
method: "POST", credentials: "same-origin",
headers: { "content-type": "application/json", "idempotency-key": event.eventId, "x-payload-sha256": payloadHash },
body: JSON.stringify(event),
});
if (result.status === 409) {
const receipt = (await result.json().catch(() => ({}))) as {
code?: string;
eventId?: string;
payloadHash?: string;
durable?: boolean;
};
const exactDuplicate =
receipt.code === "duplicate_event" &&
receipt.eventId === event.eventId &&
receipt.payloadHash === payloadHash &&
receipt.durable === true;
if (exactDuplicate) return;
throw new Error("Feedback conflicts with the saved rating; refresh before retrying");
}
if (!result.ok) {
throw new Error("Feedback was not saved; retry the same event");
}
}

The endpoint's 409 duplicate receipt is an application contract layered on HTTP semantics: return code duplicate_event, the matching event ID and payload fingerprint, and durable true only after the original event is committed. A reused key with a different body, an unknown event, or any other conflict must not be reported as saved. Use a button with a descriptive accessible name and an aria-pressed value for each rating control. On a successful save, announce a short confirmation in a polite status region. The W3C alert pattern is assertive and interruptive; reserve it for an urgent condition that needs immediate attention, not routine feedback confirmations. Keep the original answer and keyboard focus in place; feedback collection is a side action, not a new navigation step.

Decision scenario

A team sees a higher positive-vote fraction for model B, but model B has half as many rated answers as model A and the client retried some writes after timeouts. Before the team changes the default, it should deduplicate events by event ID, bind each vote to an answer revision, compare response counts and exposure, and check factual quality with an independent evaluation set. The rating difference can guide review; it cannot establish that model B is more correct.

Learning outcomes

  • Bind a feedback event to the response ID and revision the user actually rated.
  • Make writes idempotent so a lost acknowledgement does not duplicate one click.
  • Interpret vote fractions with their sample counts, missing votes, and selection limits.

Further reading

The lesson uses the human-AI interaction guidelines for user control, the NIST AI RMF for ongoing measurement and monitoring, RFC 9110 for HTTP conflict semantics, and the W3C ARIA alert pattern for announcement urgency. These sources inform interaction design and governance; the application still needs its own data protection and evaluation policy.

Reflect before revealing the guide

Prerequisites & Related Concepts (2)

Private notes

0 words
Recommended Free Track
Free · Verifiable Credential

FS-501AI Evaluation and Reliability

Turn product intent and risk into representative evaluations release gates traces service targets and continuously improving regression evidence.

17 concepts~22h self-paced
Start Free Course
Weekly Engineering Dispatch

Get the weekly systems teardown

One technical note per week covering inference bottlenecks, retrieval harnesses, and commit-pinned teardowns.

Next