IP Library Granted Patent US 12,287,792
Granted Patent B2
US 12,287,792 · App. 17/938,494 · Granted Apr 29, 2025

Dense retrieval of document templates

Inventors: Mariana Sá Correia Leite Almeida (Lisbon, PT); Bruno Emanuel Da Graça Martins (Amora, PT); Tiago Manuel Reis Mesquita (Lisbon, PT)
Assignee: Zendesk, Inc.
G06F16/24556
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,287,792
App. No.
17/938,494
Granted
Apr 29, 2025
Kind
B2
Abstract

A system and method are provided for supporting dense retrieval of a template (e.g., a document template) for responding to a query or other textual input. The templates and past queries that were responded to using the templates are stored. A machine-learning model for matching a new query to the most appropriate template is trained using a selected subset of the stored queries as training queries. For each of one or more training batches or phases, multiple stored templates are selected (e.g., randomly) then, from among all training queries that the selected templates were used for, the same number of queries are selected (e.g., randomly), such that they represent the distribution of the training queries among the selected templates. A unique loss function is computed that leverages similarities and differences not only between each selected training query and each selected template, but also between different queries and between different templates.

Claims (132)

1. A method, comprising:

storing queries and templates;

selecting a subset of the stored queries based on one or more of:

a percentage of all stored queries; or

a time period in which each stored query was received;

iteratively performing the following steps until a performance metric for a model for matching a future query to one of the stored templates exceeds a performance threshold:

selecting a random subset of the stored templates;

generating a distribution based on the subset of stored queries and the random subset of templates by identifying each query of the subset of stored queries associated with each template of the random subset of stored templates;

selecting a subset of queries from the distribution;

generating a batch of training data based on the selected subset of queries from the distribution, wherein the batch of training data comprises one or more positively labeled training instances and one or more negatively labeled training instances, and

executing a multi-term loss function on the batch of training data to train the model for matching the future query to one of the stored templates,

wherein the multi-term loss function comprises:

a first weighted loss term corresponding to a similarity between a query of the subset of queries from the distribution and a template of the random subset of stored templates;

a second weighted loss term corresponding to a similarity between a first query of the subset of queries from the distribution and a second query of the subset of queries from the distribution;

a third weighted loss term corresponding to a similarity between a template of the random subset of stored templates and a second template of the random subset of stored templates; and

a fourth weighted loss term corresponding to a similarity between a template of the random subset of stored templates and a query of the subset of queries from the distribution, and

wherein the multi-term loss function is configured to reduce a number of training iterations until the performance metric for the model for matching the future query to one of the stored templates exceeds the performance threshold.

2. The method of claim 1 , wherein executing the multi-term loss function comprises:

for each respective query in the random subset of queries in the batch of training data:

executing the multi-term loss function for each combination of the respective query and each template of the random subset of stored templates to yield a query/template value; and

aggregating the query/template value for the respective query in the first weighted loss term.

3. The method of claim 2 , wherein executing the multi-term loss function further comprises:

for each respective query in the random subset of queries in the batch of training data:

executing the multi-term loss function for each combination of the respective query and another query in the random subset of queries to yield a query/query value; and

aggregating the query/query value for the respective query in the second weighted loss term.

4. The method of claim 2 , wherein executing the multi-term loss function further comprises:

for each respective template in the random subset of stored templates:

executing the multi-term loss function for each combination of the respective template and another template in the random subset of stored templates to yield a template/template value; and

aggregating the template/template value for the respective template in the third weighted loss term.

5. The method of claim 2 , wherein executing the multi-term loss function further comprises:

for each respective template in the random subset of stored templates:

executing the multi-term loss function for each combination of the respective template and a query in the random subset of queries to yield a template/query value; and

aggregating the template/query value for the respective template in the fourth weighted loss term.

6. The method of claim 2 , further comprising:

determining a first weight value for the first weighted loss term;

determining a second weight value for the second weighted loss term;

determining a third weight value for the third weighted loss term; and

determining a fourth weight value for the fourth weighted loss term.

7. The method of claim 1 , further comprising:

receiving a new query, different from the stored queries; and

determining a predicted template from the stored templates for the new query by applying the model to the new query.

8. The method of claim 7 , further comprising initiating a response to the new query using the predicted template.

9. A non-transitory computer-readable medium storing instructions that, when executed by a processor, cause the processor to perform a method comprising:

