Language models are pretrained to predict the next token across trillions of tokens of text and code, absorbing grammar, facts and reasoning patterns. Pretraining is by far the most expensive stage.
Afterwards, instruction tuning and preference training turn the raw model into a helpful assistant.