Neil Murray

Data Engineer
AI

September 1, 2025

Coding with LLMs: are we re-inventing linguistics with prompts?

Why prompting advice feels like superstition — and how linguistics can give us a framework.

If you’ve been working with LLMs, you’ve probably seen (or written) endless threads about “good” and “bad” prompts. Some advice works, some doesn’t, and most of it feels like trial and error.

I kept wondering — is there a unifying theory behind this? Something that explains why certain prompts work better than others? At first, I tried inventing my own framework — mixing ideas of “formalism” and “maneuverability.” But a colleague pointed out that I was just creating another system of superstition.

And they were right. Because if we stop thinking of these systems as just Large Language Models and instead see them as large models of language, then the missing framework already exists: linguistics.

We don’t need to reinvent the wheel — decades of linguistic research already explain what makes some prompts effective and others brittle. Below are concrete examples (kept exactly as I’ve used them myself) that show how theories from linguistics map onto prompt engineering.

Working Memory Theory

Working memory acts as our mental workspace, but it has limited capacity — around 7 items at a time. Overload it, and comprehension collapses. LLMs behave the same way.

Before (cognitive overload):

Create a complete web application with user authentication, database integration, real-time chat, file upload functionality, admin dashboard, and responsive design using React, Node.js, Express, MongoDB, and Socket.io with proper error handling, security measures, and performance optimisation.

After (chunked for cognition):

Let’s build a web application step by step:
1. First, create a basic React frontend with user registration/login forms
2. Then, set up a Node.js/Express backend with MongoDB for user management
3. Next, implement secure authentication with JWT tokens
4. Finally, add real-time chat using Socket.io
Focus on step 1 first – create the user registration component.

We intuitively know the second prompt is better. Linguistics explains why.

Linguistic Anchoring

The “anchoring effect” describes how the first piece of information we receive heavily influences our focus. We can apply this directly in prompting.

Before (attention drift):

Write a function to sort a list.

After (linguistically anchored):

TASK: Sort a list of integers efficiently
FOCUS: Choose optimal algorithm for large datasets
CONSTRAINTS: Handle edge cases (empty lists, duplicates)
DELIVERABLE: Python function with time complexity analysis

def sort_large_list(nums: List[int]) -> List[int]:
“””Efficiently sort a large list of integers.”””
# Your implementation focusing on the TASK above

By explicitly anchoring tokens like TASK, FOCUS, and CONSTRAINTS, we guide the LLM’s attention in a predictable way.

Information Density

Too much noise = weak prompts. Information theory helps explain why clarity beats vagueness.

Before (low density, high noise):

Please help me write some code that can handle files and do some processing on them. I need it to work with different types of files and be able to process them efficiently. Can you make something that’s robust and handles errors well?

After (optimised information density):

Create a Python file processor class that:
– Accepts .txt, .csv, .json file types
– Reads content with encoding detection
– Applies transformation function (passed as parameter)
– Writes to output directory with ‘_processed’ suffix
– Handles FileNotFoundError, PermissionError, UnicodeDecodeError
– Logs progress for files > 1MB

Precision beats verbosity — but when you can’t be precise, redundancy and multiple explanations can still help (as pragmatics and discourse theory suggest).

Embodied Cognition

Humans understand abstract concepts through physical metaphors. LLMs — trained on our language — respond well to this too.

Before (abstract):

Implement caching functionality

After (embodied):

Create a memory system that works like a librarian’s quick-access shelf—frequently requested books stay within arm’s reach while rarely used volumes move to distant archives. Build this caching layer where hot data stays close and cold data migrates to deeper storage.

Other useful image schemas include:

CONTAINER: “Put validation logic inside a protective wrapper”

PATH: “Guide data through transformation pipelines”

BALANCE: “Maintain equilibrium between performance and memory”

Register and Politeness

Tone matters. Sociolinguistics shows that the “register” of speech influences how it’s received. LLMs mirror this.

