Skip to content

Commit 0a7a1bb

Browse files
Built site for gh-pages
1 parent 81dd791 commit 0a7a1bb

5 files changed

Lines changed: 28 additions & 28 deletions

File tree

.nojekyll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d64996de
1+
f4650bf8

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ <h5 class="quarto-listing-category-title">Categories</h5><div class="quarto-list
192192

193193
<div class="quarto-listing quarto-listing-container-default" id="listing-listing">
194194
<div class="list quarto-listing-default">
195-
<div class="quarto-post image-right" data-index="0" data-categories="transformer,llm,machine learning,HuggingFace,Vast.ai" data-listing-date-sort="1739055600000" data-listing-file-modified-sort="1739206763663" data-listing-date-modified-sort="1739055600000" data-listing-reading-time-sort="9">
195+
<div class="quarto-post image-right" data-index="0" data-categories="transformer,llm,machine learning,HuggingFace,Vast.ai" data-listing-date-sort="1739055600000" data-listing-file-modified-sort="1739224833436" data-listing-date-modified-sort="1739142000000" data-listing-reading-time-sort="9">
196196
<div class="thumbnail">
197197
<p><a href="./posts/llm-fine-tuning/index.html"> <img src="./posts/llm-fine-tuning/images/fine-tuning.jpg" class="thumbnail-image"> </a></p>
198198
</div>

posts/llm-fine-tuning/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ <h1 class="title">Fine-Tuning a Pre-Trained LLM</h1>
207207
<div>
208208
<div class="quarto-title-meta-heading">Modified</div>
209209
<div class="quarto-title-meta-contents">
210-
<p class="date-modified">February 9, 2025</p>
210+
<p class="date-modified">February 10, 2025</p>
211211
</div>
212212
</div>
213213

