13
$\begingroup$

Lately, there are lots of posts on one-shot learning. I tried to figure out what it is by reading some articles. To me, it looks like similar to transfer learning, in which we can use pre-trained model weights to create our own model. Fine-tuning also seems a similar concept to me.

Can anyone help me and explain the differences between all three of them?

$\endgroup$

1 Answer 1

7
$\begingroup$

They are all related terms.

From top to bottom:

One-shot learning aims to achieve results with one or very few examples. Imagine an image classification task. You may show an apple and a knife to a human and no further examples are needed to continue classifying. That would be the ideal outcome, but for algorithms.

In order to achieve one-shot learning (or close) we can rely on knowledge transfer, just like the human in the example would do (we are trained to be amazing at image processing, but here we would also exploit other knowledge like abstract reasoning abilities, and so on).

This brings us to transfer learning. Generally speaking, transfer learning is a machine learning paradigm where we train a model on one problem and then try to apply it to a different one (after some adjustments, as we'll see in a second).

In the example above, classifying apples and knives is not at all trivial. However, if we are given a neural network that already excels at image classification, with super-human results in over 1000 categories... perhaps it is easy to adapt this model to our specific apples vs knives situation.

This "adapting", those "adjustments", are essentially what we call fine-tuning. We could say that fine-tuning is the training required to adapt an already trained model to the new task. This is normally much less intensive than training from scratch, and many of the characteristics of the given model are retained.

Fine-tuning usually covers more steps. A typical pipeline in deep learning for computer vision would be this:

  1. Get trained model (image classifier champion)
  2. Note the head of our model does not match our needs (there's probably one output per category, and we only need two categories now!)

  3. Swap the very last layer(s) of the model, so that the output matches our needs, but keeping the rest of the architecture and already trained parameters intact.

  4. Train (fine-tune!) our model on images that are specific to our problem (only a few apples and knives in our silly example). We often only allow the last layers to learn at first, so they "catch up" with the rest of the model (in this case we talk about freezing and unfreezing and discriminative learning rates, but that's a bit beyond the question).

Note that some people may sometimes use fine-tuning as a synonym for transfer learning, so be careful about that!

$\endgroup$
7
  • 3
    $\begingroup$ The TensorFlow tutorial on transfer learning https://www.tensorflow.org/tutorials/images/transfer_learning also explains transfer learning quite well. It uses the term transfer learning to refer to the situation where you freeze all convolutional layers, added new dense trainable layers for the new classification task, then train the new architecture. It uses the term fine-tuning for the scenario where you train some of the convolution layers (typically, not all of them, but only the last ones) and the classifier (dense) layers. $\endgroup$
    – nbro
    Commented Jun 11, 2020 at 12:44
  • $\begingroup$ It makes sense. I would argue that even if you train all layers (not only the last ones) we should talk about fine tuning, as learning is not starting from scratch and will normally not need nearly as many epochs as if you do start from scratch. But it's good to know the minor differences in use of these terms to avoid confusion! $\endgroup$
    – Pablo
    Commented Jun 11, 2020 at 15:35
  • 1
    $\begingroup$ I've just noticed that the Deep Learning book by Goodfellow et al. provides a chapter and several sections to this topic. You should provide read the relevant sections and make sure that your answer is consistent with the definitions in that widely cited book. If not, you should probably point out the differences at least. $\endgroup$
    – nbro
    Commented Dec 14, 2020 at 11:16
  • $\begingroup$ I believe the definitions I have given cover most cases of general use. It will never be possible to make sure that all authors agree on the smallest details of these definitions, though. Since this is only a chapter and it may be interesting, I'll try to read it. If I notice anything that does not agree with my answer, I'll be sure to say why or provide the link at least. But this will not happen right away! Hopefully in the next few weeks I'll find the time. Thanks for the link! $\endgroup$
    – Pablo
    Commented Dec 14, 2020 at 18:10
  • $\begingroup$ When one makes a prompt to generate texts with GPT-3 with some examples, is it few short learning? $\endgroup$
    – Julien
    Commented Sep 10, 2022 at 11:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .