liveBook · Manning

Transfer learning

As explained in Domain-Specific Small Language Models

The process of taking a model trained on one task or domain and applying it to a related task or domain, often with further tuning.

Transfer learning adapts a model trained on one task or domain to a related one, typically by tuning a pretrained model on domain-specific data. It can improve accuracy on specialized tasks without training from scratch. The choice depends on data quality, computational cost, and risks such as overfitting or catastrophic forgetting. section 1.6 section 1.7

Table 1.1 Options for specializing an open source SLM on a domain-specific task

Transfer learning strategy

Pros

Cons

Full supervised fine-tuning (unfreezing and training all the model’s weights on labeled
data)

  • Strong performance when the data is sufficient and the domain shift is large
  • High computational costs
  • Risk of overfitting
  • Domain-specific data will probably need to be combined with other accessory data.

Partial fine-tuning (unfreezing and training only a subset of the model’s layers)

  • Cheaper than full fine-tuning
  • Requires initial experimentation to select the proper layers to unfreeze and train
  • Risk of catastrophic
    forgetting

PEFT (parameter-efficient fine-tuning)—a family of techniques for inserting small trainable modules into each transformer layer while freezing the base

  • Prevents catastrophic forgetting
  • Tiny trainable parameter count paired with strong performance
  • It is possible to train multiple adapters (for diverse tasks) that can be easily swapped at runtime.
  • Unlike partial fine-tuning, it doesn’t require experimentation to select the layers to unfreeze and train.
  • Adds a slight runtime overhead. Usually this isn’t a problem, but it depends on the latency KPI for a given application.

Compare full supervised fine-tuning, partial fine-tuning, and parameter-efficient fine-tuning by cost, performance, and risks. section 1.6

Molecular structures

After tuning on molecule descriptions and structures in SMILES format, an LLM can generate molecular structures from descriptions or describe structures. section 1.6

Domain specialization is relevant when:

  • A task requires expertise beyond what a generalist model reliably provides, such as in manufacturing, scientific research, legal operations, finance, healthcare administration, or niche coding. section 1.6
  • Compliance or privacy needs call for domain-specific data and, in some cases, private offline deployment. section 1.6

How Domain-Specific Small Language Models covers it

How deep it goes
Defines adaptation and compares tuning strategies and tradeoffs, but does not detail their implementation.
Examples
Uses molecule descriptions and SMILES structures for molecular generation and description.
What it assumes
Starts with a pretrained model and relies on relevant domain-specific data for the target task.
What you can do after
Apply pretrained models to related specialized tasks by tuning them on domain-specific data.
How it connects
Connects pretrained models, fine-tuning, domain-specific language models, and catastrophic forgetting.

Also explained in

Compare how 13 books explain transfer learning →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Domain-Specific Small Language Models. The section links point to the parts of the book it draws on.