Prompt Templates
The prompting method generates paraphrases by sending input texts to a causal language model together with a prompt template. This page documents every built-in template and explains how to select or customise them.
Zero-shot prompts
Zero-shot templates describe the desired output style directly in the prompt.
They use a single placeholder, [DOCUMENT SEGMENT], which is replaced with
the input text at generation time.
All zero-shot templates are stored in
ZS_PROMPT_BANK.
Key |
Description |
|---|---|
|
Paraphrase in Wikipedia-style. From Becker et al. (2024). |
|
Rewrite as a magazine-style feature article with an engaging lead and narrative storytelling. |
|
Summarise the text and add an expert commentary on its implications and limitations. |
|
Reformulate as a teacher-student dialogue that explains the key points. |
|
Rewrite with explicit scientific or logical explanations of the underlying concepts and mechanisms. |
|
Convert into a comprehensive FAQ with self-contained answers. |
|
Create a mathematical word problem from the text’s numerical data, with a step-by-step solution. |
|
Rewrite as a narrative emphasising temporal sequence and causal relationships. |
|
Organise the key information into a markdown table, then generate a question-answer pair based on it. |
|
Rewrite as a step-by-step tutorial or instructional guide. |
|
Humanise machine-generated text by introducing typos, slang, hashtags, and varied casing (no emojis). From Zhang et al. (2024). |
|
Rewrite the text in a more formal tone. From Reif et al. (2022). |
|
Rewrite the text in simpler language. From Reif et al. (2022). |
|
Simplify a complex sentence for non-native English speakers. From Kew et al. (2023). |
|
Rewrite a simple sentence in a more complex and sophisticated style. |
|
Rewrite the text switching between active and passive voice. Few-shot prompt with examples. From Reif et al. (2022). |
|
Rewrite the text in ALL CAPS. |
|
Rewrite the text in all lower case. |
|
Rewrite the text including text emojis like :-) or ;-D. |
|
Rewrite the text using less common verbs. |
The finephrase_* templates are taken from the
FinePhrasing tool
by HuggingFace.
Default selection
When no explicit prompt selection is made, the method cycles through the
templates listed in
DEFAULT_PROMPTS.
from diversify_text import diversify
# Zero-shot: uses the default templates, no style examples needed.
results = diversify("The cat sat on the mat.", methods=["prompting"])
Selecting specific prompts
Pass a list of keys via method_kwargs to pick specific templates:
results = diversify(
"The cat sat on the mat.",
methods=["prompting"],
method_kwargs={"prompting": {"prompt_keys": ["finephrase_faq", "finephrase_tutorial"]}},
)
Few-shot prompts
Few-shot templates combine style examples from the
DEFAULT_STYLE_BANK with a prompt that instructs
the model to match the demonstrated writing style. They use three
placeholders:
[DOCUMENT SEGMENT]— the input text[STYLE EXAMPLES]— a formatted list of example sentences from the style bank[STYLE NAME]— the human-readable name of the style
All example-based templates are stored in
EXAMPLE_BASED_PROMPT_BANK.
Key |
Description |
|---|---|
|
Paraphrase the text to match the writing style demonstrated in the examples. Preserves information while shifting style. |
|
Humanise machine-generated text using the stylistic patterns from the examples. Inspired by Zhang et al. (2024). |
Automatic few-shot selection
When styles is provided without explicit prompt_keys, the
method automatically uses the style_transfer template:
results = diversify(
"The experiment was conducted in a controlled lab setting.",
methods=["prompting"],
method_kwargs={
"prompting": {
"styles": ["informal_tinystyler"],
}
},
)
To use a different few-shot template, pass it via prompt_keys:
results = diversify(
"The experiment was conducted in a controlled lab setting.",
methods=["prompting"],
method_kwargs={
"prompting": {
"styles": ["informal_tinystyler"],
"prompt_keys": ["humanize_transfer"],
}
},
)
Custom prompt banks
You can replace the entire prompt bank with your own templates. Each template
must contain the [DOCUMENT SEGMENT] placeholder:
custom_bank = {
"simple": "Rewrite the following text in simpler words: [DOCUMENT SEGMENT]",
"formal": "Rewrite the following text in a formal academic tone: [DOCUMENT SEGMENT]",
}
results = diversify(
"The cat sat on the mat.",
methods=["prompting"],
method_kwargs={"prompting": {"prompt_bank": custom_bank}},
)
Placeholder reference
Placeholder |
Used in |
Description |
|---|---|---|
|
All templates |
Replaced with the input text to paraphrase. |
|
Few-shot only |
Replaced with formatted example sentences from a style set. |
|
Few-shot only |
Replaced with the human-readable style name (e.g. “informal”). |