IP Library › Granted Patent US 12,164,878
Granted Patent B2
US 12,164,878 · App. 17/581,380 · Granted Dec 10, 2024

Systems and methods for cross-lingual transfer in natural language processing

Inventors: Tong Niu (Sunnyvale, CA); Kazuma Hashimoto (Palo Alto, CA); Yingbo Zhou (Palo Alto, CA); Caiming Xiong (Menlo Park, CA)
Assignee: Salesforce, Inc.
G06F40/51
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,164,878
App. No.
17/581,380
Granted
Dec 10, 2024
Kind
B2
Abstract

Embodiments described herein provide a cross-lingual sentence alignment framework that is trained only on rich-resource language pairs. To obtain an accurate aligner, a pretrained multi-lingual language model is used, and a classifier is trained on parallel data from rich-resource language pairs. This trained classifier may then be used for cross-lingual transfer with low-resource languages.

Claims (71)

1. A method of cross-lingual sentence alignment, the method comprising:

receiving, via a communication interface, a training dataset comprising at least a first sentence in a source language and a second sentence in a target language that is a translated version of the first sentence;

forming a positive input pair comprising the first sentence and the second sentence and a plurality of negative input pairs, each comprising the first sentence and a respective non-matching sentence in the target language;

computing, via a pretrained multi-lingual model, a pairwise token-level similarity between two sentences within each positive input pair or negative input pair, wherein the pairwise token-level similarity between the two sentences is computed by:

computing a similarity score between the two sentences based on cosine similarities between vector embeddings of the two sentences, and

subtracting a scaled average of similarity scores between each sentence in the source language and all sentences of the target language in the training dataset and between each sentence in the target language and all sentences in the source language from the computed similarity score;

computing a loss objective based on computed pairwise token-level similarities associated with the positive input pair and the plurality of negative input pairs;

updating the pretrained multi-lingual model based on the loss objective; and

performing an alignment task between the source language and another language different from the target language using the updated pretrained multi-lingual model.

2. The method of claim 1 , wherein the vector embeddings of the two sentences are computed by:

generating, via a contextual embedding encoder, a first contextual embedding and a second contextual embedding of the two sentences within the respective positive input pair or negative input pair.

3. The method of claim 2 , wherein the pairwise token-level similarity between the two sentences is computed by:

computing a first set of pairwise cosine similarities between all vectors in the first contextual embedding and a first vector in the second contextual embedding;

determining a first maximum similarity among the first set of pairwise cosine similarities; and

determining a first score based on the first maximum similarity.

4. The method of claim 3 , further comprising:

computing a second set of pairwise cosine similarities between all vectors in the second contextual embedding and a second vector in the first contextual embedding;

determining a second maximum similarity among the second set of pairwise cosine similarities; and

determining a second score based on the second maximum similarity.

5. The method of claim 4 , further comprising:

computing the similarity score based on the first score and the second score.

6. The method of claim 1 , wherein the loss objective is computed as a contrastive loss using the computed pairwise token-level similarity for each positive input pair or negative input pair as output logit from the pretrained multi-lingual model.

7. The method of claim 1 , wherein the source language and the target language belong to a group of rich-source languages.

8. The method of claim 1 , wherein the another language is a rare-source language, and wherein the pre-trained multi-lingual model is not trained on any language sample of the rare-source language.

9. The method of claim 1 , wherein neither the source language nor the target language is English.

10. A system of cross-lingual sentence alignment, the system comprising:

a communication interface receiving a training dataset comprising at least a first sentence in a source language and a second sentence in a target language that is a translated version of the first sentence;

a memory storing a pretrained multi-lingual model and a plurality of processor-executable instructions; and

a processor executing the plurality of processor-executable instructions to perform operations comprising:

forming a positive input pair comprising the first sentence and the second sentence and a plurality of negative input pairs, each comprising the first sentence and a respective non-matching sentence in the target language;

computing, via the pretrained multi-lingual model, a pairwise token-level similarity between two sentences within each positive input pair or negative input pair, wherein the pairwise token-level similarity between the two sentences is computed by:

computing a similarity score between the two sentences based on cosine similarities between vector embeddings of the two sentences, and

subtracting a scaled average of similarity scores between each sentence in the source language and all sentences of the target language in the training dataset and between each sentence in the target language and all sentences in the source language from the computed similarity score;

