IP Library Granted Patent US 12,632,471
Granted Patent B2
US 12,632,471 · App. 18/785,135 · Granted May 19, 2026

Query clarification based on confidence in a classification performed by a generative language machine learning model

Inventors: Vesna Brown (Manotick, CA); Maxwell Dayvson Da Silva (Brooklyn, NY); David Wurtz (Paradise Valley, AZ); Alexandre Salle (Porto Alegre, BR); Christopher Bullock (Wellington, CA)
Assignee: SHOPIFY INC.
G06F16/285G06F16/2455G06F16/3346G06F16/353G06F30/27G06N3/08G06F40/10G06F40/216G10L15/18G10L15/183
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,632,471
App. No.
18/785,135
Filed
Jul 26, 2024
Granted
May 19, 2026
Kind
B2
Art Unit
2166
USPC
707/740
Abstract

A large language model (LLM) may be used to classify an input into one of a plurality of categories. However, given the machine-learning operation of the LLM, the output of the LLM does not represent a definitive statement, but is based on probability computations of the machine learning model. Therefore, the classification performed by the LLM might not be correct. Classification into the wrong category by the LLM results in downstream technical problems. In some implementations, when an LLM generates a response that classifies an input, one or more probability values associated with a token that forms the basis of the response may be used to determine a confidence value. The confidence value is indicative of confidence in the classification performed by the LLM. An action may be taken based on the confidence value.

Claims (44)

1 . A computer-implemented method comprising:

providing a prompt to a generative language model, the prompt including a query and the prompt instructing the generative language model to generate a response that classifies the query into one of a plurality of categories, wherein the plurality of categories includes a category corresponding to the query being unambiguous;

receiving the response from the generative language model, the response classifying the query into the category corresponding to the query being unambiguous, and the response being based on one or more tokens selected by the generative language model;

for a token that forms a basis of language indicating the query is unambiguous: receiving, from the generative language model, a probability value associated with the token that forms the basis of language indicating the query is unambiguous;

determining a confidence value using at least the probability value associated with the token that forms the basis of language indicating the query is unambiguous; and

responsive to the confidence value not satisfying a threshold, providing a reply to the query that requests clarification relating to the query.

2 . The computer-implemented method of claim 1 , wherein the reply to the query is based on output from the generative language model.

3 . The computer-implemented method of claim 2 , wherein the prompt is a first prompt, and wherein providing the reply comprises:

providing a second prompt to the generative language model; and

providing the reply to the query based on output from the generative language model responsive to the second prompt.

4 . The computer-implemented method of claim 3 , wherein the second prompt indicates, to the generative language model, that the query is classified into another category different from the category into which the query was classified by the response.

5 . The computer-implemented method of claim 3 , wherein the second prompt includes information retrieved based on the query, and the second prompt instructs the generative language model to use the information to generate the reply that requests clarification.

6 . The computer-implemented method of claim 2 , wherein:

responsive to the confidence value not satisfying the threshold, modifying the response to classify the query into another category different from the category into which the query was originally classified by the response;

continuing generation of output from the generative language model with the response modified; and

providing the reply based on the output from the generative language model with the response modified.

7 . The computer-implemented method of claim 1 , wherein the token that forms the basis of language indicating the query is unambiguous is a selected token, wherein the method further comprises receiving, from the generative language model, a probability value associated with an alternative token that was not selected by the generative language model to form the basis of language indicating the query is unambiguous, and wherein the confidence value is determined using the probability value associated with the selected token and the probability value associated with the alternative token.

8 . The computer-implemented method of claim 7 , wherein the alternative token that was not selected corresponds to another category of the plurality of categories.

9 . The computer-implemented method of claim 7 , wherein the alternative token that was not selected has a next highest associated probability after the selected token.

10 . The computer-implemented method of claim 7 , wherein there are only two categories, the two categories being a first category corresponding to the query being unambiguous and a second category corresponding to the query being ambiguous, wherein the response can be one of two response values, wherein a first response value of the two response values corresponds to the query being unambiguous and the second response value of the two response values corresponds to the query being ambiguous, wherein the response is the first response value corresponding to the query being unambiguous, wherein the selected token corresponds to the first response value, and wherein the alternative token corresponds to the second response value.

11 . The computer-implemented method of claim 7 , wherein determining the confidence value comprises performing a comparison between the probability value associated with the selected token and the probability value associated with the alternative token, and wherein the confidence value is based on the comparison.

12 . A system comprising:

at least one processor; and

a memory storing processor-executable instructions that, when executed by the at least one processor, cause the system to:

provide a prompt to a generative language model, the prompt including a query and the prompt instructing the generative language model to generate a response that classifies the query into one of a plurality of categories, wherein the plurality of categories includes a category corresponding to the query being unambiguous;

receive the response from the generative language model, the response classifying the query into the category corresponding to the query being unambiguous, and the response being based on one or more tokens selected by the generative language model;

for a token that forms a basis of language indicating the query is unambiguous: receive, from the generative language model, a probability value associated with the token that forms the basis of language indicating the query is unambiguous;

determine a confidence value using at least the probability value associated with the token that forms the basis of language indicating the query is unambiguous; and

responsive to the confidence value not satisfying a threshold, provide a reply to the query that requests clarification relating to the query.

13 . The system of claim 12 , wherein the reply to the query is based on output from the generative language model.

14 . The system of claim 13 , wherein the prompt is a first prompt, and wherein providing the reply comprises:

providing a second prompt to the generative language model; and

providing the reply to the query based on output from the generative language model responsive to the second prompt.

15 . The system of claim 14 , wherein the second prompt indicates, to the generative language model, that the query is classified into another category different from the category into which the query was classified by the response.

