{
 "id": "oellm-9b-threeway-dpo",
 "title": "Full-weight DPO on 1.4 million preference pairs",
 "dish": "A 9B multilingual model, preference-tuned with DPO",
 "lede": "Take a supervised fine-tuned 9B model and tune it on pairs of preferred and rejected answers. One epoch, every weight updated, 32 GPUs, under two days.",
 "stage": "Preference tuning",
 "lab": "OpenEuroLLM",
 "author": "Birger Moell",
 "date": "2026-11-19",
 "status": "Run once by its author. Not yet reproduced by anyone else.",
 "checkpoint": "https://huggingface.co/birgermoell/oellm-9b-threeway-dpo-full-v1",
 "repo_files": "https://huggingface.co/birgermoell/oellm-9b-threeway-dpo-full-v1/blob/main/",
 "glance": [
  {
   "k": "Makes",
   "v": "1",
   "u": "9B checkpoint"
  },
  {
   "k": "Cook time",
   "v": "43 h 21 m",
   "u": "wall clock"
  },
  {
   "k": "Equipment",
   "v": "32",
   "u": "GPUs, 4 nodes"
  },
  {
   "k": "Ingredients",
   "v": "1.44M",
   "u": "preference pairs"
  }
 ],
 "data": {
  "total": 1441547,
  "validation": 15824,
  "removed": 43191,
  "sources": [
   {
    "name": "Dolci, translated",
    "id": "openeurollm/Dolci-Instruct-DPO-translated",
    "pairs": 1352763,
    "licence": "Apache 2.0",
    "pin": "revision a57841a6bbabfed8ca2597438995c2991e5b73b7",
    "pinned": true,
    "note": "12 languages"
   },
   {
    "name": "UltraFeedback, cleaned",
    "id": "argilla/ultrafeedback-binarized-preferences-cleaned",
    "pairs": 59889,
    "licence": "MIT",
    "pin": "not revision-pinned",
    "pinned": false,
    "note": "English"
   },
   {
    "name": "HelpSteer3, preference",
    "id": "nvidia/HelpSteer3",
    "pairs": 28895,
    "licence": "CC BY 4.0",
    "pin": "pre-staged files, not revision-pinned",
    "pinned": false,
    "note": "English; ties dropped (2,257)"
   }
  ],
  "languages": [
   [
    "en",
    243752
   ],
   [
    "es",
    126629
   ],
   [
    "sv",
    121715
   ],
   [
    "pl",
    119624
   ],
   [
    "ro",
    116510
   ],
   [
    "cs",
    116249
   ],
   [
    "uk",
    115372
   ],
   [
    "de",
    115264
   ],
   [
    "fi",
    109131
   ],
   [
    "el",
    101516
   ],
   [
    "it",
    87439
   ],
   [
    "fr",
    14931
   ]
  ],
  "checksums": [
   [
    "dolci-train.jsonl.gz",
    "4b90b32da77658c7ba03c48fa520de7315b44c2a5c9666fdbd140b741152025d"
   ],
   [
    "dolci-validation.jsonl.gz",
    "e977ef3b7985faa2f80164fed2df20e6762d92bd370cbb26bbe3bdc64b361093"
   ],
   [
    "helpsteer3-train.jsonl.gz",
    "adef5ff99bccdeb17da1569787f350d931ffc430fc1559782ba368cdc43db14c"
   ],
   [
    "helpsteer3-validation.jsonl.gz",
    "2d62737ce26decd9a2fb64980d3f8c64c729e07a5a75b3d0e3152261c93b7a11"
   ],
   [
    "ultrafeedback-train.jsonl.gz",
    "deec7153e13b1abf8002466be68c2dcc637ba8813e69f800393a9e2f0f7c4788"
   ],
   [
    "ultrafeedback-validation.jsonl.gz",
    "6aaa875a7d42a69ae73517a7ecd1d0d409fb27053fac796d0127498effbfdf4c"
   ]
  ]
 },
 "pantry": [
  [
   "Base model",
   "Neonkraft/oellm-9b-256k-theta64m-prelude-anneal300b-instruct-sft",
   "85bf18fb4f0bee6ac6270f06b1d1c6b3be200f31"
  ],
  [
   "Training code",
   "github.com/BirgerMoell/post-training",
   "64f3599 (from upstream db9d560011cb4502adaffe1ba3a94b87f9f404f4)"
  ],
  [
   "Container",
   "laif-rocm-6.4.4-pytorch-2.9.1-te-2.4.0-fa-2.8.0-triton-3.2.0.sif",
   "plus a project overlay of Python libraries"
  ],
  [
   "Software",
   "TRL 0.28.0 · Transformers 4.57.3 · PyTorch 2.9.1+rocm6.4",
   "Datasets 4.6.0 · Tokenizers 0.22.2"
  ],
  [
   "Seed",
   "42",
   "data split and training"
  ]
 ],
 "equipment": {
  "nodes": 4,
  "gpus_per_node": 8,
  "gpu": "AMD MI250 (LUMI, partition small-g)",
  "cpus": 56,
  "ram": "480 GB",
  "wall": "43 h 21 min",
  "gcd_hours": "about 1,387",
  "note": "The wall-clock time includes the final evaluation. The job requested 2 days."
 },
 "settings": [
  [
   "Objective",
   "DPO, sigmoid loss, beta 0.1"
  ],
  [
   "Reference model",
   "The frozen SFT starting model"
  ],
  [
   "Epochs",
   "1 (11,263 optimizer steps)"
  ],
  [
   "Learning rate",
   "5e-7, cosine schedule"
  ],
  [
   "Warmup",
   "3%"
  ],
  [
   "Batch size",
   "128 effective, 1 per device"
  ],
  [
   "Optimizer",
   "Adam, betas 0.9 / 0.999, epsilon 1e-8, no weight decay"
  ],
  [
   "Sequence length",
   "2,048 tokens, truncated pairs dropped"
  ],
  [
   "Chat template",
   "Qwen3"
  ],
  [
   "Precision",
   "bf16, FlashAttention 2"
  ],
  [
   "Memory",
   "FSDP, activation checkpointing"
  ],
  [
   "Checkpoints",
   "Every 1,000 steps, keep two, model only"
  ]
 ],
 "sbatch": "#!/bin/bash\n#SBATCH --job-name=oellm-3way-dpo-full\n#SBATCH --account=<your-project>\n#SBATCH --partition=small-g\n#SBATCH --nodes=4\n#SBATCH --gpus-per-node=8\n#SBATCH --ntasks-per-node=1\n#SBATCH --cpus-per-task=56\n#SBATCH --mem=480G\n#SBATCH --time=2-00:00:00\n#SBATCH --signal=B:USR1@300\n#SBATCH --output=<WORK>/logs/%j.out\n#SBATCH --error=<WORK>/logs/%j.err\n\nset -euo pipefail\nmodule purge\n\nGPUS_PER_NODE=8\nTRAIN_CONFIG=<WORK>/configs/oellm-9b-threeway-dpo-full-lumi.yaml\nCONTAINER=<SCRATCH>/containers/laif-rocm-6.4.4-pytorch-2.9.1-te-2.4.0-fa-2.8.0-triton-3.2.0.sif\nOVERLAY=<SCRATCH>/pylibs-overlay\nBIND=/pfs,/scratch,/flash,/project,/projappl,/appl,/opt/cray,/var/spool/slurmd\nHF_CACHE=<WORK>/artifacts/cache/huggingface\n\nmkdir -p \"$HF_CACHE\" <WORK>/outputs\nexport MASTER_ADDR=$(scontrol show hostnames \"$SLURM_JOB_NODELIST\" | head -n 1)\nexport MASTER_PORT=$(python3 -c \"import socket; s=socket.socket(); s.bind(('', 0)); print(s.getsockname()[1]); s.close()\")\nexport NCCL_SOCKET_IFNAME=hsn0,hsn1,hsn2,hsn3 NCCL_NET_GDR_LEVEL=PHB FI_CXI_DEFAULT_CQ_SIZE=131072\nexport TORCH_NCCL_TRACE_BUFFER_SIZE=1048576 TORCH_NCCL_DUMP_ON_TIMEOUT=1 TORCH_NCCL_DESYNC_DEBUG=1\nexport OMP_NUM_THREADS=7 PYTORCH_HIP_ALLOC_CONF=expandable_segments:True PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True\nWORLD_SIZE=$(( GPUS_PER_NODE * SLURM_NNODES ))\n\necho \"Full three-way DPO: config=$TRAIN_CONFIG nodes=$SLURM_NNODES world=$WORLD_SIZE\"\nsrun --label --export=ALL --wait=60 --kill-on-bad-exit=1 singularity exec -B \"$BIND\" \"$CONTAINER\" bash -lc \"\n  set -euo pipefail\n  export PYTHONPATH=$OVERLAY:$SLURM_SUBMIT_DIR/src:\\${PYTHONPATH:-}\n  export HF_HOME=$HF_CACHE HF_HUB_CACHE=$HF_CACHE/hub HUGGINGFACE_HUB_CACHE=$HF_CACHE/hub HF_DATASETS_CACHE=$HF_CACHE/datasets\n  export HF_HUB_OFFLINE=1 HF_DATASETS_OFFLINE=1 TRANSFORMERS_OFFLINE=1 HF_HUB_DISABLE_TELEMETRY=1 WANDB_MODE=disabled\n  export ACCELERATE_USE_FSDP=true FSDP_CPU_RAM_EFFICIENT_LOADING=1\n  cd $SLURM_SUBMIT_DIR\n  accelerate launch \\\n    --config_file configs/accelerate/fsdp_lumi.yaml \\\n    --num_machines $SLURM_NNODES \\\n    --num_processes $WORLD_SIZE \\\n    --machine_rank \\$SLURM_PROCID \\\n    --main_process_ip '$MASTER_ADDR' \\\n    --main_process_port '$MASTER_PORT' \\\n    scripts/train.py --config $TRAIN_CONFIG accelerate.use_deepspeed=false deepspeed=null\n\"\n",
 "steps": [
  {
   "t": "Get the code",
   "d": "Check out the exact training code.",
   "code": "git clone https://github.com/BirgerMoell/post-training\ncd post-training\ngit checkout 64f3599"
  },
  {
   "t": "Prepare the base model",
   "d": "Download the base model at the pinned revision. Then fix its tokenizer. The run used a repaired tokenizer configuration, and loading the original may not reproduce the training startup. Use the two files from the release.",
   "code": "hf download Neonkraft/oellm-9b-256k-theta64m-prelude-anneal300b-instruct-sft \\\n  --revision 85bf18fb4f0bee6ac6270f06b1d1c6b3be200f31 --local-dir <SCRATCH>/artifacts/model\nhf download birgermoell/oellm-9b-threeway-dpo-full-v1 \\\n  base_tokenizer_config_used.json tokenizer.model --local-dir ./release-files",
   "flag": "Confirm exactly how the two release files replace the base model's tokenizer files."
  },
  {
   "t": "Stage the data",
   "d": "The staging script builds the six training and validation files. It reads HelpSteer3 from files you must prepare first (preference-train.jsonl.gz and preference-validation.jsonl.gz), and it does not download them. Set the two path constants at the top of the script, then run it and check the fingerprints.",
   "code": "python stage_threeway_dpo_full.py\ncd <WORK>/artifacts/data/threeway-full\nsha256sum -c data_checksums.sha256",
   "flag": "HelpSteer3 and UltraFeedback were not revision-pinned, so the checksums only match if the sources have not changed."
  },
  {
   "t": "Set the paths",
   "d": "Copy the frozen config from the release. Change the model path and the six data paths to your own.",
   "code": "cp training_config.yaml <WORK>/configs/oellm-9b-threeway-dpo-full-lumi.yaml"
  },
  {
   "t": "Launch",
   "d": "Submit from the checked-out training repository. The script uses its src folder, scripts/train.py and configs/accelerate/fsdp_lumi.yaml.",
   "code": "sbatch training_slurm.sbatch"
  }
 ],
 "verify": {
  "curve": [
   [
    100,
    0.695,
    0.5123,
    0.006
   ],
   [
    200,
    0.6461,
    0.6482,
    0.133
   ],
   [
    300,
    0.5746,
    0.7238,
    0.438
   ],
   [
    400,
    0.5291,
    0.7551,
    0.693
   ],
   [
    500,
    0.4932,
    0.7738,
    0.92
   ],
   [
    600,
    0.4655,
    0.789,
    1.079
   ],
   [
    700,
    0.446,
    0.7963,
    1.218
   ],
   [
    800,
    0.4384,
    0.8052,
    1.291
   ],
   [
    900,
    0.4181,
    0.8168,
    1.448
   ],
   [
    1000,
    0.4106,
    0.8176,
    1.521
   ],
   [
    1100,
    0.405,
    0.8192,
    1.571
   ],
   [
    1200,
    0.3992,
    0.8214,
    1.653
   ],
   [
    1300,
    0.3838,
    0.8305,
    1.796
   ],
   [
    1400,
    0.3868,
    0.827,
    1.803
   ],
   [
    1500,
    0.3785,
    0.8314,
    1.843
   ],
   [
    1600,
    0.3736,
    0.837,
    1.89
   ],
   [
    1700,
    0.3594,
    0.8426,
    1.967
   ],
   [
    1800,
    0.3695,
    0.838,
    1.948
   ],
   [
    1900,
    0.3695,
    0.8353,
    2.022
   ],
   [
    2000,
    0.3622,
    0.8399,
    2.014
   ],
   [
    2100,
    0.3541,
    0.8442,
    2.055
   ],
   [
    2200,
    0.3543,
    0.8462,
    2.065
   ],
   [
    2300,
    0.3473,
    0.8466,
    2.127
   ],
   [
    2400,
    0.3341,
    0.8508,
    2.2
   ],
   [
    2500,
    0.3418,
    0.8477,
    2.239
   ],
   [
    2600,
    0.34,
    0.8492,
    2.236
   ],
   [
    2700,
    0.3265,
    0.8576,
    2.315
   ],
   [
    2800,
    0.3341,
    0.8532,
    2.283
   ],
   [
    2900,
    0.3233,
    0.855,
    2.411
   ],
   [
    3000,
    0.3203,
    0.8589,
    2.429
   ],
   [
    3100,
    0.316,
    0.8624,
    2.468
   ],
   [
    3200,
    0.3162,
    0.8606,
    2.47
   ],
   [
    3300,
    0.3187,
    0.857,
    2.467
   ],
   [
    3400,
    0.3133,
    0.8659,
    2.529
   ],
   [
    3500,
    0.3067,
    0.863,
    2.536
   ],
   [
    3600,
    0.3027,
    0.8675,
    2.595
   ],
   [
    3700,
    0.3054,
    0.8647,
    2.624
   ],
   [
    3800,
    0.306,
    0.868,
    2.613
   ],
   [
    3900,
    0.3059,
    0.8649,
    2.619
   ],
   [
    4000,
    0.3118,
    0.8623,
    2.521
   ],
   [
    4100,
    0.2962,
    0.8675,
    2.654
   ],
   [
    4200,
    0.2999,
    0.869,
    2.641
   ],
   [
    4300,
    0.3023,
    0.8684,
    2.677
   ],
   [
    4400,
    0.2936,
    0.8698,
    2.679
   ],
   [
    4500,
    0.2897,
    0.8742,
    2.738
   ],
   [
    4600,
    0.2967,
    0.8687,
    2.718
   ],
   [
    4700,
    0.2851,
    0.8798,
    2.783
   ],
   [
    4800,
    0.2844,
    0.8747,
    2.803
   ],
   [
    4900,
    0.2816,
    0.8766,
    2.824
   ],
   [
    5000,
    0.2866,
    0.8748,
    2.781
   ],
   [
    5100,
    0.2848,
    0.8766,
    2.806
   ],
   [
    5200,
    0.2892,
    0.8752,
    2.787
   ],
   [
    5300,
    0.279,
    0.8809,
    2.882
   ],
   [
    5400,
    0.2896,
    0.8716,
    2.809
   ],
   [
    5500,
    0.2731,
    0.8813,
    2.916
   ],
   [
    5600,
    0.2822,
    0.8784,
    2.863
   ],
   [
    5700,
    0.2739,
    0.8809,
    2.945
   ],
   [
    5800,
    0.2782,
    0.8799,
    2.932
   ],
   [
    5900,
    0.272,
    0.8848,
    2.956
   ],
   [
    6000,
    0.2646,
    0.8851,
    2.974
   ],
   [
    6100,
    0.268,
    0.8855,
    3.003
   ],
   [
    6200,
    0.2705,
    0.883,
    2.991
   ],
   [
    6300,
    0.2693,
    0.8831,
    2.958
   ],
   [
    6400,
    0.2691,
    0.882,
    3.005
   ],
   [
    6500,
    0.2735,
    0.8825,
    2.984
   ],
   [
    6600,
    0.2674,
    0.8837,
    3.018
   ],
   [
    6700,
    0.2708,
    0.8796,
    3.008
   ],
   [
    6800,
    0.2679,
    0.8859,
    3.089
   ],
   [
    6900,
    0.2668,
    0.8852,
    2.996
   ],
   [
    7000,
    0.2669,
    0.8836,
    2.979
   ],
   [
    7100,
    0.2685,
    0.8802,
    3.04
   ],
   [
    7200,
    0.2622,
    0.8845,
    3.012
   ],
   [
    7300,
    0.2668,
    0.8866,
    3.008
   ],
   [
    7400,
    0.2585,
    0.8904,
    3.074
   ],
   [
    7500,
    0.2703,
    0.8851,
    3.085
   ],
   [
    7600,
    0.2601,
    0.8872,
    3.079
   ],
   [
    7700,
    0.257,
    0.888,
    3.136
   ],
   [
    7800,
    0.2584,
    0.888,
    3.118
   ],
   [
    7900,
    0.2611,
    0.8886,
    3.101
   ],
   [
    8000,
    0.2587,
    0.8882,
    3.122
   ],
   [
    8100,
    0.2634,
    0.8815,
    3.101
   ],
   [
    8200,
    0.2566,
    0.8881,
    3.13
   ],
   [
    8300,
    0.2617,
    0.8873,
    3.116
   ],
   [
    8400,
    0.2492,
    0.895,
    3.155
   ],
   [
    8500,
    0.2547,
    0.8895,
    3.136
   ],
   [
    8600,
    0.2606,
    0.8855,
    3.137
   ],
   [
    8700,
    0.2528,
    0.8918,
    3.132
   ],
   [
    8800,
    0.2608,
    0.8866,
    3.121
   ],
   [
    8900,
    0.2632,
    0.8846,
    3.096
   ],
   [
    9000,
    0.2658,
    0.8859,
    3.126
   ],
   [
    9100,
    0.2553,
    0.8923,
    3.159
   ],
   [
    9200,
    0.2483,
    0.8945,
    3.163
   ],
   [
    9300,
    0.2503,
    0.8912,
    3.16
   ],
   [
    9400,
    0.2583,
    0.883,
    3.165
   ],
   [
    9500,
    0.2578,
    0.889,
    3.166
   ],
   [
    9600,
    0.2525,
    0.8919,
    3.148
   ],
   [
    9700,
    0.2591,
    0.8891,
    3.136
   ],
   [
    9800,
    0.2581,
    0.8871,
    3.142
   ],
   [
    9900,
    0.2564,
    0.8891,
    3.117
   ],
   [
    10000,
    0.2566,
    0.8883,
    3.161
   ],
   [
    10100,
    0.2555,
    0.8893,
    3.151
   ],
   [
    10200,
    0.2609,
    0.8844,
    3.123
   ],
   [
    10300,
    0.2545,
    0.8899,
    3.115
   ],
   [
    10400,
    0.253,
    0.8923,
    3.16
   ],
   [
    10500,
    0.2534,
    0.8933,
    3.168
   ],
   [
    10600,
    0.2618,
    0.8853,
    3.138
   ],
   [
    10700,
    0.2561,
    0.8891,
    3.146
   ],
   [
    10800,
    0.2623,
    0.8834,
    3.134
   ],
   [
    10900,
    0.2554,
    0.8889,
    3.162
   ],
   [
    11000,
    0.2539,
    0.8866,
    3.182
   ],
   [
    11100,
    0.2529,
    0.8887,
    3.211
   ],
   [
    11200,
    0.2585,
    0.8895,
    3.129
   ],
   [
    11260,
    0.252,
    0.8914,
    3.129
   ]
  ],
  "checks": [
   [
    "Step 100",
    "Loss about 0.69. The model starts out with no preference.",
    0.695
   ],
   [
    "Step 1,000",
    "Loss about 0.41, batch accuracy about 82%",
    0.4106
   ],
   [
    "Step 9,000",
    "Loss about 0.27, batch accuracy about 89%",
    0.2658
   ],
   [
    "End",
    "Held-out accuracy 0.878, margin 2.99, loss 0.280",
    0.2796
   ]
  ],
  "final": {
   "accuracy": 0.878,
   "margin": 2.993,
   "loss": 0.2796,
   "pairs": 15824,
   "train_loss": 0.3087,
   "train_hours": 42.8
  },
  "note": "Curves are the mean of ten logged batches, so each point covers 100 steps. A rerun will not match to the digit. In the original run the loss had left 0.69 by step 500. If yours has not, check the data and the paths first."
 },
 "gaps": [
  "The staged data files are not published. Only their SHA-256 fingerprints are, and they sit on the original cluster.",
  "HelpSteer3 and UltraFeedback were not revision-pinned, so restaging can produce different bytes.",
  "The staging script does not fetch HelpSteer3. It expects two files you prepare first.",
  "The base model's tokenizer configuration was repaired before training. The fix is released, and the exact way to apply it needs confirming.",
  "Only model weights were saved, so the original optimizer trajectory cannot be resumed.",
  "The scripts are written for LUMI (AMD GPUs, Singularity, Cray network settings). Other clusters need changes to the container, the network variables and the paths.",
  "Account IDs and personal paths were removed from this page. Replace the <placeholders>."
 ],
 "files": [
  [
   "training_slurm.sbatch",
   "Original launch script"
  ],
  [
   "training_config.yaml",
   "Frozen configuration"
  ],
  [
   "stage_threeway_dpo_full.py",
   "Data staging script"
  ],
  [
   "data_checksums.sha256",
   "Fingerprints of the six data files"
  ],
  [
   "data_manifest.json",
   "Row counts per source and language"
  ],
  [
   "trainer_state.json",
   "Full training log"
  ],
  [
   "all_results.json",
   "Final metrics"
  ]
 ],
 "related_note": "/notes/preference-tuning-and-alignment/",
 "tags": [
  "preference-tuning",
  "multilingual"
 ],
 "effects": {
  "alignment": [
   "improved",
   "EUROPA Alignment 77.3% → 89.3%"
  ],
  "multilingual": [
   "mixed",
   "Measured in 36 languages. Weakest language pack 21.9%, related to the tokenizer."
  ],
  "instructions": [
   "trained",
   "General preference pairs were the training data. Not measured separately."
  ]
 }
}