Natural Language Processing
Keep the IDs and embeddings together
The same integer now names another token
Botie is changing token order while keeping learned vectors. A row must move with its token or the new vocabulary IDs will retrieve someone else's features.
BOTIE
The inputs we are comparing
Old token order
Example 1
- 0cat
- 1dog
Example 2
- 0red
- 1blue
Old embedding rows
Example 1
| 1 | 0 |
| 0 | 2 |
Example 2
| 3 | 1 |
| 1 | 4 |
New token order
Example 1
- 0dog
- 1cat
Example 2
- 0blue
- 1red
IDs in the new vocabulary
Example 1
- 00
- 11
- 20
Example 2
- 01
- 10
Result for example 1
| 0 | 2 |
| 1 | 0 |
| 0 | 2 |
Three tree tokens change their addresses
This check uses the pieces from “Move embedding rows by token identity”.
BOTIE
- Old token order
- 0oak
- 1elm
- 2ash
- Old embedding rows
1 0 0 2 3 3 - New token order
- 0ash
- 1oak
- 2elm
- IDs in the new vocabulary
- 02
- 10
- 22
Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. Saving your prediction runs your current construction on these inputs and checks the earlier examples too.
Build a construction in the workspace above first. This case will test those pieces.
How does the repeated ID in the first example help check that identity survived the move?
Preserve token identity across vocabulary migrations and check special-token conventions separately.
This is a small construction problem. The lesson explains the assumptions and the parts of the full method that this example leaves out.
Work through the Python challenges →