CHECKS OF FINE-TUNE A LANGUAGE MODEL WITH PYTHON krueng.ai/fine_tune_llm.html The page gives numbers: how many of the model's numbers each kind of training can change, how long each training took, how much memory it held, how big its result is, and how many test orders each model got right. None of those numbers was typed in from memory. Each one was printed by one of the page's own files or by a script in this folder, and what each printed is saved beside it as a *_output.txt file. The page shows those files. Run them again and compare. WHAT YOU NEED 1. The page's files in one folder. Every code block on the page has a Download button. ask.py before.py make_data.py tokens.py train.py score.py use.py test_handwritten.jsonl 2. These scripts in a folder named "checks" inside that folder: your folder/ ask.py before.py ... test_handwritten.jsonl checks/ README.txt lora_numbers.py sizes.py ... Each script here looks for the page's files one folder up. 3. A Python with the three libraries, as in step 1 of the page: python -m venv venv venv\Scripts\python -m pip install torch transformers peft The first run downloads the model, 272 MB. 4. For decider_training.py only, a second Python with that library: python -m venv dec dec\Scripts\python -m pip install "decider-ai[train]" 5. About 2 GB of free disk. Training the full way writes a folder of 538 MB. Plug a laptop in first. On its battery ours trained slower, and it went to standby in the middle of three steps. THE PAGE'S OWN FILES, IN ORDER Run them in the order of the page, about 20 minutes on our laptop: venv\Scripts\python make_data.py venv\Scripts\python ask.py venv\Scripts\python before.py venv\Scripts\python tokens.py venv\Scripts\python train.py lora venv\Scripts\python score.py lora venv\Scripts\python train.py full venv\Scripts\python score.py full venv\Scripts\python use.py What each printed for us is saved one folder up as _output.txt: ask_output.txt, train_lora_output.txt and so on. timings.txt, beside them, has the seconds each step took, the most memory it held, the clock times at which it began and ended, and the word "mains" or "battery". Training leaves two folders that are not page files: tuned_lora (1.9 MB) and tuned_full (538 MB). Delete them when you are done. THE CHECKS lora_numbers.py needs venv Loads the model and prints the size of the two matrices that get an add-on. Then it builds the add-ons for real at seven sizes of r, counts the numbers that training may change, and prints each count beside what the formula gives. The drawing in step 8 of the page reads this output. -> lora_numbers_output.txt sizes.py needs venv, after both trainings Adds up the model as downloaded, the two folders that training made, and the Python libraries. -> sizes_output.txt number_size.py needs venv. About 2 minutes. The model's file holds 16-bit numbers and transformers loads them as they are. This times one reply and three training steps that way, and again with dtype=torch.float32 as on the page. It uses train.py's own functions. -> number_size_output.txt merged_speed.py needs venv, after "train.py lora" Answers ten test messages with the add-ons beside the model and again with the add-ons merged into it, and says whether the replies are the same. -> merged_speed_output.txt other_questions.py needs venv, after both trainings Asks three things that are not orders of the model as downloaded, of the LoRA model and of the fully trained model, each with no instruction and with the noodle shop's instruction. -> other_questions_output.txt decider_training.py needs dec, and the internet Trains nothing. Prints the lines of decider-ai's own training script that decide what a training run needs, what its README says about its models and about training, the first lines of scripts/train.sh from its repository on GitHub, the options of the training script, and whether this computer has a CUDA graphics card. -> decider_training_output.txt THE SITE'S OWN PAGE TOOLS Five tools are kept with the site's source, in python/video_gen, and not on the site. They work for any tutorial page; page_config.py in this folder tells them about this one: its steps, where each of its numbers comes from, and what its sentences say about the outputs. run_page_files.py fine_tune_llm.html [--checks] Runs the page's files in order, and with --checks the scripts above. It saves what each printed and writes timings.txt. fill_code_blocks.py fine_tune_llm.html [--check] Puts every file into its code or output box on the page, or compares. page_claims.py fine_tune_llm.html [--write] A measured number inside a sentence of the page is marked . This compares every marked number with the output files, and with --write puts the files' numbers into the page, in every language at once. It also looks up everything the sentences say about the outputs: what the model wrote at step 50, which test messages it got wrong and how. It reports the claims that no longer hold. three_languages.py fine_tune_llm.html Takes the page's text three pieces at a time, English, Thai, Chinese, and checks that all three carry the same numbers, the same words of code, the same links and the same number of paragraphs. slept.py fine_tune_llm.html Reads the clock times in timings.txt and asks Windows when the computer entered or left standby. A step with such a moment inside it was frozen for a while, and its seconds cannot be believed. Windows only. WHAT WE RAN, AND WHEN Everything was run on one laptop: Windows 11 Home 25H2 (build 26200.9457), an Intel Core Ultra 7 155H with 24 GB of memory and no graphics card that the model could use, Python 3.12.10, PyTorch 2.14.1 on 16 threads, transformers 5.19.0 and peft 0.21.2. The outputs on the page are from 8 October 2026, 01:46 to 02:09, on mains power: the page's files and then lora_numbers, sizes, merged_speed, other_questions and number_size, one after another with nothing else running. The laptop was awake through every step. decider_training.py was run the same night with decider-ai 1.8.2. A first run, on the evening of 7 October, was on battery. The laptop went to standby in the middle of three steps, so those times were thrown away. One output of that evening is kept, because nothing interrupted it: train_lora_on_battery_output.txt, the LoRA training in 273 seconds. It printed the same loss and the same reply at every step as the run on mains, which took 195 seconds. Nothing was run on a Mac, on Linux, or on a graphics card. decider's training was read, not run. The page's one sentence about LlamaIndex rests on the code of its package llama-index-finetuning 0.4.2, read on 7 October 2026: the three classes that fine-tune an LLM each start a job on a company's servers. THINGS TO KNOW - Your times will differ. They depend on your processor and on what else it is doing. Sizes should be the same as ours. - On our laptop the training gave the same numbers twice. On another kind of processor the last digits of a loss can differ, and then a reply at some step, or a score, can differ too. - train.py prints its own seconds. They include the 16 replies it asks the model for along the way, one to two seconds each. - The handwritten test was written before any training, by the same author as make_data.py, and was not changed afterwards.