Template-Based Natural Language Generation

39 concepts36 papers1 proposal

When humans generate text, we rarely construct sentences entirely from scratch. Instead, we rely on a mental library of structural patterns, rhetorical shapes, and stylistic frames, filling them dynamically with the specific facts or words required for the moment.

In computational linguistics, formalizing this intuition is known as Template-Based Natural Language Generation (NLG). While modern end-to-end language models excel at fluid text generation, they frequently struggle with structural precision, stylistic drift, and factual hallucinations. Template-based generation solves these issues by separating the syntactic scaffolding (the structural form) from the semantic content (the data). By mapping structured inputs directly into predefined or learned linguistic frames, these systems guarantee grammatical correctness, stylistic consistency, and strict factual grounding.


Syntactic Scaffolding: Extracting and Learning Templates

The core challenge of template-based generation is acquiring the templates themselves. While early systems relied on manually constructed grammars, modern approaches automatically extract structural scaffolds directly from existing text corpora. This allows systems to inherit the natural vocabulary, rhythm, and prosody of a target domain without human intervention.

[Raw Corpus Text] ──> [Syntactic Parsing / POS Tagging] ──> [Placeholder Extraction] ──> [Reusable Template]

This extraction can happen at various levels of linguistic abstraction:

  • Part-of-Speech and Grammatical Patterns: Systems can capture the stylistic essence of a domain by extracting raw grammatical sequences. For instance, Marco Scirea et al. extract part-of-speech sequences from a reference corpus to serve as structural templates, which are then populated with domain-specific vocabulary. Similarly, Rafal Rzepka et al. extract common grammatical patterns from expert-written poetry to guide the generation of highly stylized text like haikus.
  • Corpus-Driven Sentence Libraries: Rather than breaking sentences down into abstract tags, parsed sentences can be treated as a library of literal examples. Eder Novais et al. demonstrate that treating existing parsed sentences as structural templates allows a system to generate complex text by specifying only the variables that change. This concept is mirrored in pedagogical contexts; Lucio Messina et al. show that having users extract grammatical rules from a corpus provides a robust foundation for generating entirely novel sentences.
  • Rhetorical and Creative Skeletons: Templates can also capture the mnemonic power of well-known human expressions. Gözde Özbal et al. extract the syntactic "skeletons" of proverbs to serve as structural scaffolds for creative sentence generation, allowing new slogans or phrases to inherit the inherent rhythm and memorability of established human wisdom.

Concept-to-Text: Mapping Data to Linguistic Frames

Once a library of templates is established, the generation process becomes a problem of mapping structured data (such as database records, knowledge graphs, or retrieved facts) into the slots of these linguistic frames. This is often referred to as concept-to-text generation or guided summarization.

[Structured Data: (Entity, Predicate, Value)] ──+
                                                │ ──> [Mapping Mechanism] ──> [Coherent Text]
[Template Library: "Slot_A is a Slot_B..."]   ──+

To make this mapping systematic, systems require a formal mechanism to translate logical relationships into surface text:

  • Semantic and Predicate Mapping: Gavin Saldanha et al. convert structured knowledge base triples into natural language by mapping specific predicates to established linguistic patterns learned from corpora, ensuring an encyclopedic style. For abstractive summarization, Pierre-Etienne Genest et al. decouple information content from original source phrasing by mapping structured semantic data into predefined grammatical frames, achieving higher information density and better grammatical fluidity than traditional extractive methods.
  • Coherence and Entity Relationships: Templates excel at making complex relationships readable. Horacio Saggion demonstrates that generating summaries through structured linguistic templates facilitates the clear presentation of relationships between entities, such as defining the components of a complex system in a readable list format. In modern retrieval-augmented pipelines, Nishant Balepur et al. combine retrieved factual evidence with a stylistic template to transform raw data into a specific narrative format while preserving factual integrity.
  • Grammatical Formalisms: To mathematically unify data mapping and sentence structure, Ioannis Konstas et al. utilize a Probabilistic Context-Free Grammar (PCFG) to formalize the relationship between database records and natural language. By treating generation as a derivation process similar to parsing, the system systematically maps data fields to specific words and grammatical structures.

