← Latest papers
💻 computer science

On the (Intuitionistic) Logic of Next-Token Prediction

This paper models next-token prediction in autoregressive neural networks using intuitionistic implicational logic and the Curry-Howard correspondence, where token generation corresponds to modus ponens and sequence processing to constructive proof extension, ultimately deriving a neural architecture equivalent to multiplicative RNNs and validating its properties through specialized theorem provers.

Original authors: Paul Tarau (University of North Texas)

Published 2026-08-11
📖 6 min read🧠 Deep dive

Original authors: Paul Tarau (University of North Texas)

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to teach a robot how to tell a story. You give it the first few words, and it has to guess the next one. Most modern robots, like the ones powering today's chatbots, do this by looking at the whole story so far and asking, "What word usually hangs out with these ones?" They use a giant spotlight called "attention" to scan the past words and find the best match. It's like a librarian who remembers every book ever written and finds the one that sounds most similar to the one you're holding.

But there's another way to think about this. Instead of just looking for similar words, what if the robot treated the story like a chain of logical steps? Imagine that every word isn't just a word, but a tiny instruction that changes the state of the story. If you say "The cat," that isn't just a description; it's a command that sets up a specific expectation for what comes next. In this view, predicting the next word is like solving a math puzzle or completing a proof: if you have the right starting conditions, the next step is the only logical thing that can happen. This paper dives into that idea, asking if we can build a robot that learns by following these logical chains rather than just mimicking patterns.


The Arrow Model: When Words Become Wrenches

In this paper, Paul Tarau proposes a fresh way to look at how AI predicts the next word in a sentence. He calls his new idea the Arrow Language Model. Instead of the usual method where the AI scans a huge list of past words to find similarities, Tarau suggests we treat the sequence of words as a logical proof.

Here is the core idea: Imagine you are building a tower out of blocks. In the old way (like Transformers), you look at the whole tower and ask, "What block fits best on top?" In Tarau's new way, every block you add is actually a special tool, like a wrench or a screwdriver. When you add a block, it doesn't just sit there; it changes the shape of the tower underneath it. The next block you add has to fit the new shape created by the previous one.

Tarau uses a branch of math called intuitionistic logic to describe this. In this logic, a sentence isn't just a list of words; it's a long, nested chain of "if-then" statements.

  • If you have the word "The," it sets up a condition.
  • If you add "cat," it changes that condition.
  • If you add "sits," it changes it again.

The paper suggests that predicting the next word is exactly like Modus Ponens, a famous rule of logic that says: "If I have 'If P then Q', and I have 'P', then I must have 'Q'." In the AI's brain, the current state of the sentence is the "If P then Q," and the new word is the "P." The result? The next word pops out as the "Q."

How the Machine Works

To make this work in a real computer, Tarau built a neural network where every word is an operator. Think of the AI's memory (its "hidden state") as a piece of clay.

  • In normal AI, words are like stickers you put on the clay.
  • In the Arrow Model, words are like hands that squeeze and twist the clay.

When the word "The" comes in, it twists the clay one way. When "cat" comes in, it twists it a different way. Because twisting the clay with "The" first and then "cat" creates a different shape than doing "cat" first and then "The," the order of words is built right into the math. You don't need to tell the computer "this word is first" or "this word is second" with extra codes; the twisting action naturally remembers the order.

The paper shows that this twisting action is mathematically the same as multiplying matrices (a way computers do math with grids of numbers). This makes the model very efficient. It doesn't need to look back at the whole history of the sentence every time; it just needs to know the current shape of the clay and apply the next twist.

The Experiments: Can It Learn?

The author tested this idea with a very specific goal: to see if the model could "memorize" a book by learning the logical structure of its sentences. They took public domain books (like War and Peace and Moby Dick) and fed them to the model.

To make sure the test was fair and clear, they didn't ask the model to write new stories. Instead, they asked it to finish sentences it had already seen.

  • The Setup: They gave the model a chunk of a sentence (like "The cat") and asked it to predict the rest.
  • The Logic Check: They also built a "logic robot" (using a programming language called Prolog) that could solve the same sentences using pure math rules.
  • The Result: The Arrow Model learned to predict the next words almost perfectly, matching the logic robot's answers.

The paper reports that the model could train on large books very quickly. For example, it took about 7 minutes and 52 seconds to train on War and Peace (which has over 560,000 words) using a standard computer graphics card. It could also finish a sentence in about 0.1 to 0.3 seconds.

What This Means (and What It Doesn't)

The paper suggests that we don't need the giant "spotlight" (attention) that most modern AI uses to understand order. Instead, order can be built directly into how the words change the AI's state. This offers a different, perhaps simpler, way to build language models.

However, the author is careful to point out the limits. This experiment worked because the AI was only asked to finish sentences it had already seen, like a student reciting a poem they memorized. The paper admits that this model might struggle if you give it a sentence with a typo, a missing word, or a weird phrasing it hasn't seen before. Real-world language is messy, and this "logical proof" approach is currently best at handling clean, exact patterns.

The author also notes that while this model is great at understanding order through twisting and turning, it doesn't yet handle the "big picture" connections that the spotlight method does. It's a promising new direction, suggesting that the future of AI might not just be about finding similar words, but about understanding how each word logically transforms the story.

In short, this paper proposes that the secret to predicting the next word isn't just remembering the past, but treating every word as a tool that reshapes the future. It's a playful, logical, and mathematically elegant way to think about how machines might learn to speak.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →