LLMs in Lingustic Research WiSe 2024/25
16 Oct 2024
Scalars: single number
\[ x = 1 \]
Vectors: sequence of numbers
\[ v = \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} \]
Matrix: 2D list of numbers
\[ M = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix} \]
Matrix multiplication
\[ \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix} \times \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ 5 & 6 \end{bmatrix} \]
\[ = \begin{bmatrix} 22 & 28 \\ 49 & 64 \end{bmatrix} \]
Explanation:
Element-wise multiplication
\[ \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix} \odot \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix} \]
\[ = \begin{bmatrix} 1 & 4 & 9 \\ 16 & 25 & 36 \end{bmatrix} \]
Matrix addition
\[ \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix} + \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix} \]
\[ = \begin{bmatrix} 2 & 4 & 6 \\ 8 & 10 & 12 \end{bmatrix} \]
Dot product
\[ \begin{bmatrix} 1 & 2 & 3 \end{bmatrix} \cdot \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} \]
\[ = 1 \times 1 + 2 \times 2 + 3 \times 3 = 14 \]
Let us say that you are given a set of inputs and outputs. You need to find how the inputs are related to the outputs.
Inputs: \(0,1,2,3,4\)
Outputs: \(0,2,4,6,8\)
Consider a more complex relationship between inputs and outputs.
Inputs: \(0,1,2,3,4\)
Outputs: \(0,1,1,2,3\)
Neural networks are a class of machine learning models inspired by the human brain.
Learning Alorithm
Advantages of neural networks
The input can be a vector, and the output some classification, like a corresponding animal.
Every Neural Network has Layers. They are responsible for a specific action, like addition, and pass information to eachother.
Layers consist of neurons which each modify the input in some way.
The simplest Neural network only has one layer with one neuron. This is called a perceptron.
\[ \text{Output} = f(w_1 \times x_1 + w_2 \times x_2 + w_3 \times x_3 + b) \]
Why do we need non-linearity?
(\(w_1 \times x_1 + w_2 \times x_2 + w_3 \times x_3 + b\))
The sum is passed through an activation function.
The output of the activation function becomes the output of the perceptron.
The perceptron learns the weights and bias.
It compares its output to the desired output and makes corrections.
This process is repeated many times with all the inputs.
LLMs in Lingustic Research WiSe 2024/25