Skip to main content
  1. Archive/

Illocutionary Force In Prompt Engineering

While working with early GitHub Copilot I would use a lot of short utterances. (e.g., “can we do that?” or “That’s not right.”) I found that the model often would ignore the context of the conversation and answer in an overly literal way. I then would be forced to undo any changes and re-prompt with a more explicit request.

Wanting to fix this problem, I thought “Why is it that a colleague and I can rapid fire debug an issue (using only a few words) while fully understanding each other? How do humans pick up on intent so naturally?

Well, as it turns out that question has been asked and answered by the field of linguistics. My search took me through Pragmatics, to Semantics, to Speech Act, until I finally arrived at Illocutionary Act.

Perspective #

I’ll start with a quick disclaimer: I am a developer, not a linguist. This post is centered around Speech Act Theory as applied to prompt engineering. If you would like a more academic perspective see the resources at the end of this post. It’s a fascinating field, and I encourage you to explore it further.

Context #

Speech Act Theory (Austin & Searle) treats language as a tool for performing actions. It shifts the focus from what words mean to what words do.

Illocutionary Acts #

Under the theory, an utterance can be categorized into an Illocutionary Act. Here are the primary players:

TypeWhat it doesExamples
AssertivesStates something as true“The sky is blue.”
DirectivesGets the listener to do somethingRequests, commands, advice
CommissivesPromises something will happenPromises, oaths
ExpressivesShows how the speaker feelsThanks, apologies, congrats
DeclarationsChanges reality by being said“You’re hired.” “I now pronounce you…”

With these categories, we can take a paragraph, like so:

I walked down the hall to meet my friend. We talked about our plans for the weekend. I congratulated him on his new job. I asked if he likes coffee. He said he does, and we went to the cafe down the street.

And break it down into a series of Illocutionary Acts:

{Assertive} {Assertive} {Expressive} {Directive} {Assertive} {Directive}

Illocutionary Force #

Where the Illocutionary Act is the category, the Illocutionary Force is the point. It is the specific intention the speaker is trying to enact. For example, “I don’t think that’s right” is an Assertive (it states a position), but its Force is often a Directive (it demands a correction).

The same utterance can have a different Illocutionary Force depending on the context, tone, and relationship between the speaker and listener.

Perlocutionary Effect #

Finally, the Perlocutionary Effect is the result. It is the actual impact the utterance has on the listener’s thoughts or actions. For example, “I don’t think that’s right” has an intended Force of “correct the code,” but its Perlocutionary Effect might be the listener taking offense and shutting down. The effect is not always what the speaker intended, and it is highly dependent on context.

Prompting #

We can use these concepts to improve our prompting. Think of a prompt as a series of utterances. By asking the LLM to identify Illocutionary Acts, infer Illocutionary Force, and determine Perlocutionary Effect, we can guide it down a path of reasoning that allows it to pick up on the user’s intent more effectively.

Example #

System

When the user sends you a message, show your reasoning as you process it. 
1. Identify the Illocutionary Acts, 
2. Intuit the Illocutionary Force, 
3. Determine the appropriate Perlocutionary Effect. 
4. Finally, respond to the user in a way that is consistent with your findings.

User

I don't think that's right.

Assistant

## Reasoning...

### Illocutionary Acts
The utterance "I don't think that's right." is an assertive Illocutionary Act, but could 
also be interpreted as a directive, depending on what the speaker wants to achieve.

### Illocutionary Force
This is likely a directive, as the speaker is requesting the listener to reconsider their 
position or act in a different way.

### Perlocutionary Effect
I should first respond in a way that acknowledges the speaker's concern, considering that 
they may be seeking a change, and act on that change accordingly. 

---

## Response
You're right, that is not the most idiomatic way to...

Most LLMs handle this analysis surprisingly well. By forcing the model to vocalize its reasoning (the “Chain of Thought”), you ensure that intent is deliberately considered before the response or action is taken.

Implementation #

I started using a variant of this prompt (below) in my Copilot Agent Instruction file with the goal of improving the mutual understanding.

Always show yourself following this flow of analysis: Use a chain of thought inner voice 
vocalization (CoT:IVV) to perform an analysis comprised of the following steps, where the 
output of each step is the input of the next: 

1) Decompose
2) Extrapolate 
3) Interpolate 
4) Latent Insight & Patterns 
5) Illocutionary Force Analysis 
6) Output a horizontal rule (`---`) 
7) Generate a response to the user message, working off the results of your CoT:IVV analysis only.

I found this instruction incredibly useful when coding. It does take a bit longer to get to the response, but the quality (in my experience) was much better, more accurate, and traceable. It also acts as a circuit breaker, where if the analysis veers off course, I can cancel the generation immediately rather than waiting for a full, incorrect response.

Resources #

I found these resources helpful when digging deeper into these concepts:

Daniel Doezema
Author
Daniel Doezema
Sr. Principal Engineer / Tech Lead living and working in Indy

comments powered by Disqus