Generative AI & LLMs
Prompt Engineering
In shortPrompt engineering is designing and testing the instructions, context and examples you give a language model so it returns reliable, usable output.
Prompt engineering is the practice of writing, structuring and testing the input you give a large language model so it does a task reliably. A prompt can include instructions, context, examples, the data to work on and the format you want back. It is often described as trying, rewriting and retrying a prompt until it works; MLforSEO’s view is that for marketing work the real value comes from turning a prompt that works into a repeatable template.
How it works
Most good prompts combine a few building blocks:
- A clear task and role (what to do, for whom, at what level).
- Context and data, separated clearly from the instructions.
- Constraints: length, tone, what not to include, what to do when unsure.
- An output format, such as a table, JSON or fixed columns, so results can be parsed at scale.
- Examples. A prompt with no examples is zero-shot; adding a handful is few-shot prompting, which usually makes output more consistent.
Model settings matter too. Lower temperature gives more predictable output. Many providers also support structured outputs, where the model must return valid JSON that matches a schema.
How it’s used in SEO and marketing
- Bulk content from structured data: MLforSEO’s programmatic SEO tutorial builds a prompt template with placeholders for each product attribute, then loops over a table so every product gets a description generated from the same tested instructions.
- Metadata at scale: titles and meta descriptions generated from page content with fixed rules on length and keyword use.
- Classification and extraction: labelling intent, page type or SERP features with an output format your script can read.
- Briefs and summaries for content transformation workflows, with a human reviewing the result.
Example
The MLforSEO comparison of NLP APIs gave every chatbot the same zero-shot instruction: extract the entities, organise them into entity type categories and return a three-column table. Because the prompt fixed only the format, each model invented its own categories and counts, which made the outputs hard to compare. Adding an allowed list of types and two worked examples would have made the task far more controlled.
Limitations and things to watch
- A good prompt cannot turn a general text generator into a purpose-trained model. For entity extraction, sentiment or classification at scale, MLforSEO recommends trained NLP APIs, which give consistent output and confidence scores without any prompting.
- Outputs vary between runs and between model versions, so save prompts with version notes and re-test them when the model changes.
- Test on a sample with known answers before running thousands of rows, and keep a human in the loop for anything published.
- Prompts that include client or customer data are subject to the provider’s data terms.
Learn it on MLforSEO
Where Prompt Engineering shows up on MLforSEO
Learn it in a course
Sources and further reading
- How to use generative AI with structured data for programmatic SEO MLforSEO
- Comparing NLP APIs for Entity and Sentiment Analysis (vs Generative AI) MLforSEO
- How to Automatically Generate Meta Descriptions with Python: From BERT to LLMs MLforSEO
- OpenAI: Prompt engineering guide
- Google Gemini API: Prompt design strategies
- Anthropic: Prompt engineering overview
Other terms from Generative AI & LLMs
- AI GovernanceThe policies, roles and controls an organisation uses to make sure AI is used safely, legally, transparently a…
- AI HallucinationWhen a generative AI model produces content that sounds plausible but is false, unsupported by its sources, or…
- Attention MechanismThe technique that lets a neural network weigh how much each word in a text matters to every other word, so it…
- ChatGPT (OpenAI GPT models)OpenAI's chatbot and its GPT model family: strong at summarising and rewriting, unreliable for structured anal…
- Confidence Score (Generative AI)A number, usually 0 to 1, showing how certain a model is about a label or prediction; low scores flag outputs…
- Context WindowThe maximum amount of text, measured in tokens, that a language model can consider at once, including the prom…
- DeepSeek (R1 and V-series)DeepSeek's open-weight reasoning LLM, released January 2025. MLforSEO benchmarked it for entity extraction: ge…
- Function Calling (Tool Use)Function calling lets a language model ask your code to run a defined tool, such as an API or database query,…
- Gemini (Google)Google's family of multimodal large language models, behind the Gemini app, the Gemini API and AI features in…


