{"id":18885533,"url":"https://github.com/togethercomputer/finetuning","last_synced_at":"2025-04-05T20:05:50.959Z","repository":{"id":255041584,"uuid":"827075665","full_name":"togethercomputer/finetuning","owner":"togethercomputer","description":"Finetune Llama-3-8b on the MathInstruct dataset","archived":false,"fork":false,"pushed_at":"2024-10-17T22:17:44.000Z","size":691,"stargazers_count":108,"open_issues_count":1,"forks_count":25,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T19:02:50.282Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/togethercomputer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-11T01:24:43.000Z","updated_at":"2025-03-23T04:46:13.000Z","dependencies_parsed_at":"2024-08-27T17:58:50.148Z","dependency_job_id":"a7d75a8e-9963-4a4b-a48c-e0f6534bbedd","html_url":"https://github.com/togethercomputer/finetuning","commit_stats":null,"previous_names":["togethercomputer/finetuning"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/togethercomputer%2Ffinetuning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/togethercomputer%2Ffinetuning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/togethercomputer%2Ffinetuning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/togethercomputer%2Ffinetuning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/togethercomputer","download_url":"https://codeload.github.com/togethercomputer/finetuning/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393568,"owners_count":20931812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T07:19:39.033Z","updated_at":"2025-04-05T20:05:50.934Z","avatar_url":"https://github.com/togethercomputer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Finetuning Llama-3 on your own data\n\nThis repo gives you the code to fine-tune Llama-3 on your own data. In this example, we'll be finetuning on 500 pieces of data from the [Math Instruct dataset](https://huggingface.co/datasets/TIGER-Lab/MathInstruct) from TIGER-Lab. LLMs are known for not being the best at complex multi-step math problems so we want to fine-tune an LLM on some of these problems and see how well it does.\n\nWe'll go through data cleaning, uploading your dataset, fine-tuning LLama-3-8B on it, then running evals to show the accuracy vs the base model. Fine-tuning will happen on Together and costs $5 with the current pricing.\n\n## Fine-tuning Llama-3 on MathInstruct\n\n1. Make an account at [Together AI](https://www.together.ai/) and save your API key as an OS variable called `TOGETHER_API_KEY`.\n2. Install the Together AI python library by running `pip install together`.\n3. [Optional] Make an account with Weights and Biases and save your API key as `WANDB_API_KEY`.\n4. Run `1-transform.py` to do some data cleaning and get it into a format Together accepts.\n5. Run `2-finetune.py` to upload the dataset and start the fine-tuning job on Together.\n6. Run `3-eval.py` to evaluate the fine-tuned model against a base model and get accuracy.\n7. [Optional] Run `utils/advanced-eval.py` to run the model against other models like GPT-4 as well.\n\n## Results\n\n\u003e Note: This repo contains 500 problems for training but we finetuned our model on 207k problems\n\nAfter fine-tuning Llama-3-8B on 207k math problems from the MathInstruct dataset, we ran an eval of 1000 new math problems through to compare. Here were the results:\n\n- Base model (Llama-3-8b): 47.2%\n- Fine-tuned (Llama-3-8b) model: 65.2%\n- Top OSS model (Llama-3-70b): 64.2%\n- Top proprietary model (GPT-4o): 71.4%\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftogethercomputer%2Ffinetuning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftogethercomputer%2Ffinetuning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftogethercomputer%2Ffinetuning/lists"}