Simple state-of-the-art NLP on PyTorch · tagging, classification, embeddings · verified against Flair 0.15 (2026)

Flair cheat sheet

Flair is a framework for NLP with a famously simple API: wrap text in a Sentence, load a pretrained Classifier, call predict, read the labels. It shines at NER, POS & text classification, and at stacking embeddings (classic word vectors + its own contextual Flair embeddings + Transformers) to train strong custom models. Built on PyTorch, models hosted on the 🌐 Hub. This sheet targets Flair 0.15 (Python 3.9+).

Sentence & predict tagging tasks embeddings training interop gotcha most common

Verified 2026-08-24 against the official docs at flairnlp.github.io and the flairNLP/flair repo (0.15.1). PyTorch-based; pretrained models on the Hugging Face Hub. Compare with spaCy (production) & Stanza (multilingual accuracy).

Outline

Inference is three lines: Sentence → Classifier.load → predict. The depth is in embeddings & training your own tagger.

Predict

  1. 1 · Install, Sentence, predict
  2. 2 · Reading labels & spans

Tasks

  1. 3 · NER, POS, classification

Embeddings

  1. 4 · Word & document embeddings
  2. 5 · Stacking embeddings

Train

  1. 6 · Corpus & label dict
  2. 7 · Train a model
  3. 8 · Gotchas
  4. Worth memorizing

Predict

Three lines to tag any text.

1Install, Sentence, predict0.15
2Reading labels & spansget results out

Tasks

Which model to load for each job.

3NER, POS, classificationpretrained models

Embeddings

Flair's other superpower: composable text representations.

4Word & document embeddingsvectors
5Stacking embeddingscombine representations

Train Your Own

Corpus in, custom tagger out.

6Corpus & label dictyour data
7Train a modelSequenceTagger / ModelTrainer
!Common gotchasread before shipping

Worth memorizing

Sentence → Classifier.load → predictthree lines; predict annotates in place
NER results are spansget_spans("ner") → .text / .tag / .score
load models by task or HF id"ner", "sentiment", "pos" or any hub model
embed() mutates the sentencevectors land on token.embedding / sent.embedding
StackedEmbeddings is the recipeGloVe + forward/backward Flair embeddings
Document vs Word embeddingsone vector per sentence vs per token
ColumnCorpus + make_label_dictionaryCoNLL columns → labels to train
fine_tune for transformers, train otherwisecorrect LR/schedule