Home / Articles / Prompt Engineering: Steer LLMs Without Fine-Tuning

This article is published in English.

Prompt Engineering: Steer LLMs Without Fine-Tuning

Use roles, few-shot examples, chain-of-thought, and format constraints to guide models — and know when prompting alone hits a ceiling versus fine-tuning.

748 words

Fine-tuning adapts a pre-trained model by training further on labeled examples. That path remains powerful, yet it is not always required. Modern large language models often respond well to careful instructions alone — no training run, no labeled corpus, no GPU. That practice is prompt engineering, and it has become one of the most practical skills around today’s NLP stacks.

Two Ways to Steer a Model

Fine-tuning and prompting chase the same goal — useful model behavior — by opposite means.

Fine-tuning edits the model weights. Prompting leaves weights alone and instead supplies clearer instructions and context so the model applies what it already knows more precisely. Models such as GPT-class systems absorbed such broad text that much capability is already latent; prompting often means unlocking the right slice of it. The practical implication is speed: teams can try behavioral changes in minutes instead of waiting on a fine-tune job.

from openai import OpenAI
client = OpenAI()response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "system", "content": "You are a helpful sentiment classifier. Respond with only 'positive' or 'negative'."},
        {"role": "user", "content": "I loved this movie"}
    ]
)print(response.choices[0].message.content)

Zero-shot vs Few-shot Prompting

An early design choice is how many examples, if any, to show before the real task.

A zero-shot prompt states the task and trusts pre-training alone. That works surprisingly well for common jobs such as sentiment labeling or plain summarization. A few-shot prompt first shows a few input–output pairs, which steers format, tone, and edge handling — especially for unusual or domain-specific work. Each example costs tokens, raising spend and shrinking room for the real input. Keeping few-shot sets short and representative usually beats dumping many near-duplicate pairs into the window.

prompt = """
Classify the sentiment of each review as positive or negative.
Review: "Absolutely fantastic, exceeded expectations!"
Sentiment: positiveReview: "Complete waste of money, broke in a week."
Sentiment: negativeReview: "I loved this movie"
Sentiment:
"""response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": prompt}]
)print(response.choices[0].message.content)

Anatomy of a Good Prompt

Beyond the zero-/few-shot choice, a reliable structure helps when prompts feed real applications rather than one-off questions.

Assigning a clear role sets tone and perspective. A specific instruction removes ambiguity about the expected outcome. Separating context or input from instructions helps the model distinguish the two. Explicit format rules — for example JSON with named keys — make responses easier to parse than hoping for consistent free prose. A few well-chosen examples can tighten behavior further when the task is unusual.

Prompting Techniques Worth Knowing

Several patterns stand out for harder work:

  • Chain-of-thought prompting — ask the model to reason step by step before the final answer; this often helps on math word problems and multi-step logic.
  • Role prompting — assign a persona (“You are a senior security auditor”) to shape depth and style.
  • Output format constraints — request JSON or XML when another system must consume the answer.
  • Self-consistency — sample several answers to the same prompt and keep the most common result when answers vary.

When Prompting Isn’t Enough

Prompting has hard limits. It cannot invent facts the model never saw, it is bounded by the context window, and for high-volume narrow tasks a fine-tuned model is often cheaper and more consistent than a delicate prompt run millions of times. Many production systems combine both: fine-tune the core repeated job, then layer prompts for flexibility and edge cases. Treat prompting as the control surface and fine-tuning as the capacity upgrade when control alone stops scaling.

Where This Leads

Prompt engineering shortens the path from idea to working prototype — work that once needed labeled data and training can often be probed in minutes with a solid prompt. Prompting alone still has a ceiling, especially when answers must use information the model never trained on.

That next gap — searching by meaning rather than keywords, then feeding retrieved text into generation — is the territory of embeddings and retrieval-augmented generation (RAG).