storing queries and templates;

selecting a subset of the stored queries based on one or more of:

a percentage of all stored queries; or

a time period in which each stored query was received;

iteratively performing the following steps until a performance metric for a model for matching a future query to one of the stored templates exceeds a performance threshold;

selecting a random subset of the stored templates;

generating a distribution based on the subset of stored queries and the random subset of templates by identifying each query of the subset of stored queries associated with each template of the random subset of stored templates;

selecting a subset of queries from the distribution;

generating a batch of training data based on the selected subset of queries from the distribution, wherein the batch of training data comprises one or more positively labeled training instances and one or more negatively labeled training instances; and

executing a multi-term loss function on the batch of training data to train the model for matching the future query to one of the stored templates,

wherein the multi-term loss function comprises:

a first weighted loss term corresponding to a similarity between a query of the subset of queries from the distribution and a template of the random subset of stored templates;

a second weighted loss term corresponding to a similarity between a first query of the subset of queries from the distribution and a second query of the subset of queries from the distribution;

a third weighted loss term corresponding to a similarity between a template of the random subset of stored templates and a second template of the random subset of stored templates; and

a fourth weighted loss term corresponding to a similarity between a template of the random subset of stored templates and a query of the subset of queries from the distribution, and

wherein the multi-term loss function is configured to reduce a number of training iterations until the performance metric for the model for matching the future query to one of the stored templates exceeds the performance threshold.

10. The non-transitory computer-readable medium of claim 9 , wherein executing the multi-term loss function comprises:

for each respective query in the random subset of queries in the batch of training data:

executing the multi-term loss function for each combination of the respective query and each template of the random subset of stored templates to yield a query/template value; and

aggregating the query/template value for the respective query in the first weighted loss term.

11. The non-transitory computer-readable medium of claim 10 , wherein executing the multi-term loss function further comprises:

for each respective query in the random subset of queries in the batch of training data:

executing the multi-term loss function for each combination of the respective query and another query in the random subset of queries to yield a query/query value; and

aggregating the query/query value for the respective query in the second weighted loss term.

12. The non-transitory computer-readable medium of claim 10 , wherein executing the multi-term loss function further comprises:

for each respective template in the random subset of stored templates:

executing the multi-term loss function for each combination of the respective template and another template in the random subset of stored templates to yield a template/template value; and

aggregating the template/template value for the respective template in the third weighted loss term.

13. The non-transitory computer-readable medium of claim 10 , wherein executing the multi-term loss function further comprises:

for each respective template in the random subset of stored templates:

executing the multi-term loss function for each combination of the respective template and a query in the random subset of queries to yield a template/query value; and

aggregating the template/query value for the respective template in the fourth weighted loss term.

14. The non-transitory computer-readable medium of claim 10 , further comprising:

determining a first weight value for the first weighted loss term,

determining a second weight value for the second weighted loss term;

determining a third weight value for the third weighted loss term; and

determining a fourth weight value for the fourth weighted loss term.

15. The non-transitory computer-readable medium of claim 9 , further comprising:

receiving a new query, different from the stored queries; and

determining a predicted template from the stored templates for the new query by applying the model to the new query.

16. The non-transitory computer-readable medium of claim 15 , further comprising initiating a response to the new query using the predicted template.

17. A system, comprising:

a repository of stored queries;

a repository of stored templates;

one or more processors; and

memory storing instructions that, when executed by the one or more processors, cause the system to:

select a subset of the stored queries based on one or more of:

a percentage of all stored queries; or

a time period in which each stored query was received;

iteratively performing the following steps until a performance metric for a model for matching a future query to one of the stored templates exceeds a performance threshold:

select a random subset of the stored templates;

generate a distribution based on the subset of stored queries and the random subset of templates by identifying each query of the subset of stored queries associated with each template of the random subset of stored templates;

select a subset of queries from the distribution;

generate a batch of training data based on the selected subset of queries from the distribution, wherein the batch of training data comprises one or more positively labeled training instances and one or more negatively labeled training instances; and

execute a multi-term loss function on batch of training data to train a model for matching a future query to one of the stored templates,

wherein the multi-term loss function comprises:

a first weighted loss term corresponding to a similarity between a query of the subset of queries from the distribution and a template of the random subset of stored templates;

a second weighted loss term corresponding to a similarity between a first query of the subset of queries from the distribution and a second query of the subset of queries from the distribution;

