liveBook · Manning

Generation

As explained in Domain-Specific Small Language Models

The task of producing output sequences from a model given an input context or prompt, here applied to proteins rather than natural language.

Text generation produces output sequences from an input context or prompt. The same next-token approach used for language and code can generate protein sequences, including de novo candidates for design and engineering. section 8.2

Operational tradeoffs shape how generation is deployed:

  • Use prompts ranging from a starting amino acid to an oligomer, fragment, or complete protein. section 8.2
  • Balance sequence quality against inference speed, hardware requirements, and compute cost. section 8.2 section 4.1
  • Apply the workflow to general-purpose or domain-specific models exposed through Transformers and Accelerate. section 4.1

Generating de novo proteins

ProtGPT2 generates ten protein sequences in a zero-shot setting. Its outputs preserve features such as amino acid propensities, secondary-structure content, and globularity while exploring previously unseen protein-space regions. section 8.2

from transformers import pipeline

protgpt2 = pipeline('text-generation', model="nferruz/ProtGPT2")

Load ProtGPT2 through a Transformers text-generation pipeline before supplying prompts and generation settings. section 8.2

How Domain-Specific Small Language Models covers it

How deep it goes
Explains next-token generation, prompting, model scale, and runtime tradeoffs, but stops short of detailed quality evaluation.
Examples
Demonstrates ProtGPT2 prompts, batches of ten generated sequences, and a Transformers inference pipeline.
What you can do after
Apply it via Transformers to generate protein sequences from prompts and adjust batch-generation settings.
How it connects
Connects protein design with language models, prompting, inference, Transformers, and quantization.

Also explained in

Compare how 20 books explain generation →

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.