chatML <|im_start|> — Start a message block <|im_end|> — End a message block <|action_start|> — Start an external tool invocation <|action_end|> — End the tool block <|interpreter|> — Token indicating the interpreter tool <|plugin|> — Token marking plugins/tools SFT SFT doesn’t teach new facts - it teaches new behaviors. The model already knows about the world from pre-training; SFT teaches it how to be a helpful assistant using that knowledge. Gradient accumulation is a technique where you add up gradients from several small mini‑batches before updating the model’s weights, so it feels like training with a bigger batch without needing more memory. Parameter efficient fine tuning (PEFT) set of techniques/umbrella term for adapting a pre trained model to a specific task by only tuning models much faster, with far less compute, memory and storage while keeping most of model’s knowledge intact. some techniques: LoRA (Low rank adaptation) instead of updating a full weight matrix W of a layer during fine-tuning, LoRA approximates the update with a product of two smaller matrices, typically A and BTraditional fine‑tuning: W' = W + ΔW LoRA fine‑tuning: W' = W + B·A for a weight matrix W of shape (dxk) LoRA introduces two small trainable matrices B of shape (dxr) A of shape (rxk) r is the rank hyperparameter and is chosen to be smaller than d and k (e.g. r=4, 8, 16)the product of B and A is the same shape as W but costs har fewer trainable paramsafter finetuning add the approximate weights back to original model…… Preference alignment process of training/adapting AI so its outputs match human preferenes, values and intentions RLHF: human annotators rank responses, a reward model is trained from those rankings, language model is fine tuned to maximize that rewardyou start with a pretrained modelhuman labellers write/select high quality responses(model outputs) to prompts(model inputs)human labellers rank/score the human responses, you train a reward ML model that tries to predict the numeric scores generated by humans. once reward model is trained, the model assigns higher scores to outputs that humans liked morellm is then trained using an RL algorithm via PPO (proximal policy optimization) to maximize the reward model scorethe llm is then trained to behave more like a humanDPO: instead of training the reward model, you give model pairs of responses where humans marked one as preferred, DPO then trains the model to make preferred output more likely and dispreffered less likely on similar promptsfor each prompt, you have two responses y_l (loser), y_w (winner)for each pair, you compute model log-probabilitiesuse a preference loss encourages model to prefer winning responseSuppose for prompt: “What’s the capital of France?” You have: Model response A: “Paris” (preferred) Model response B: “Marseille” (dispreferred) DPO will update the model so that: 𝑃(Paris∣prompt)P(Paris∣prompt) increases 𝑃(Marseille∣prompt)P(Marseille∣prompt) decreases ORPO (odds ratio preference optimzation)what usually happens is you perform SFT on relevant dataset of good respones apply DPO using human preference data to align with human preferencespeople apply sft first becuase sft teaches model basic instruction and output patterns first, that gives DPO a better foundation so preference optimization focuses on nuance rather than teaching model basic behavioursORPO integrates alignment directly into the training loss using odds ratio term. It uses preference data directly during SFT with a loss term that reinforces a good response and penalizes bad ones simultaneously ORPO loss = SFT loss + lambda x odds ratio loss Any-to-Any models these models have multiple encoders and then fuse embeddings to create a shared representation space. The decoders use shared latent space as input and decode into modality of choice GRPO (Group relative policy optimization) instead of learning a value funcction (critic) like PPO does, GRPO samples a group of responses for the same prompt scores them using a reward model computes relative advantages within the group updates the policy to prefer better responses relative to others sample a promptgenerate N response using current policyscore each response with a reward modelcompute relative advantage within the groupupdate the policy using these relative advantagesapply a KL penalty to keep thte model close to the base policy