liveBook · Manning

Stateful training

As explained in Natural Language Processing in Action, Second Edition

Stateful training carries a recurrent network’s hidden state from one batch or document to subsequent inputs.

Stateful training carries an RNN’s hidden state from one batch or document to the next, allowing earlier text to provide context for later predictions. section 8.3.1

Use it only when document order remains consistent across batches and epochs. Otherwise, reset the hidden state to zeros before each new document so predictions do not inherit unrelated context. section 8.3.1

Keeping context reproducible

Arrange documents in a reproducible order, preserve that order across batches, and warm up the model with context documents before each real-world or test-set prediction. Shuffled training examples suit models expected to predict cold, without priming. section 8.3.1

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Explains ordering, resetting, and warm-up requirements, but stops short of implementation details.
Examples
Uses ordered documents, shuffled training examples, zero resets, context-document warm-up, and reproducible test-set prediction.
What it assumes
Assumes an RNN with hidden state and documents divided into batches; teaches when continuity or resetting is appropriate.
What you can do after
Operate/configure recurrent training by preserving document order, choosing resets, and preparing context before predictions.
How it connects
Connects recurrent neural networks with hidden states, embeddings, batching, shuffling, epochs, and sequence context.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.