IP Library Granted Patent US 10,769,383
Granted Patent B2
US 10,769,383 · App. 16/743,224 · Granted Sep 8, 2020

Cluster-based word vector processing method, device, and apparatus

Inventors: Shaosheng Cao (Hangzhou, CN); Xinxing Yang (Hangzhou, CN); Jun Zhou (Hangzhou, CN); Xiaolong Li (Hangzhou, CN)
Assignee: Alibaba Group Holding Limited
G06F40/30G06F40/40G06N3/08
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 10,769,383
App. No.
16/743,224
Granted
Sep 8, 2020
Kind
B2
Abstract

Embodiments of the present application disclose a cluster-based word vector processing method, apparatus, and device. Solutions are include: in a cluster having a server cluster and a worker computer cluster, in which each worker computer in the worker computer cluster separately reads some corpuses in parallel, extracts a word and context words of the word from the read corpuses, obtains corresponding word vectors from a server in the server cluster, and trains the corresponding word vectors, and the server cluster updates word vectors of same words that are stored before the training according to training results of one or more respective worker computers with respect to the word vectors of the same words.

Claims (453)

1. A cluster-based word vector processing method to be performed at a cluster comprising a plurality of worker computers, the method comprising operations performed by each of the worker computers:

obtaining a word and at least one context word of the word that are extracted from a respective portion of a corpus through distributed reading;

creating a word pair according to the respective portion of the corpus, wherein the word pair comprises the word and a context word of the at least one context word;

obtaining word vectors for the word and at least one context word;

training the word vectors according to one or more of a designated loss function, a designated negative sample word, or the created word pair to generate training results, by:

traversing the corpus to obtain current words in the corpus; and

calculating a gradient according to one or more of the designated loss function, the designated negative sample word, or the created word pair, and iteratively updating word vectors of the current words and context words of the current words according to the following formulas:

{right arrow over (w)} i,t+1 ={right arrow over (w)} i,t +g{right arrow over (c)} i,t ,w∈B i,k and

{right arrow over (c)} i,t+1 ={right arrow over (c)} i,t +g{right arrow over (w)} i,t ,c∈Γ ( w ),

wherein

g

=

α

(

y

-

σ

(

w

·

c

)

)

,

y

=

