Publish finetuning efficiency article (#71)

* Figures to tables, remove images

* Set draft to false

* Update date

* Add icon

* Add preview image

* Upd preview image

* Add fun fact

* Set publication date
This commit is contained in:
M. Yusuf Sarıgöz
2022-08-31 09:53:17 +02:00
committed by GitHub
parent fffb5612c9
commit 81112dc646
7 changed files with 37 additions and 6 deletions
@@ -7,8 +7,8 @@ small_preview_image: /articles_data/embedding-recycling/icon.svg
weight: 10
author: Yusuf Sarıgöz
author_link: https://medium.com/@yusufsarigoz
date: 2022-07-20T13:00:00+03:00
draft: true
date: 2022-08-23T13:00:00+03:00
draft: false
---
A recent [paper](https://arxiv.org/abs/2207.04993)
@@ -105,9 +105,15 @@ In this setup, we compared performances of four methods:
in order to be able to use a reasonable batch size in full training.
The baseline score with ResNet34 is 0.106.
{{< figure src=/articles_data/embedding-recycling/finetuning_efficiency_full_dataset.png caption="Performances with different methods of fine-tuning" >}}
| Model | RRP |
| ------------- | ---- |
| Full training | 0.32 |
| 50% recycling | 0.31 |
| 75% recycling | 0.28 |
| Head only | 0.22 |
| Baseline | 0.11 |
As is seen in the figure, the performance in 50% layer recycling is very close to that in full training.
As is seen in the table, the performance in 50% layer recycling is very close to that in full training.
Additionally, we can still have a considerable speedup in 50% layer recycling with only a small drop in performance.
Although 75% layer recycling is better than training only `EncoderHead`,
its performance drops quickly when compared to 50% layer recycling and full training.
@@ -116,7 +122,13 @@ its performance drops quickly when compared to 50% layer recycling and full trai
In the second experiment setup, we compared performances of fine-tuning strategies with different dataset sizes.
We sampled 50% of the training set randomly while still evaluating models on the whole validation set.
{{< figure src=/articles_data/embedding-recycling/finetuning_efficiency_small_dataset.png caption="Performances with differen dataset sizes" >}}
| Model | RRP |
| ------------- | ---- |
| Full training | 0.27 |
| 50% recycling | 0.26 |
| 75% recycling | 0.25 |
| Head only | 0.21 |
| Baseline | 0.11 |
This experiment shows that, the smaller the available dataset is,
the bigger drop in performance we observe in full training, 50% and 75% layer recycling.
@@ -131,7 +143,14 @@ as one of the most important takeaways of the paper is that
the performance of layer recycling is task-dependent.
To this end, we set up an experiment with the code from the [Question Answering with Similarity Learning tutorial](https://quaterion.qdrant.tech/tutorials/nlp_tutorial.html).
{{< figure src=/articles_data/embedding-recycling/finetuning_efficiency_qa.png caption="Layer recycling for question answering with similarity learning" >}}
| Model | RP@1 | RRK |
| ------------- | ---- | ---- |
| Full training | 0.76 | 0.65 |
| 50% recycling | 0.75 | 0.63 |
| 75% recycling | 0.69 | 0.59 |
| Head only | 0.67 | 0.58 |
| Baseline | 0.64 | 0.55 |
In this task, 50% layer recycling can still do a good job with only a small drop in performance when compared to full training.
However, the level of degradation is smaller than that in the similar cars search example.
@@ -151,3 +170,7 @@ There is even a critical size under which full training does not work at all.
The issue of performance differences shows that there is still room for further research on layer recycling,
and luckily Quaterion is flexible enough to run such experiments quickly.
We will continue to report our findings on fine-tuning efficiency.
**Fun fact**: The preview image for this article was created with Dall.e with the following prompt: "Photo-realistic robot using a tuning fork to adjust a piano."
[Click here](/articles_data/embedding-recycling/full.png)
to see it in full size!
Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="512" height="512" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g fill="#ffffff">
<path d="m369.57-0.49805c-2.6938-0.064115-5.4852 0.21084-8.3359 0.86523-9.592 2.202-16.343 9.8137-23 16.471l-114 114c-23.299 23.299-46.38 44.279-55.572 77-5.087 18.11-4.4411 37.801-0.41406 56 1.4 6.327 10.593 21.327 8.1074 27-5.342 12.188-23.705 24.584-33.121 34l-58 58c-8.6941 8.694-17.593 20.828-28 27.398-4.6019 2.905-10.853 1.1613-16 1.9023-8.4131 1.212-16.346 5.2029-23 10.379-15.85 12.328-21.299 33.945-16.484 52.754 6.1432 11.506 11.924 22.78 22.074 29.631 4.7133 2.7679 9.715 4.7348 14.84 5.8691 0.44213 0.07857 0.87996 0.16147 1.334 0.22852v0.00195c21.384 4.1447 44.392-5.4139 55.346-26.164 4.9024-9.286 1.4605-23.328 7.209-31 17.209-22.968 42.373-42.691 62.682-63l40-40c4.287-4.287 10.918-14.069 17-15.473 3.353-0.77399 7.946 2.4781 11 3.6621 7.167 2.779 14.438 4.8333 22 6.1973 22.584 4.072 46.044 1.0169 67-8.248 21.369-9.448 36.803-26.942 53-43.139l116-116c12.09-12.09 23.428-22.524 20.699-41-2.867-19.411-25.437-29.437-42.699-21.648-12.562 5.668-22.433 19.081-32 28.648l-88 88c-14.692 14.692-29.018 32.956-46 44.957-22.534 15.924-55.71 9.38-69.664-14.957-19.27-33.609 4.8311-57.167 27.664-80 7.31-7.31 27.431-20.903 23.967-32.984-1.861-6.488-9.1958-9.1329-14.967-5.9219-10.875 6.052-20.232 19.138-29 27.906-12.828 12.828-26.059 24.456-32.303 42-13.209 37.116 8.0418 82.176 47.303 91.762 42.889 10.471 68.113-16.875 96-44.762l79-79c13.327-13.327 26.495-26.838 40-39.984 4.983-4.851 12.578-10.556 18.105-2.8262 6.824 9.544-11.369 22.075-17.105 27.811l-117 117c-18.766 18.766-36.848 36.636-64 41.576-16.282 2.961-32.551 1.2744-48-4.6406-8.161-3.124-18.838-13.334-28-8.7559-12.235 6.113-23.359 22.179-33 31.82l-59 59c-10.236 10.236-20.162 22.661-32 31l-12-12c8.3391-11.838 20.764-21.764 31-32l61-61c9.274-9.274 22.353-18.826 29.258-30 5.784-9.361-4.9474-20.521-8.1934-29-6.472-16.906-8.0979-35.375-3.5879-53 7.294-28.502 28.491-46.968 48.523-67l85-85 34-33.998c3.782-3.7635 8.8864-10.109 14.984-8.4688 10.502 2.8241 6.0346 13.137 0.97461 18.467-14.592 15.371-30.277 29.698-44.941 45-6.409 6.6875-8.1206 20.719 4.9824 20.627 8.124-0.058 14.826-9.453 20-14.627l30-30c6.903-6.903 14.638-13.962 16.531-24 3.7406-19.824-10.339-36.887-29.195-37.336zm-138.33 0.68359c-1.3657-0.13179-2.722-0.10871-4.0059 0.091797-32.645 5.0985-62.248 26.007-77.244 55.561-5.665 11.165-10.009 23.501-11.463 36-0.875 7.5278 3.7091 13.697 11.705 12.797 7.146-0.803 8.4678-6.8573 9.8848-12.797 2.814-11.788 6.5999-22.899 13.461-33 10.011-14.738 24.045-26.269 40.656-32.795 7.642-3.0023 19.339-2.8405 25.785-7.9082 10.821-8.507 0.78089-17.027-8.7793-17.949zm-181.63 432.5c31.688-0.66458 41.984 49.843 7.3848 57.785-36.731 8.431-50.906-48.469-14-56.941 2.2957-0.52694 4.5027-0.79945 6.6152-0.84375z"/>
<path d="m227 41.518c-18.676 3.9605-35.159 18.33-42.971 35.482-3.804 8.3506-10.303 30.451 6.971 27.757 9.813-1.531 11.474-17.695 16.44-24.757 4.656-6.6219 11.135-12.162 18.56-15.485 5.169-2.3138 11.779-2.8891 15.486-7.6226 8.417-10.748-5.299-17.322-14.486-15.374m74.001 72.069c-13.368 3.502-7.313 24.063 5.959 19.759 12.087-3.918 6.252-22.958-5.959-19.759z"/>
<path d="m460 268.53c-10.443 1.681-11.412 17.094-16.57 24.474-4.962 7.098-11.569 12.56-19.43 16.204-4.803 2.228-10.989 2.642-14.566 6.929-6.015 7.208-0.34 17.135 8.566 16.761 20.589-0.863 39.773-18.212 48.215-35.894 3.646-7.636 10.483-31.16-6.215-28.474m39.004 0.131c-7.016 2.134-7.653 9.25-9.134 15.343-2.705 11.136-6.537 21.416-12.96 31-9.917 14.8-24.482 25.934-40.91 32.547-7.501 3.02-19.591 2.787-25.721 8.106-8.155 7.074-0.774 18.828 8.721 18.161 34.597-2.429 67.56-27.474 82.73-57.814 5.295-10.59 10.125-24.037 10.251-36 0.077-7.256-4.991-13.773-12.977-11.343z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB