What it is
A language model is a program that, given some text, estimates how likely each possible next piece of text is. Repeat that step and it can continue a sentence, answer a question or write code. Older models counted word sequences; modern ones are neural networks with billions of parameters.
What it is for
Autocomplete, translation, summaries, chat assistants, search, writing help. A language model is the engine inside a chatbot: the same basic skill, predicting what comes next, covers a surprising number of tasks.
How to do it
- Understand the loop: the text is cut into tokens (word pieces), the model scores every possible next token, one is chosen, added to the text, and the loop repeats.
- Use an existing model through a chat app or an API instead of training your own: training from scratch needs huge data and computing power.
- Write a clear prompt: say the task, give the context it needs and, if useful, an example of the answer you want.
- Control the output with settings such as temperature (low = predictable, high = more varied) and a maximum length.
- Check the result: a language model can produce fluent text that is wrong, so verify facts that matter.
- If the model is not good enough for your task, move up to better prompts, retrieval of your own documents, or fine-tuning, in that order.