What is Prompt Engineering?
Prompt Engineering is the work of designing inputs (prompts) and improving them through testing to get consistent, correct results from a language model. It raises output quality without changing the model, using only the instructions and context it is given.
Parts of a Prompt
It involves more than just asking a question. A good prompt usually contains:
- Role and Context: "You are an expert industrial automation engineer." Plus the data the model needs (alarm records, a measurement summary).
- Task: what to do, in one clear sentence.
- Constraints: "Answer in JSON format only.", "Do not add information not present in the data."
- Few-Shot Examples: a few examples of the desired input-output format within the prompt.
- Output Format: field names, units, number of bullet points.
Core Techniques
| Technique | What it does |
|---|---|
| Zero-shot | Instruction without examples; for simple tasks |
| Few-shot | 2-5 examples fix the format and style |
| Step-by-step reasoning | Can reduce errors in multi-step reasoning |
| Structured output | A machine-readable answer via a JSON schema |
| Supplying context (RAG) | Grounds the answer in documents or data |
Example: Summarising Alarm Records
Weak prompt: "Look at these alarms."
Strong prompt:
Role: You are an assistant helping a maintenance engineer.
Task: Summarise the alarm records below.
Rules:
- Use only information in the given records.
- If unsure, write "uncertain".
- Output only this JSON:
{"most_frequent_alarm": "", "count": 0, "first_time": "", "suggestion": ""}
Records:
<alarm records here>
This prompt defines the role, restricts the answer to the data, handles uncertainty and fixes a machine-readable format. For technical output it is used with a low temperature.
Common Mistakes
- A vague task: write what is wanted and in which format instead of "analyse this".
- Expecting the model to calculate: compute values such as mean or RMS in code first and give the model the result.
- Not validating output: JSON output should not be written to a system before passing a schema check.
- Forgetting prompt injection: instructions hidden in log, email or document text can steer the model; mark external text as "data" and limit the model's permissions.
- Testing with a single example: test prompts on a set of real records and version them.
Industrial Application
In automated systems, prompts are often prepared "under the hood". For example, a future feature in ZMA software might use a hidden, carefully crafted prompt to ask an LLM to "Analyze these vibration statistics and summarize the health status in 3 bullet points", ensuring the output is always consistent for the end-user.
Application examples: Generative AI on industrial data with AWS Bedrock, Industrial AI.
Related Terms
- What is an LLM (Large Language Model)?What is an LLM and how does it work? Next-token prediction, its limits, and industrial uses in log interpretation, reporting and maintenance assistants.
- LLM Data Processing: Tokens, Embeddings, Temperature, HallucinationKey LLM input and output terms: tokens, embeddings, temperature and hallucination, with a softmax example and safe use on industrial data.
- What is RAG (Retrieval-Augmented Generation)?What is RAG and how does it work? Chunking, embeddings, vector search and a context budget example, applied to maintenance manuals and fault codes.
- LLM Architecture: Transformer, Attention, ParametersHow LLM architecture works: the Transformer, the attention mechanism, parameter count, and how the context window limits sensor data analysis.