Discourse and Narrative Structure: Scaling Beyond the Sentence

Templates are not restricted to single sentences. The same principles of structural scaffolding scale up recursively to organize paragraphs, documents, and entire narrative arcs.

[Document Template] ──> [Paragraph Template] ──> [Sentence Template] ──> [Rhetorical Predicate]

In their foundational work on the TEXT system, Kathleen McKeown et al. introduced the idea of structuring discourse using templates that define sequences of rhetorical predicates (such as analogies or attribute descriptions). This allows systems to organize information into coherent paragraphs based on established explanatory patterns rather than rigid grammatical rules.

Crucially, this structure is inherently recursive. Kathleen McKeown et al. argue that a small, finite set of rhetorical patterns can produce an infinite variety of text lengths and structures when combined with recursive rules. This mechanism enables a system to dynamically vary the level of detail in its explanations by allowing patterns to call themselves or other sub-patterns based on user needs.

This macro-level templating is vital across several domains:

  • Ontological Explanations: Chris Mellish employs predefined rhetorical schemas to map complex logical ontologies into standardized explanations and comparative analyses between different classes.
  • Biographical Summaries: Liang Zhou et al. show that incorporating fixed-form templates ensures that multi-document biographical summaries adhere strictly to professional, encyclopedic conventions.
  • Narrative Planning: Moving into interactive storytelling, Matthew Fendt et al. demonstrate that automated narrative planners using structured "action templates" can reliably generate suspense. By formalizing narrative patterns—specifically those managing a disparity of knowledge between the audience and the protagonist—the system bakes dramatic tension directly into the story's structural framework.

Efficiency, Placeholders, and Modern Adaptations

As template-based generation has evolved, researchers have developed optimization strategies to simplify input specifications and adapt templates to modern generative architectures.

Default-Inherited Feature Assignment

Specifying every single linguistic feature for a generated sentence can lead to overly complex inputs. To bypass this, Eder Novais et al. utilize a default-based specification (or delta-based linguistic specification). In this setup, an underlying corpus sentence provides all default linguistic features (tense, gender, agreement) unless they are explicitly overridden by the input variables. This allows systems to generate highly complex variations by specifying only the exact features that deviate from the base template.

Placeholder-Based Generalization

Using explicit placeholders within templates provides a clean abstraction layer that is highly effective for cross-lingual and information extraction tasks. For example, Mitesh M. Khapra et al. extract sentence structures from a corpus, replace specific entities with placeholders, and then re-instantiate those templates with new entities after translation. This ensures structural consistency and scalability across parallel, code-mixed dialogue datasets.

Similarly, Seiya Takada et al. populate tagged LISP forms with pre-defined phrase and sentence templates, preserving vital syntactic and word-importance information for downstream speech conversion.

The LLM Era: Hybrid Prompting and Extraction

Even within modern Large Language Model (LLM) workflows, structured templates remain essential for grounding outputs and preventing hallucinations. Rajdeep Mukherjee et al. demonstrate that structured, placeholder-based templates for generative extraction tasks offer significantly better generalization and lower hallucination rates than free-form natural language paraphrasing.

Furthermore, templates serve as an effective bridge for low-resource or highly technical formatting tasks; Piyapath T. Spencer et al. show that prompting an LLM with prepared bitext allows it to generate formal grammatical rules in a specified, structured format, serving as a reliable foundation for automated linguistic analysis.

Key Foundational Work

Automatic Text Generation (1969) — contributed 1 concept elements to this direction.
International Conference on Computational Linguistics COLING 1969: Preprint No. 13 (1969) — contributed 1 concept elements to this direction.
A Formal Grammar of Expressiveness for Sacred Legends (1980) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_template_based_natural_language_generati_be7d816c,
  title = {template-based natural language generation},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/template-based-natural-language-generation/rdr_be7d816c81c748928521ca08a8c1f820},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-21},
}

This exact version (version 1, frozen text):

@misc{lacuna_template_based_natural_language_generati_be7d816c_v1,
  title = {template-based natural language generation},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/template-based-natural-language-generation/rdr_be7d816c81c748928521ca08a8c1f820/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-21},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake