tezvyn:

Prompt Engineering: Steering AI with Words

AI-drafted, machine-checkedSource: Wikipedia: Prompt engineeringbeginner

Prompt engineering is steering an AI with carefully chosen words instead of code. You use it to get reliable results from chatbots like ChatGPT or to build applications that use large language models (LLMs). The biggest mistake is treating the AI like a search engine; effective prompts provide context, examples, and constraints to guide the model, rather than just asking a simple question.

### The mental model Prompt engineering is the process of structuring your natural language requests to get a specific, predictable output from a generative AI model. It's less like searching a database and more like giving a very smart but literal-minded assistant a precise set of instructions to follow.

### How it works A user crafts an input (the prompt) that goes beyond a simple question. This structured prompt guides the AI's response by providing a framework. For example, a prompt might include a role to adopt ("You are a senior technical writer"), context ("We are building a learning app"), a specific task ("Transform this source text"), and constraints ("Return ONLY valid JSON"). The model uses this structured input to generate an output that is far more aligned with the user's intent than a simple query would produce.

### When to use it * **To get consistent, formatted output:** Guiding a model to return data in a specific format like JSON or a consistent writing style. * **For complex or creative tasks:** Writing code, drafting marketing copy, or generating images with specific elements and moods. * **When building applications on top of LLMs:** Creating reliable and predictable behavior for AI-powered features like customer service bots or content summarizers.

### When NOT to use it * **For guaranteed factual accuracy:** LLMs can "hallucinate" (invent facts). For mission-critical, verifiable information, use a traditional database or a primary source. * **For simple, deterministic tasks:** Don't use an LLM to add two numbers. Use a calculator or a simple script; it's faster, cheaper, and 100% accurate.

### One canonical example A simple prompt might be: "What is a phishing attack?"

An engineered prompt would be more specific: "You are a cybersecurity expert writing an email to non-technical employees. Explain a phishing attack in three simple sentences. Use the analogy of a fisherman with the wrong bait. Do not use the words 'malicious,' 'cyber,' or 'credential.'"

This engineered prompt uses role-playing, analogy, and constraints to elicit a targeted and useful response.

Read the original → en.wikipedia.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.