← Latest papers
🤖 machine learning

Prime Fourier Embeddings: A Principled Basis for Modular Arithmetic

This paper introduces Prime Fourier Embeddings (PFE), a principled representation that encodes integers using prime-indexed harmonic components to naturally expose algebraic structure, thereby enabling modular arithmetic to be solved via channel selection with theoretical guarantees of equivariance and empirical evidence of extreme channel specialization and perfect accuracy on square-free composite moduli.

Original authors: Hyunsang Hwang, Suhyun Bae, Donghun Lee

Published 2026-06-23
📖 5 min read🧠 Deep dive

Original authors: Hyunsang Hwang, Suhyun Bae, Donghun Lee

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

The Problem: Teaching a Robot to Do Math

Imagine you are trying to teach a robot how to do modular arithmetic (like a clock: if it's 10 o'clock and you add 5 hours, it becomes 3 o'clock).

Standard AI models usually start with a "blank slate." They are given numbers as generic lists of numbers (embeddings) and have to figure out the rules of math from scratch by looking at millions of examples. This is hard. The paper notes that these models often memorize the answers first and only suddenly "get it" after a long time—a phenomenon the authors call "grokking." It's like a student who memorizes a multiplication table but doesn't understand why 3 times 4 is 12 until years later.

The authors argue this happens because the robot isn't given the right "tools" to see the structure of numbers.

The Solution: Prime Fourier Embeddings (PFE)

The authors created a new way to represent numbers called Prime Fourier Embeddings (PFE).

Think of numbers not as single blocks, but as a symphony of different frequencies.

  • In standard math, we often think in base-10 (like our fingers). But the paper says base-10 is messy because 10 is made of 2 and 5 mixed together.
  • PFE breaks numbers down into their prime ingredients (like 3, 5, 7, 11, etc.).

The Analogy: The Radio Station
Imagine the number 21.

  • In standard AI, 21 is just a generic signal.
  • In PFE, 21 is broadcast on two specific radio stations: Station 3 and Station 7 (because 3×7=213 \times 7 = 21).
  • The number is encoded as a pair of waves (sine and cosine) for each prime number.

When you add two numbers together in this system, the math happens naturally on these specific radio stations. If you are doing math modulo 21, the AI only needs to listen to Station 3 and Station 7. It doesn't need to listen to Station 5 or Station 11.

The Big Discovery: The "Block-Diagonal" Rule

The most exciting part of the paper is a mathematical proof about how this system works.

The authors proved that if an AI uses this PFE system, it is mathematically forced to treat each prime number as a separate, independent room.

  • The Rule: The AI cannot mix the information from "Station 3" with "Station 5." They are in different, sealed rooms.
  • The Result: If the task is to solve a problem involving the number 21, the AI must use the rooms for 3 and 7. The rooms for 5, 11, and 13 will stay completely empty and unused.

This is like a Chinese Remainder Theorem (a famous math rule) built directly into the AI's brain. The AI doesn't have to discover that 21 is made of 3 and 7; the structure of the input forces it to see that immediately.

The Experiments: Does it Work?

The researchers tested this by training AI models on different math problems and then performing "surgery" on the model (removing parts of it) to see what happened.

  1. The "Surgery" Test: They turned off the "Station 3" channel in a model trying to solve a problem involving the number 3.

    • Result: The model's performance crashed.
    • Contrast: When they turned off "Station 5" (which wasn't needed for that specific problem), the model didn't care at all.
    • The Ratio: The difference in importance between the "needed" channel and the "useless" channel was over 500 times. This proves the AI is strictly using the right channels and ignoring the rest.
  2. Perfect Scores: For all the complex math problems they tested (using numbers made of different prime combinations), the models achieved 100% accuracy on the test data. They didn't just memorize; they generalized perfectly because the math was built into the input.

Why This Matters

The paper argues that we shouldn't just throw data at a black box and hope it learns the rules of math. Instead, we should design the input to match the mathematical structure of the problem.

  • Old Way: Give the AI a generic list of numbers and hope it figures out that 10=2×510 = 2 \times 5.
  • New Way (PFE): Give the AI a set of specialized tools (prime channels) where the math is already separated and organized.

By doing this, the AI skips the long, confusing "grokking" phase and goes straight to understanding. It turns a hard problem of "discovery" into an easy problem of "selection" (just picking the right radio station).

Summary

The paper introduces a new way to feed numbers to AI that respects the natural "prime number" structure of math. This forces the AI to organize its thinking into independent channels for each prime number. The result is an AI that learns modular arithmetic instantly, perfectly, and without the confusion that plagues standard models. It's a proof that if you build the right mathematical foundation into your AI, it will do the math correctly by design.

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 →