Great article on how this works: https://towardsdatascience.com/a-beginners-guide-to-llm-fine-tuning-4bae7d4da672