@@ -638,15 +638,15 @@ <h2 class="anchored" data-anchor-id="training-and-monitoring">Training and Monit
638638
</section>
639639
<section id="full-training-run-on-vast.ai" class="level2">
640640
<h2 class="anchored" data-anchor-id="full-training-run-on-vast.ai">Full Training Run on <a href="https://cloud.vast.ai/?ref_id=202191">Vast.ai*</a></h2>
641-
<p>In the example above, I limited the size of the dataset to a very small fraction. For proper fine-tuning, the full dataset should be used and training should be repeated for multiple epochs. Similarly, logging, eval, and save frequency should be adjusted and the trained model should be pushed to the HuggingFace hub.</p>
641+
<p>In the example above, I limited the size of the dataset to a very small fraction. For proper fine-tuning, the full dataset should be used by setting <code>dataset_limit=None</code> when loading the training data. Possibly, the training should be repeated for multiple epochs; <code>num_train_epochs</code> defaults to 3 epochs if it is not set otherwise in the training arguments. Similarly, logging, eval, and save frequency should be adjusted and the trained model should be pushed to the HuggingFace hub.</p>
642642
<p>As I do not have a GPU locally, I rented a cheap GPU from <a href="https://cloud.vast.ai/?ref_id=202191">Vast.ai*</a>.</p>
643643
<div class="quarto-figure quarto-figure-center">
644644
<figure class="figure">
645645
<p><img src="images/vastai.png" class="img-fluid figure-img"></p>
646646
<figcaption class="figure-caption">Cheap RTX 4070s Ti rented from <a href="https://cloud.vast.ai/?ref_id=202191">Vast.ai*</a></figcaption>
647647
</figure>
648648
</div>
649-
<p>Training on 50% of the full dataset (a bit over 100k samples) for one epoch took roughly 24 hours on the rented RTX 4070s Ti.</p>
649+
<p>Training on 50% of the full dataset (a bit over 100k samples) for one epoch took roughly 24 hours on the rented RTX 4070s Ti. Use <code>train_data = load_and_process_dataset("train[:50%]", dataset_limit=None)</code> to load the first half of the training set.</p>
650650
<p>Monitoring the training and evaluation metrics on Weights &amp; Biases, shows the loss slowly going down, both in training and validation, as well as the ROUGE score gradually increasing. If the loss would only decrease on the training set but not the validation set, this would indicate overfitting to the training set.</p>
651651
<div class="quarto-figure quarto-figure-center">
652652
<figure class="figure">
@@ -693,8 +693,8 @@ <h1>Testing the Fine-Tuned Model</h1>
693693
<pre><code>'A transformer is a type of neural network architecture. It\'s basically a network architecture that uses a set of neural networks to communicate with each other. \n\nFor example, if you have a neural network that is connected to a computer, it will send a signal to the computer. If you connect a computer to a network, the computer will send the signal to your computer, which will then send it to the network. This is called a "transformer".\n\nThe Transformer is basically a computer that connects a network to another network, and sends the signal back and forth.\n\n_URL_0_\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n \n\n &gt; \n\n \n\n \n\n\n \n,\n\n\n &gt; \n \n\n ,\n\nI\'m not sure what you mean by " transformer"., I\'m sure you\'re talking about " transformer" or " transformer."\n\nIf you\'re referring to " transformer", then you\'re probably referring to the "Transformer" and " transformer":\n\n* Transformer" is the same thing as transformer.\n\n**Transformer* is a transformer.**.. .\n,.\n\n:\n:: _:\n\n, = ;\n\n\n"Transformer":\n\n\n" transformer" is a term used to describe the transformer. transformer is the transformer that is used to refer to the transformer.: " transformer.\n\n\n*Transformer:\n\n\n\\* Transmitter:\n\n\n\n*Transmitter:\n\n- Transmitter\n\n---\n\n--\n\n\\- transformer\n transformer is a transmitter.\n\n\n\n -?. I\'m not an expert in this field, but I\'m an expert.\n\n &amp; :! Transmitter. is an expert,s (_URL_\n\n\n"Transmitter""transformer""transmitter"\n" Transmitter"\n\n(_URL_1_)\rut(_URL)\n\n\r\n(_)'</code></pre>
694694
</div>
695695
</div>
696-
<p>Remember, the base model above simply repeated the input (its answer was ““question: Whats a transformer? In this context: The dominant sequence transduction models are based on complex recurrent…”). In comparison, the answer of the fine-tuned model is a lot better. The first sentence is a sensible answer to the question: A transformer is a type of neural network architecture. However, after that, the model starts rambling and the answer quality gets worse.</p>
697-
<p>I am not sure why a) the answer is so long and b) why it is not better than that. Since the training and validation loss were still going down, more training should further increase the answer quality.</p>
696+
<p>Remember, the base model above simply repeated the input (its answer was <code>"question: What's a transformer? In this context: The dominant sequence transduction models are based on complex recurrent...</code>). In comparison, the answer of the fine-tuned model is a lot better. The first sentence is a sensible answer to the question: <code>A transformer is a type of neural network architecture.</code> However, after that, the model starts rambling and the answer quality gets worse.</p>
697+
<p>Since the training and validation loss were still going down, more training should further increase the answer quality. I am not sure if there are any other ways to further improve the quality and keep the model from generating overly long answers (other than reducing the generation maximum length).</p>
698698
<p>If you have other suggestions for improving the answer quality, I am happy to hear your suggestions (contact info is on <a href="https://stefanbschneider.github.io/">my website</a>)!</p>
699699
</section>
700700
<section id="whats-next" class="level1">

search.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"href": "posts/llm-fine-tuning/index.html#full-training-run-on-vast.ai",
117117
"title": "Fine-Tuning a Pre-Trained LLM",
118118
"section": "Full Training Run on Vast.ai*",
119-
"text": "Full Training Run on Vast.ai*\nIn the example above, I limited the size of the dataset to a very small fraction. For proper fine-tuning, the full dataset should be used and training should be repeated for multiple epochs. Similarly, logging, eval, and save frequency should be adjusted and the trained model should be pushed to the HuggingFace hub.\nAs I do not have a GPU locally, I rented a cheap GPU from Vast.ai*.\n\n\n\nCheap RTX 4070s Ti rented from Vast.ai*\n\n\nTraining on 50% of the full dataset (a bit over 100k samples) for one epoch took roughly 24 hours on the rented RTX 4070s Ti.\nMonitoring the training and evaluation metrics on Weights & Biases, shows the loss slowly going down, both in training and validation, as well as the ROUGE score gradually increasing. If the loss would only decrease on the training set but not the validation set, this would indicate overfitting to the training set.\n\n\n\nMonitoring training and validation loss and ROUGE score on Weights & Biases\n\n\nI pushed the final fine-tuned model to HuggingFace: stefanbschneider/led-base-16384-lfqa-ans-len-512"
119+
"text": "Full Training Run on Vast.ai*\nIn the example above, I limited the size of the dataset to a very small fraction. For proper fine-tuning, the full dataset should be used by setting dataset_limit=None when loading the training data. Possibly, the training should be repeated for multiple epochs; num_train_epochs defaults to 3 epochs if it is not set otherwise in the training arguments. Similarly, logging, eval, and save frequency should be adjusted and the trained model should be pushed to the HuggingFace hub.\nAs I do not have a GPU locally, I rented a cheap GPU from Vast.ai*.\n\n\n\nCheap RTX 4070s Ti rented from Vast.ai*\n\n\nTraining on 50% of the full dataset (a bit over 100k samples) for one epoch took roughly 24 hours on the rented RTX 4070s Ti. Use train_data = load_and_process_dataset(\"train[:50%]\", dataset_limit=None) to load the first half of the training set.\nMonitoring the training and evaluation metrics on Weights & Biases, shows the loss slowly going down, both in training and validation, as well as the ROUGE score gradually increasing. If the loss would only decrease on the training set but not the validation set, this would indicate overfitting to the training set.\n\n\n\nMonitoring training and validation loss and ROUGE score on Weights & Biases\n\n\nI pushed the final fine-tuned model to HuggingFace: stefanbschneider/led-base-16384-lfqa-ans-len-512"
120120
},
121121
{
122122
"objectID": "posts/generative-qa/index.html",

sitemap.xml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,82 +2,82 @@
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
33
<url>
44
<loc>https://stefanbschneider.github.io/blog/index.html</loc>
5-
<lastmod>2025-02-10T17:00:29.268Z</lastmod>
5+
<lastmod>2025-02-10T22:01:25.586Z</lastmod>
66
</url>
77
<url>
88
<loc>https://stefanbschneider.github.io/blog/posts/django-db/index.html</loc>
9-
<lastmod>2025-02-10T17:00:26.629Z</lastmod>
9+
<lastmod>2025-02-10T22:01:23.002Z</lastmod>
1010
</url>
1111
<url>
1212
<loc>https://stefanbschneider.github.io/blog/posts/understanding-transformers-attention/index.html</loc>
13-
<lastmod>2025-02-10T17:00:24.946Z</lastmod>
13+
<lastmod>2025-02-10T22:01:21.705Z</lastmod>
1414
</url>
1515
<url>
1616
<loc>https://stefanbschneider.github.io/blog/posts/llm-fine-tuning/index.html</loc>
17-
<lastmod>2025-02-10T17:00:23.210Z</lastmod>
17+
<lastmod>2025-02-10T22:01:19.976Z</lastmod>
1818
</url>
1919
<url>
2020
<loc>https://stefanbschneider.github.io/blog/posts/generative-qa/index.html</loc>
21-
<lastmod>2025-02-10T17:00:21.429Z</lastmod>
21+
<lastmod>2025-02-10T22:01:18.085Z</lastmod>
2222
</url>
2323
<url>
2424
<loc>https://stefanbschneider.github.io/blog/posts/rllib-private-cluster/index.html</loc>
25-
<lastmod>2025-02-10T17:00:20.014Z</lastmod>
25+
<lastmod>2025-02-10T22:01:16.399Z</lastmod>
2626
</url>
2727
<url>
2828
<loc>https://stefanbschneider.github.io/blog/posts/my-first-project/index.html</loc>
29-
<lastmod>2025-02-10T17:00:18.209Z</lastmod>
29+
<lastmod>2025-02-10T22:01:14.948Z</lastmod>
3030
</url>
3131
<url>
3232
<loc>https://stefanbschneider.github.io/blog/posts/pytorch-getting-started/index.html</loc>
33-
<lastmod>2025-02-10T17:00:16.608Z</lastmod>
33+
<lastmod>2025-02-10T22:01:13.588Z</lastmod>
3434
</url>
3535
<url>
3636
<loc>https://stefanbschneider.github.io/blog/posts/partial-observability/index.html</loc>
37-
<lastmod>2025-02-10T17:00:14.450Z</lastmod>
37+
<lastmod>2025-02-10T22:01:11.563Z</lastmod>
3838
</url>
3939
<url>
4040
<loc>https://stefanbschneider.github.io/blog/posts/deepcomp/index.html</loc>
41-
<lastmod>2025-02-10T17:00:01.557Z</lastmod>
41+
<lastmod>2025-02-10T22:00:58.771Z</lastmod>
4242
</url>
4343
<url>
4444
<loc>https://stefanbschneider.github.io/blog/posts/test-markdown-post/index.html</loc>
45-
<lastmod>2025-02-10T17:00:02.520Z</lastmod>
45+
<lastmod>2025-02-10T22:00:59.601Z</lastmod>
4646
</url>
4747
<url>
4848
<loc>https://stefanbschneider.github.io/blog/posts/test-notebook-post/index.html</loc>
49-
<lastmod>2025-02-10T17:00:15.747Z</lastmod>
49+
<lastmod>2025-02-10T22:01:12.845Z</lastmod>
5050
</url>
5151
<url>
5252
<loc>https://stefanbschneider.github.io/blog/posts/question-answering-huggingface/index.html</loc>
53-
<lastmod>2025-02-10T17:00:17.227Z</lastmod>
53+
<lastmod>2025-02-10T22:01:14.200Z</lastmod>
5454
</url>
5555
<url>
5656
<loc>https://stefanbschneider.github.io/blog/posts/django-bootstrap/index.html</loc>
57-
<lastmod>2025-02-10T17:00:19.095Z</lastmod>
57+
<lastmod>2025-02-10T22:01:15.579Z</lastmod>
5858
</url>
5959
<url>
6060
<loc>https://stefanbschneider.github.io/blog/posts/django-heroku/index.html</loc>
61-
<lastmod>2025-02-10T17:00:20.741Z</lastmod>
61+
<lastmod>2025-02-10T22:01:17.016Z</lastmod>
6262
</url>
6363
<url>
6464
<loc>https://stefanbschneider.github.io/blog/posts/pytorch-django/index.html</loc>
65-
<lastmod>2025-02-10T17:00:22.267Z</lastmod>
65+
<lastmod>2025-02-10T22:01:19.044Z</lastmod>
6666
</url>
6767
<url>
6868
<loc>https://stefanbschneider.github.io/blog/posts/descript/index.html</loc>
69-
<lastmod>2025-02-10T17:00:23.992Z</lastmod>
69+
<lastmod>2025-02-10T22:01:20.882Z</lastmod>
7070
</url>
7171
<url>
7272
<loc>https://stefanbschneider.github.io/blog/posts/google-analytics-track-links/index.html</loc>
73-
<lastmod>2025-02-10T17:00:25.732Z</lastmod>
73+
<lastmod>2025-02-10T22:01:22.365Z</lastmod>
7474
</url>
7575
<url>
7676
<loc>https://stefanbschneider.github.io/blog/posts/django-google-analytics/index.html</loc>
77-
<lastmod>2025-02-10T17:00:27.516Z</lastmod>
77+
<lastmod>2025-02-10T22:01:23.877Z</lastmod>
7878
</url>
7979
<url>
8080
<loc>https://stefanbschneider.github.io/blog/about.html</loc>
81-
<lastmod>2025-02-10T17:00:30.015Z</lastmod>
81+
<lastmod>2025-02-10T22:01:26.325Z</lastmod>
8282
</url>
8383
</urlset>

0 commit comments

Comments
 (0)