computing a loss objective based on computed pairwise token-level similarities associated with the positive input pair and the plurality of negative input pairs;

updating the pretrained multi-lingual model based on the loss objective; and

performing an alignment task between the source language and another language different from the target language using the updated pretrained multi-lingual model.

11. The system of claim 10 , wherein the vector embeddings of the two sentences are computed by:

generating, via a contextual embedding encoder, a first contextual embedding and a second contextual embedding of the two sentences within the respective positive input pair or negative input pair.

12. The system of claim 11 , wherein the pairwise token-level similarity between the two sentences is computed by:

computing a first set of pairwise cosine similarities between all vectors in the first contextual embedding and a first vector in the second contextual embedding;

determining a first maximum similarity among the first set of pairwise cosine similarities;

determining a first score based on the first maximum similarity;

computing a second set of pairwise cosine similarities between all vectors in the second contextual embedding and a second vector in the first contextual embedding;

determining a second maximum similarity among the second set of pairwise cosine similarities;

determining a second score based on the second maximum similarity; and

computing the similarity score based on the first score and the second score.

13. The system of claim 10 , wherein the loss objective is computed as a contrastive loss using the computed pairwise token-level similarity for each positive input pair or negative input pair as output logit from the pretrained multi-lingual model.

14. The system of claim 10 , wherein the source language and the target language belong to a group of rich-source languages.

15. The system of claim 1 , wherein the another language is a rare-source language, and wherein the pre-trained multi-lingual model is not trained on any language sample of the rare-source language.

16. The system of claim 10 , wherein neither the source language nor the target language is English.

17. A non-transitory processor-readable storage medium storing a plurality of processor-executable instructions for cross-lingual sentence alignment, the instructions being executed by a processor to perform operations comprising:

receiving, via a communication interface, a training dataset comprising at least a first sentence in a source language and a second sentence in a target language that is a translated version of the first sentence;

forming a positive input pair comprising the first sentence and the second sentence and a plurality of negative input pairs, each comprising the first sentence and a respective non-matching sentence in the target language;

computing, via a pretrained multi-lingual model, a pairwise token-level similarity between two sentences within each positive input pair or negative input pair, wherein the pairwise token-level similarity between the two sentences is computed by:

computing a similarity score between the two sentences based on cosine similarities between vector embeddings of the two sentences, and

subtracting a scaled average of similarity scores between each sentence in the source language and all sentences of the target language in the training dataset and between each sentence in the target language and all sentences in the source language from the computed similarity score;

computing a loss objective based on computed pairwise token-level similarities associated with the positive input pair and the plurality of negative input pairs;

updating the pretrained multi-lingual model based on the loss objective; and

performing an alignment task between the source language and another language different from the target language using the updated pretrained multi-lingual model.

18. The non-transitory processor-readable storage medium of claim 17 , wherein the operations further comprise:

generating, via a contextual embedding encoder, a first contextual embedding and a second contextual embedding of the two sentences within the respective positive input pair or negative input pair;

computing a first set of pairwise cosine similarities between all vectors in the first contextual embedding and a first vector in the second contextual embedding;

determining a first maximum similarity among the first set of pairwise cosine similarities;

determining a first score based on the first maximum similarity;

computing a second set of pairwise cosine similarities between all vectors in the second contextual embedding and a second vector in the first contextual embedding;

determining a second maximum similarity among the second set of pairwise cosine similarities;

determining a second score based on the second maximum similarity; and

computing the similarity score based on the first score and the second score.

19. The non-transitory processor-readable storage medium of claim 17 , wherein the source language and the target language belong to a group of rich-source languages,

wherein the another language is a rare-source language, and

wherein the pre-trained multi-lingual model is not trained on any language sample of the rare-source language.

Assignments (2)
CHANGE OF NAME Recorded Aug 4, 2026
From: SALESFORCE.COM, INC.
To: SALESFORCE, INC.
Reel/Frame 076118/0548 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 24, 2023
From: NIU, TONG; ZHOU, YINGBO; XIONG, CAIMING; HASHIMOTO, KAZUMA
To: SALESFORCE.COM, INC.
Reel/Frame 063747/0489 →
Continuity (2)
Provisional Application 63279476 · Nov 15, 2021
Related Publication 20230153542A1 · May 18, 2023