Rules first, method second: a soap film on a smooth wire, the agent's 1 check at 0.03 mm, and Mohamed Adil

How a Soap Film Can Help Us Build Better Agents

How can a soap film help us build better agents?

When we instruct an agent, we usually write two things: the rules the result has to meet, and how to get there. I wanted to know if the second part is needed. What if we only describe the rules and let the agent work out how to satisfy them?

The rule a soap film follows

Dip a bent wire into soap and the film takes a smooth shape. That shape follows one rule: every point sits at the average height of its four neighbours. A second rule fixes the edge: the points on the wire keep the wire's height. Satisfy both and you get the smooth surface mathematicians call a minimal surface. The same idea sits under the form-finding methods structural engineers have used for a long time. Earlier this month I wrote about Frei Otto's tent, which he found with soap film in 1957.

One rule, many methods

There are many ways to find the film. On a 9 × 9 grid over a smooth arched wire, bringing every point within 1 mm of its neighbours' mean takes:

Or you solve all 49 equations at once, as one system. Some are fast and some are slow, and they all land on the same surface. They are all deterministic too: algorithms people worked out over a long time.

Giving the rules to an agent

I wrote a skill (an agent's instructions for one job) with two sections, Rules and Methods. The rules were the same two:

  1. Smooth. Every interior point sits at the mean height of its four neighbours, within 1 mm.
  2. On the wire. Every boundary point has exactly the height of the wire.

The methods only said to estimate the heights, run a checker, and correct. The checker reports how far each point is off and never suggests a height, and the agent was not allowed to write a program that computes them. It had to work the heights out itself.

The smooth wire: one check

The agent passed on the first check, 0.03 mm from the exact film. When I asked how, it said each edge of the wire was a half sine wave, so it interpolated between the edges. That's a shortcut. I wanted to see it search.

The bent wire: guess, check, correct

So I bent the wire by hand, with no pattern to exploit. The agent guessed every height, read the checker's report, and corrected. Over three runs it passed in 8, 5 and 5 checks. Jacobi needs 20 sweeps on the same wire, and Gauss–Seidel 13.

The three runs gave slightly different films. All three passed the 1 mm rule, and they ended 1.7 to 4.1 mm from the exact film. Jacobi and Gauss–Seidel, stopped at the same rule, end about 11 mm away. A step of the agent moved the film further toward the answer than a step of the classic methods.

A step costs more, though. Each run took the agent three to four minutes, and a computer does a sweep in microseconds.

Rules first

Can we rely on rules alone and let the agent handle the rest? From this experiment, I think yes, and that's how I write skills now. Keep the rules simple. Let the agent think of a method first: it may surprise you, and its method may be better than the one you had in mind. If it struggles, or you need it faster, write the method in.

Step through the whole experiment, with the agent's log for every run: awatif.co/examples/soap

Start from the rules. The method comes second.

I'm a structural engineer, and I help structural engineers build agents that automate their workflows.

Get the next one by email

Short updates on AI-assisted engineering workflows, useful examples, and new Awatif writing.