Before (inappropriate register):

hey can u plz write me some python code that does stuff with lists thx

After (professional technical register):

Generate a Python function that implements efficient list manipulation operations, including sorting, filtering, and transformation methods. Include docstrings and type hints following PEP 8 conventions.

Adopting the persona of “an expert Python developer” leverages accommodation theory, nudging the LLM to respond in kind.

Discourse Markers

Markers like first, next, finally guide reasoning. They provide cognitive scaffolding — for both humans and LLMs.

Before (unstructured):

Make this code faster and add error handling and documentation

After (discourse-structured):

Let’s improve this code systematically. First, analyse performance bottlenecks using profiling data. Next, implement targeted optimisations for the critical path. Then, add comprehensive error handling for edge cases. Finally, document the optimisation strategy and performance gains.

Frame Semantics

Words make sense inside structured “frames.” Activate the right frame, and prompts align better with expectations.

Before (isolated concepts):

Add authentication to the API

After (frame-activated):

Implement the AUTHENTICATION frame for our API:
– Authority: JWT token issuer
– Credentials: username/password pairs
– Validation: cryptographic verification
– Session: token lifecycle management
– Permissions: role-based access control
– Audit: authentication event logging

Build these frame components with security-first design.

Construction Grammar

Certain sentence constructions consistently produce strong prompts:

Role-Action-Object

As a senior Python developer, architect a data pipeline that handles real-time streaming

Conditional-Temporal

When user input arrives, validate and sanitise it, ensuring no code injection

Analogy Mapping

Database normalisation is like organising a library where books are grouped by topic without duplication

Treat prompts as constructions — test variations systematically.

Formal Specification

Pure formal language is overkill, but BDD-style (Given/When/Then) prompt structures approximate it well.

Example:

Given a user has items in their shopping cart
When they proceed to checkout
Then they should see the payment options
And the cart total should be calculated correctly

Or more concretely:

Scenario: Valid login

Given a user with email “test@example.com” and password “secure123”
When they attempt to login
Then they should be redirected to the dashboard

Scenario: Invalid password

Given a user with email “test@example.com” and password “wrong”
When they attempt to login
Then they should see “Invalid credentials” error

BDD works so well because it combines compositional structure, discourse coherence, frame activation, and model-theoretic validation — all core to linguistics.

Final thoughts

We don’t need to reinvent “prompt theory.” Linguistics already gives us tools to understand why some prompts succeed and others fail.

A few extra techniques worth experimenting with:

  • Conceptual Blending: “Library-memory hybrid where frequent books migrate to the reference desk” (for caching).
  • Relevance Theory: Keep only context that enables new inferences.
  • Code-switching: Mix natural language for logic with code syntax for structure.
  • Specification Languages: Use natural language where it helps comprehension, but lean on formal semantics where precision matters.

If you’re a developer or data practitioner experimenting with LLMs, try treating your prompts less like magic incantations and more like applied linguistics. You may find you get more predictable, higher-quality outputs — and fewer wasted cycles.

At Equal Experts, we’re always swapping notes on real practices that make day-to-day delivery easier. If you’ve been experimenting with these techniques, we’d love to hear what you’ve found.

Try it, share it, and let’s keep refining our collective practice.

You may also like

Blog

AI in the SDLC: Lessons from Travelopia’s Director of Product & Innovation

Blog

“My CEO keeps coming and asking me how we are using AI in the SDLC!” – AI Enabled Delivery According to 50+ Tech Leaders

Case Study

Transforming software delivery with AI, responsibly: Department for Environment, Food & Rural Affairs

Get in touch

Solving a complex business problem? You need experts by your side.

All business models have their pros and cons. But, when you consider the type of problems we help our clients to solve at Equal Experts, it’s worth thinking about the level of experience and the best consultancy approach to solve them.

 

If you’d like to find out more about working with us – get in touch. We’d love to hear from you.