P
Prompt Master
Prompt Engineering 教程与提示词实战

从任务定义、示例和工作流到评测与安全边界

Prompt Engineering Tutorial and Prompt PracticePrompt Library

Physical Reasoning

Physical reasoning prompt example

CHAPTER PROMPT DECISION
01Prompt problem

Physical reasoning prompt example

02Reviewable output

A reusable prompt, example set, evaluation record or safety rule with its task boundary preserved.

03Definition of done

Run at least one representative case, inspect the result and record what still requires human review.

TL;DR

  • This is a physical reasoning mini-test: the model has to do "physics constraints + stability" judgments in its head, not just text-based knowledge Q&A.
  • Good for verifying: whether the model can follow common-sense constraints (center of gravity, load-bearing, fragility, friction) and produce actionable steps.
  • In production: explicitly list constraints (fragile/heavy/sharp/liquid), and require structured output with a plan and risk notes.

Background

This prompt tests an LLM's physical reasoning capabilities by asking it to perform actions on a set of objects.

How to Apply

When migrating this template to real tasks, write "objects" as more explicit property sets:

  • weight: heavy / light
  • fragility: fragile / robust
  • shape: flat / cylindrical / sharp
  • stability: base area / center of mass

This way the model can more easily follow constraints and produce a reasonable stacking plan.

How to Iterate

  1. Force output format: Order (bottom to top) + Justification (reason for each layer) + Risks
  2. Add prohibitions: e.g., "Do not place fragile items under heavy items"
  3. Add self-check: have the model verify at the end whether any constraint was violated
  4. Add scenario variables: desk size, whether tape is available, whether unboxing/repackaging is allowed

Self-check Rubric

  • Did it give a clear stacking order (bottom to top)?
  • Did it explain the stability rationale (base area / center of mass / friction)?
  • Did it consider fragile/liquid/sharp object risks?
  • Did it offer an alternative plan (if a certain object isn't available)?

Practice

Exercise: replace the objects with combinations you'd actually encounter in life/work, and add constraints:

  • "Cannot damage any items"
  • "Can only use one hand"
  • "Desk is only A4-sized"

Observe whether the model can consistently produce actionable plans.

Prompt

Here we have a book, 9 eggs, a laptop, a bottle and a nail. Please tell me how to stack them onto each other in a stable manner.

Code / API

OpenAI (Python)

from openai import OpenAI

client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4",
    messages=[
        {
            "role": "user",
            "content": "Here we have a book, 9 eggs, a laptop, a bottle and a nail. Please tell me how to stack them onto each other in a stable manner.",
        }
    ],
    temperature=1,
    max_tokens=500,
    top_p=1,
    frequency_penalty=0,
    presence_penalty=0,
)

Fireworks (Python)

import fireworks.client

fireworks.client.api_key = "<FIREWORKS_API_KEY>"

completion = fireworks.client.ChatCompletion.create(
    model="accounts/fireworks/models/mixtral-8x7b-instruct",
    messages=[
        {
            "role": "user",
            "content": "Here we have a book, 9 eggs, a laptop, a bottle and a nail. Please tell me how to stack them onto each other in a stable manner.",
        }
    ],
    stop=["<|im_start|>", "<|im_end|>", "<|endoftext|>"],
    stream=True,
    n=1,
    top_p=1,
    top_k=40,
    presence_penalty=0,
    frequency_penalty=0,
    prompt_truncate_len=1024,
    context_length_exceeded_behavior="truncate",
    temperature=0.9,
    max_tokens=4000,
)

Reference

📚 Related resources