Graph-based cross-lingual zero-shot transfer
Methods and systems for natural language processing include generating an encoder that includes a global part and a local part, where the global part encodes multi-hop relations between words in an input and where the local part encodes one-hop relations between words in the input. The encoder is trained to form a graph that represents tokens of an input text as nodes and that represents relations between the tokens as edges between the nodes.
1. A method for natural language processing, comprising:
generating an encoder that includes a global part and a local part, where the global part encodes multi-hop relations between words in an input and uses soft paths to characterize multi-hop relations in input text and where the local part encodes one-hop relations between words in the input;
training the encoder to form a graph that represents tokens of the input text as nodes and that represents relations between the tokens as edges between the nodes.
2. The method of claim 1 , wherein training the encoder includes parsing dependencies between tokens of the input text to determine relations between the tokens.
3. The method of claim 2 , wherein training the encoder includes tokenizing the input text into words.
4. The method of claim 3 , wherein tokenizing the input text further comprises tokenizing words of the input text into sub-words.
5. The method of claim 1 , wherein training the encoder includes setting relations between head words of each sentence relating to a sentence type.
6. The method of claim 1 , wherein the local part includes a self-attention that includes relation biases on source/target nodes and a prior bias on relation types.
7. The method of claim 6 , wherein the local part further includes attention masking to prevent non-trivial inductive bias.
8. The method of claim 1 , wherein the soft paths include a concatenation of respective pairs of paths from nodes to a root node.
9. The method of claim 1 , wherein the encoder further includes a first linear layer to predict a start position of a span in the input text and a second linear layer to predict an end position of the span.
10. A system for natural language processing, comprising:
a hardware processor; and
a memory that stores a computer program, which, when executed by the hardware processor, causes the hardware processor to:
generate an encoder that includes a global part and a local part, where the global part encodes multi-hop relations between words in an input and where the local part encodes one-hop relations between words in the input and uses soft paths to characterize multi-hop relations in input text; and
train the encoder to form a graph that represents tokens of the input text as nodes and that represents relations between the tokens as edges between the nodes.
11. The system of claim 10 , wherein the computer program further causes the hardware processor to parse dependencies between tokens of the input text to determine relations between the tokens.
12. The system of claim 11 , wherein the computer program further causes the hardware processor to tokenize the input text into words.
13. The system of claim 12 , wherein the computer program further causes the hardware processor to tokenize the words of the input text into sub-words.
14. The system of claim 10 , Wherein the computer program further causes the hardware processor to set relations between head words of each sentence relating to a sentence type.
15. The system of claim 10 , wherein the local part includes a self-attention that includes relation biases on source/target nodes and a prior bias on relation types.
16. The system of claim 15 , wherein the local part further includes attention masking to prevent non-trivial inductive bias.
17. The system of claim 10 , wherein the soft paths include a concatenation of respective pairs of paths from nodes to a root node.
18. The system of claim 10 , wherein the encoder further includes a first linear layer to predict a start position of a span in the input text and a second linear layer to predict an end position of the span.