Token embedding (machine learning): Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
[[File:Sub-word token embedding.png|thumbnail|350px|A visual representation of embedding of sub-word tokens in [[natural language processing (NLP)]].]] | [[File:Sub-word token embedding.png|thumbnail|350px|A visual representation of embedding of sub-word tokens in [[natural language processing (NLP)]].]] | ||
[[File:Embedding space.png|thumbnail|350px|Each dimension of an '''embedding space''' encodes some semantic meaning. As such, words with similar meanings are spatially adjacent to each other.]] | [[File:Embedding space.png|thumbnail|350px|Each dimension of an '''embedding space''' encodes some semantic meaning. As such, words with similar meanings are spatially adjacent to each other.]] | ||
[[File:Token embedding 2.png|thumbnail|350px|Since each dimension encodes some semantic meaning, vector addition/subtraction can add/extract meaning to tokens and relate them to other tokens.]] | |||
Let $t_i \in T$ be [[token (machine learning)|token]]s obtained from [[tokenisation (machine learning)|tokenisation]] of raw data. | Let $t_i \in T$ be [[token (machine learning)|token]]s obtained from [[tokenisation (machine learning)|tokenisation]] of raw data. | ||
Revision as of 20:46, 10 November 2026



Let $t_i \in T$ be tokens obtained from tokenisation of raw data.
Let $\mathbb{E}\equiv \mathbb{R}^n$ be a vector space.
Then vector embedding function
$$\begin{gathered} \operatorname{E}: T \to \mathbb{E}\\ \forall t_i \in T: t_i \mapsto \vec{e}_i \end{gathered}$$
$\mathbb{E}$ is then known as the n-dimensional embedding space of $\operatorname{E}$, which contains embedding vectors $\vec e_i$.
Matrix representation
Let $\mathbf{E} \in \mathbb{R}^{|\mathcal{V}| \times n}$ be an vector embedding matrix.
$$ \vec{e}_i = \mathbf{E}[t_i]. $$