a third weighted loss term corresponding to a similarity between a template of the random subset of stored templates and a second template of the random subset of stored templates; and

a fourth weighted loss term corresponding to a similarity between a template of the random subset of stored templates and a query of the subset of queries from the distribution, and

wherein the multi-term loss function is configured to reduce a number of training iterations until the performance metric for the model for matching the future query to one of the stored templates exceeds the performance threshold.

18. The system of claim 17 , wherein in order to execute the multi-term loss function, the memory further stores instructions that, when executed by the one or more processors, cause the system to:

for each respective query in the random subset of queries in the batch of training data:

execute the multi-term loss function for each combination of the respective query and each template of the random subset of stored templates to yield a query/template value; and

aggregate the query/template value for the respective query in the first weighted loss term.

19. The system of claim 18 , wherein in order to execute the multi-term loss function, the memory further stores instructions that, when executed by the one or more processors, cause the system to:

for each respective query in the random subset of queries in the batch of training data:

execute the multi-term loss function for each combination of the respective query and another query in the random subset of queries to yield a query/query value; and

aggregate the query/query value for the respective query in the second weighted loss term.

20. The system of claim 18 , wherein in order to execute the multi-term loss function, the memory further stores instructions that, when executed by the one or more processors, cause the system to:

for each respective template in the random subset of stored templates:

execute the multi-term loss function for each combination of the respective template and another template in the random subset of stored templates to yield a template/template value; and

aggregate the template/template value for the respective template in the third weighted loss term.

21. The system of claim 18 , wherein in order to execute the multi-term loss function, the one or more processors are further configured to cause the system to:

for each respective template in the random subset of stored templates:

execute the multi-term loss function for each combination of the respective template and a query in the random subset of queries to yield a template/query value; and

aggregate the template/query value for the respective template in the fourth weighted loss term.

22. The system of claim 18 , wherein the memory further stores instructions that, when executed by the one or more processors, cause the system to:

determine a first weight value for the first weighted loss term;

determine a second weight value for the second weighted loss term;

determine a third weight value for the third weighted loss term; and

determine a fourth weight value for the fourth weighted loss term.

23. The system of claim 17 , wherein the memory further stores instructions that, when executed by the one or more processors, cause the system to:

receive a new query, different from the stored queries; and

determine a predicted template from the stored templates for the new query by applying the model to the new query.

24. The system of claim 23 , wherein the memory further stores instructions that, when executed by the one or more processors, cause the system to initiate a response to the new query using the predicted template.

25. The system of claim 17 , wherein the memory further stores instructions that, when executed by the one or more processors, cause the system to:

test a performance of the model; and

when the performance of the model exceeds a threshold, replace a production model with the model.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 31, 2022
From: ALMEIDA, MARIANA SÁ CORREIA LEITE DE; MARTINS, BRUNO EMANUEL DA GRAÇA; MESQUITA, TIAGO MANUEL REIS
To: ZENDESK, INC.
Reel/Frame 061594/0516 →
Continuity (2)
Provisional Application 63253491 · Oct 7, 2021
Related Publication 20230111562A1 · Apr 13, 2023
References Cited (9)
US 9529856B2 · Gupta · 2016 [cited by examiner]
US 20080027925A1 · Li · 2008 [cited by examiner]
US 20100257167A1 · Liu · 2010 [cited by examiner]
US 20210357542A1 · Bowen · 2021 [cited by examiner]
US 20220179871A1 · Ahmed · 2022 [cited by examiner]
Ruiyang, Ren et al., “PAIR: Leveraging Passage-Centric Similarity Relation for Improving Dense Passage Retrieval”, arXiv:2108.06027v1 [cs.IR] Aug. 13, 2021. [cited by applicant]
Karpukhin, Vladimir et al., “Dense Passage Retrieval for Open-Domain Question Answering”, arXiv:2004.04906v3 [cs.CL] Sep. 30, 2020. [cited by applicant]
Xiong, Lee et al., “Approximate Nearest Neighbor Negative Con-trastive Learning for Dense Text Retrieval”, arXiv:2007.00808v2 [cs.IR] Oct. 20, 2020. [cited by applicant]
Li, Yizhi et al., “More Robust Dense Retrieval with Contrastive Dual Learning”, arXiv:2107.07773v1 [cs.IR] Jul. 16, 2021. [cited by applicant]