16 . The system of claim 14 , wherein the second prompt includes information retrieved based on the query, and the second prompt instructs the generative language model to use the information to generate the reply that requests clarification.

17 . The system of claim 12 , wherein the token that forms the basis of language indicating the query is unambiguous is a selected token, wherein the instructions, when executed, further cause the system to receive, from the generative language model, a probability value associated with an alternative token that was not selected by the generative language model to form the basis of language indicating the query is unambiguous, and wherein the confidence value is determined using the probability value associated with the selected token and the probability value associated with the alternative token.

18 . The system of claim 17 , wherein there are only two categories, the two categories being a first category corresponding to the query being unambiguous and a second category corresponding to the query being ambiguous, wherein the response can be one of two response values, wherein a first response value of the two response values corresponds to the query being unambiguous and the second response value of the two response values corresponds to the query being ambiguous, wherein the response is the first response value corresponding to the query being unambiguous, wherein the selected token corresponds to the first response value, and wherein the alternative token corresponds to the second response value.

19 . The system of claim 17 , wherein determining the confidence value comprises performing a comparison between the probability value associated with the selected token and the probability value associated with the alternative token, and wherein the confidence value is based on the comparison.

20 . A non-transitory computer readable medium having stored thereon computer-executable instructions that, when executed by a computer, cause the computer to perform operations comprising:

providing a prompt to a generative language model, the prompt including a query and the prompt instructing the generative language model to generate a response that classifies the query into one of a plurality of categories, wherein the plurality of categories includes a category corresponding to the query being unambiguous;

receiving the response from the generative language model, the response classifying the query into the category corresponding to the query being unambiguous, and the response being based on one or more tokens selected by the generative language model;

for a token that forms a basis of language indicating the query is unambiguous: receiving, from the generative language model, a probability value associated with the token that forms the basis of language indicating the query is unambiguous;

determining a confidence value using at least the probability value associated with the token that forms the basis of language indicating the query is unambiguous; and

responsive to the confidence value not satisfying a threshold, providing a reply to the query that requests clarification relating to the query.

Assignments (11)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 25, 2024
From: SHOPIFY INTERNATIONAL LIMITED
To: SHOPIFY INC.
Reel/Frame 069396/0281 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 25, 2024
From: SHOPIFY (USA) INC.
To: SHOPIFY INC.
Reel/Frame 069396/0174 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 22, 2024
From: SALLE, ALEXANDRE; SALLE, ALEXANDRE
To: SHOPIFY INTERNATIONAL LIMITED
Reel/Frame 069374/0875 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 22, 2024
From: DA SILVA, MAXWELL DAYVSON; WURTZ, DAVID; DA SILVA, MAXWELL DAYVSON; WURTZ, DAVID
To: SHOPIFY (USA) INC.
Reel/Frame 069374/0530 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 22, 2024
From: BROWN, VESNA; BULLOCK, CHRISTOPHER; BROWN, VESNA; BULLOCK, CHRISTOPHER
To: SHOPIFY INC.
Reel/Frame 069374/0699 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 7, 2024
From: BROWN, VESNA; BULLOCK, CHRISTOPHER
To: SHOPIFY INC.
Reel/Frame 069180/0466 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 7, 2024
From: DA SILVA, MAXWELL DAYVSON; WURTZ, DAVID
To: SHOPIFY (USA) INC.
Reel/Frame 069180/0403 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 7, 2024
From: SALLE, ALEXANDRE
To: SHOPIFY INTERNATIONAL LIMITED
Reel/Frame 069180/0434 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 6, 2024
From: DA SILVA, MAXWELL DAYVSON; WURTZ, DAVID
To: SHOPIFY (USA) INC.
Reel/Frame 069155/0953 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 6, 2024
From: SALLE, ALEXANDRE
To: SHOPIFY INTERNATIONAL LIMITED
Reel/Frame 069156/0107 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 6, 2024
From: BROWN, VESNA; BULLOCK, CHRISTOPHER
To: SHOPIFY INC.
Reel/Frame 069156/0059 →
Continuity (2)
Provisional Application 63650608 · May 22, 2024
Related Publication 20250363158A1 · Nov 27, 2025
References Cited (17)
US 12298975B2 · Baldua et al. · 2025 [cited by applicant]
US 20180096058A1 · Anderson · 2018 [cited by examiner]
US 20240117863A1 · Ahn et al. · 2024 [cited by applicant]
US 20240256757A1 · Manavoglu et al. · 2024 [cited by applicant]
US 20240320476A1 · Chandrasekaran · 2024 [cited by applicant]
US 20240354503A1 · Baruch et al. · 2024 [cited by applicant]
US 20240362093A1 · Zhou · 2024 [cited by examiner]
US 20240411824A1 · Sahu et al. · 2024 [cited by applicant]
US 20240428783A1 · Gupta et al. · 2024 [cited by applicant]
US 20250013833A1 · Mcnamara · 2025 [cited by examiner]
US 20250080396A1 · Titon et al. · 2025 [cited by applicant]
US 20250111151A1 · Huang et al. · 2025 [cited by applicant]
US 20250156463A1 · Rosa et al. · 2025 [cited by applicant]
WO 2023278070A1 · 2023 [cited by applicant]
WO WO2024015321A1 · 2024 [cited by examiner]
Gautam Chutani, “Unlocking LLM Confidence Through Logprobs”, Medium, https://gautam75.medium.com/unlocking-llm-confidence-through-logprobs-54b26ed1b48a, Feb. 18, 2024, pp. 1 to 18. [cited by applicant]
Kuhn, Lorenz et al., CLAM: Selective Clarification for Ambiguous Questions with Generative Language Models, arXiv.org, Feb. 20, 2023 (Feb. 20, 2023), Retrieved from the Internet: URL: https://arxiv.org/pdf/2212.07769 [r… [cited by applicant]