Page 6 - LARGE LANUGAGE MODEL AND SMALL LANUGAGE MODEL
P. 6
Step IV: Transformer architecture
LLMs are based on the transformer architecture, composed of several layers of self-attention
mechanisms. The mechanism computes attention scores for each word in a sentence,
considering its interactions with every other word. Thus, by assigning different weights to
different words, LLMs can effectively focus on the most relevant information, facilitating
accurate and contextually appropriate text generation.
Step V: Fine-tuning
After the pre-training phase, the LLM can be fine-tuned on specific tasks or domains. Fine-
tuning involves providing the model with task-specific labeled data, allowing it to learn the
intricacies of a particular task. This process helps the LLM specialize in tasks such as sentiment
analysis, Q&A, and so on.
Step VI: Inference
Once the LLM is trained and fine-tuned, it can be used for inference. Inference involves utilizing
the model to generate text or perform specific language-related tasks. For example, given a
prompt or a question, the LLM can generate a coherent response or provide an answer by
leveraging its learned knowledge and contextual understanding.
Step VII: Contextual understanding
LLMs excel at capturing context and generating contextually appropriate responses. They use
the information provided in the input sequence to generate text that considers the preceding
context. The self-attention mechanisms in the transformer architecture play a crucial role in the
LLM’s ability to capture long-range dependencies and contextual information.