{

1

,

{

w

,

c

}

0

,

{

w

,

c

}

,

w represents a current word, c represents a context word of w, c′ represents a negative sample word, {right arrow over (w)} represents a word vector of w, {right arrow over (c)} represents a word vector of c, {right arrow over (w)} i,t and {right arrow over (c)} i,t represent a i th update on an i th worker computer, B i,k represents a k th corpus on the i th worker computer, Γ(w) represents a context word set of w, α represents a learning rate, and σ is a sigmoid function; and

forwarding to a server cluster the training results to enable the server cluster to update the word vectors of the word and at least one context word based on the training results.

2. The method according to claim 1 , wherein the server cluster comprises a plurality of servers, and wherein the obtaining a word and at least one context word of the word that are extracted from a respective portion of a corpus through distributed reading comprises:

obtaining a word set and a context word set through extraction according to the created word pair; and

obtaining word vectors for words included in the word set and the context word set from one of the servers.

3. The method according to claim 1 , wherein the iteratively updating word vectors of the current words and context words of the current words comprises:

iteratively updating, by one or more threads on a respective worker computer, the word vectors of the current words and context words of the current words using asynchronous calculation without locking.

4. The method according to claim 2 , wherein one of the servers is configured to perform:

obtaining training results with respect to the word vectors of the same words from one or more of the worker computers;

performing average calculation according to the training results and the word vectors of the same words that are stored before the training, to obtain vector increment values; and

updating the word vectors of the same words according to the vector increment values.

5. The method according to claim 4 , wherein the performing average calculation according to the training results and the word vectors of the same words that are stored before the training, to obtain vector increment values comprises:

obtaining the vector increment values through calculation according to the following formulas:

Δ

(

w

)

=

I

i

=

0

λ

i

(

w

)

(

w

i

,

T

-

w

srv

)

I

i

=

0

λ

i

(

w

)

and

Δ

(

c

)

=

I

i

=

0

λ

i

(

c

)

(

c

i

,

T

-

w

srv

)

I

i

=

0

λ

i

(

c

)

,

wherein w represents a current word, c represents a context word of w, {right arrow over (w)} represents a word vector of w, {right arrow over (c)} represents a word vector of c, {right arrow over (w)} i,T and {right arrow over (c)} i,T represent an iterative update result on an i th worker computer, λ i (w) represents a quantity of occurrences of w on the i th worker computer, and {right arrow over (w)} srv represents {right arrow over (w)} stored by a respective server before the training.

6. A cluster comprising a server cluster and a worker-computer cluster including a plurality of worker computers, wherein each of the worker computers is configured to perform operations including:

obtaining a word and at least one context word of the word that are extracted from a respective portion of a corpus through distributed reading;

creating a word pair according to the respective portion of the corpus, wherein the word pair comprises the word and a context word of the at least one context word;

obtaining word vectors for the word and the at least one context word;

training the word vectors according to one or more of a designated loss function, a designated negative sample word, or the created word pair to generate training results, by:

traversing the corpus to obtain current words in the corpus; and

calculating a gradient according to one or more of the designated loss function, the designated negative sample word, or the created word pair, and iteratively updating word vectors of the current words and context words of the current words according to the following formulas:

{right arrow over (w)} i,t+1 ={right arrow over (w)} i,t +g{right arrow over (c)} i,t ,w∈B i,k and

{right arrow over (c)} i,t+1 ={right arrow over (c)} i,t +g{right arrow over (w)} i,t ,c∈Γ ( w ),

wherein

g

=

α

(

y

-

σ

(

w

·

c

)

)

,

y

=

{

1

,

{

w

,

c

}

0

,

{

w

,

c

}

,

w represents a current word, c represents a context word of w, c′ represents a negative sample word, {right arrow over (w)} represents a word vector of w, {right arrow over (c)} represents a word vector of c, {right arrow over (w)} i,t and {right arrow over (c)} i,t represent a i th update on an i th worker computer, B i,k represents a k th corpus on the i th worker computer, Γ(w) represents a context word set of w, α represents a learning rate, and σ is a sigmoid function; and

forwarding to the server cluster the training results to enable the server cluster to update the word vectors for the word and the at least one context word based on the training results.

7. The cluster according to claim 6 , wherein the server cluster comprises a plurality of servers, and wherein the obtaining a word and at least one context word of the word that are extracted from a respective portion of a corpus through distributed reading comprises:

obtaining a word set and a context word set through extraction according to the created word pair; and

obtaining word vectors for words included in the word set and the context word set from one of the servers.

8. The cluster according to claim 6 , wherein the iteratively updating word vectors of the current words and context words of the current words comprises:

iteratively updating, by one or more threads on a respective worker computer, the word vectors of the current words and context words of the current words using asynchronous calculation without locking.

9. The cluster according to claim 7 , wherein one of the servers is configured to perform:

obtaining training results with respect to the word vectors of the same words from one or more the worker computers;

performing average calculation according to the training results and the word vectors of the same words that are stored before the training, to obtain vector increment values; and

updating the word vectors of the same words according to the vector increment values.

10. The cluster according to claim 9 , wherein the performing average calculation according to the training results and the word vectors of the same words that are stored before the training, to obtain vector increment values comprises:

obtaining the vector increment values through calculation according to the following formulas:

Δ

(

w

)

=

I

i

=

0

λ

i

(

w

)

(

w

i

,

T

-

w

srv

)

I

i

=

0

λ

i

(

w

)

and

Δ

(

c

)

=

I

i

=

0

λ

i

(

c

)

(

c

i

,

T

-

w

srv

)

I

i

=

0

λ

i

(

c

)

,

wherein w represents a current word, c represents a context word of w, {right arrow over (w)} represents a word vector of w, {right arrow over (c)} represents a word vector of c, {right arrow over (w)} i,T and {right arrow over (c)} i,T represent an iterative update result on an i th worker computer, λ i (w) represents a quantity of occurrences of w on the i th worker computer, and {right arrow over (w)} srv represents {right arrow over (w)} stored by a respective server before the training.

11. A non-transitory computer-readable storage medium storing instructions executable by one or more processors to cause the one or more processors to perform, at a cluster comprising a worker computer cluster including a plurality of worker computers and a server cluster, operations at each of worker computers:

obtaining a word and at least one context word of the word that are extracted from a respective portion of a corpus through distributed reading;

creating a word pair according to the respective portion of the corpus, wherein the word pair comprises the word and a context word of the at least one context word;

obtaining word vectors for the word and the at least one context word;

training the word vectors according to one or more of a designated loss function, a designated negative sample word, or the created word pair to generate training results, by:

traversing the corpus to obtain current words in the corpus; and

calculating a gradient according to one or more of the designated loss function, the designated negative sample word, or the created word pair, and iteratively updating word vectors of the current words and context words of the current words according to the following formulas:

{right arrow over (w)} i,t+1 ={right arrow over (w)} i,t +g{right arrow over (c)} i,t ,w∈B i,k and

{right arrow over (c)} i,t+1 ={right arrow over (c)} i,t +g{right arrow over (w)} i,t ,c∈Γ ( w ),

wherein

g

=

α

(

y

-

σ

(

w

·

c

)

)

,

y

=

{

1

,

{

w

,

c

}

0

,

{

w

,

c

}

,

w represents a current word, c represents a context word of w, c′ represents a negative sample word, {right arrow over (w)} represents a word vector of w, {right arrow over (c)} represents a word vector of c, {right arrow over (w)} i,t and {right arrow over (c)} i,t represent a i th update on an i th worker computer, B i,k represents a k th corpus on the i th worker computer, Γ(w) represents a context word set of w, α represents a learning rate, and σ is a sigmoid function; and

forwarding to the server cluster the training results to enable the server cluster to update the word vectors for the word and the at least one context word based on the training results.

12. The non-transitory computer-readable storage medium according to claim 11 , wherein the server cluster comprises a plurality of servers, and wherein the obtaining a word and at least one context word of the word that are extracted from a respective portion of a corpus through distributed reading comprises:

obtaining a word set and a context word set through extraction according to the created word pair; and

obtaining word vectors for words included in the word set and the context word set from one of the servers.

13. The non-transitory computer-readable storage medium according to claim 11 , wherein the iteratively updating word vectors of the current words and context words of the current words comprises:

iteratively updating, by one or more threads on a respective worker computer, the word vectors of the current words and context words of the current words using asynchronous calculation without locking.

14. The non-transitory computer-readable storage medium according to claim 12 , wherein one of the servers is configured to perform:

obtaining training results with respect to the word vectors of the same words from one or more of the worker computers;

performing average calculation according to the training results and the word vectors of the same words that are stored before the training, to obtain vector increment values; and

updating the word vectors of the same words according to the vector increment values.

15. The non-transitory computer-readable storage medium according to claim 14 , wherein the performing average calculation according to the training results and the word vectors of the same words that are stored before the training, to obtain vector increment values comprises:

obtaining the vector increment values through calculation according to the following formulas:

Δ

(

w

)

=

I

i

=

0

λ

i

(

w

)

(

w

i

,

T

-

w

srv

)

I

i

=

0

λ

i

(

w

)

and

Δ

(

c

)

=

I

i

=

0

λ

i

(

c

)

(

c

i

,

T

-

w

srv

)

I

i

=

0

λ

i

(

c

)

,

wherein w represents a current word, c represents a context word of w, {right arrow over (w)} represents a word vector of w, {right arrow over (c)} represents a word vector of c, {right arrow over (w)} i,T and {right arrow over (c)} i,T represent an iterative update result on an i th worker computer, λ i (w) represents a quantity of occurrences of w on the i th worker computer, and {right arrow over (w)} srv represents {right arrow over (w)} stored by a respective server before the training.

Assignments (3)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 16, 2020
From: ADVANTAGEOUS NEW TECHNOLOGIES CO., LTD.
To: ADVANCED NEW TECHNOLOGIES CO., LTD.
Reel/Frame 053796/0281 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 3, 2020
From: ALIBABA GROUP HOLDING LIMITED
To: ADVANTAGEOUS NEW TECHNOLOGIES CO., LTD.
Reel/Frame 053702/0392 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 15, 2020
From: CAO, SHAOSHENG; YANG, XINXING; ZHOU, JUN; LI, XIAOLONG
To: ALIBABA GROUP HOLDING LIMITED
Reel/Frame 051521/0479 →