SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.07221 · 2024

LookupFFN: Making Transformers Compute-lite for CPU inference

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 0 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2403.07221.json · badge: /api/ran/2403.07221.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
mlpen/lookupffn canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
create_dataset Ran
ran; our contract draft was wrong, not the code
mlpen/lookupffn/src/datasets_scripts/downstream/quality.py
code served (permissive licence) · get_code("661289c0e647ffa7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Dataset. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import tempfile
import os
from datasets import Dataset
import pandas as pd

# Create a temporary JSON file with test data
temp_dir = tempfile.mkdtemp()
test_file = os.path.join(temp_dir, "test_data.jsonl")

test_data = [
    {
        "article": "The Earth is the third planet from the Sun.",
        "questions": [
            {
                "question": "What is the position of Earth from the Sun?",
                "options": ["First", "Second", "Third", "Fourth"],
                "gold_label": 3
            },
            {
                "question": "Is Earth a planet?",
                "options": ["Yes", "No"],
                "gold_label": 1
            }
        ]
    },
    {
        "article": "Python is a programming language.",
        "questions": [
            {
                "question": "What is Python?",
                "options": ["Snake", "Programming Language", "Food"],
                "gold_label": 2
            }
        ]
    }
]

with open(test_file, 'w') as f:
    for item in test_data:
        f.write(json.dumps(item) + '\n')

ARGS = {
    'path': test_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
datasets, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Dataset — a Dataset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Dataset output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
filter_inputs Ran
ran; our contract draft was wrong, not the code
mlpen/lookupffn/src/utils.py
code served (permissive licence) · get_code("a52fce88045dcb83")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import inspect

torch.manual_seed(0)

def sample_func(x, y, z):
    """A simple function to filter inputs for."""
    return x + y

def another_func(a, b):
    """Another function with different parameters."""
    return a * b

# Create test inputs dictionary with more keys than any single function needs
inputs = {
    'x': torch.randn(2, 4),
    'y': torch.randn(2, 4),
    'z': torch.randn(2, 3),
    'a': torch.randn(2, 5),
    'b': torch.randn(2, 6),
    'unused_key': 42
}

ARGS = {
    'func': sample_func,
    'inputs': inputs
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_optimizer Ran
ran; our contract draft was wrong, not the code
mlpen/lookupffn/src/base_model_module.py
code served (permissive licence) · get_code("8348dc66b62ce338")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned AdamW. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch.optim import Adam, AdamW

torch.manual_seed(0)

# Create a small model to generate optim_groups
model = nn.Sequential(
    nn.Linear(4, 8),
    nn.ReLU(),
    nn.Linear(8, 3)
)

# Create parameter groups for the optimizer
optim_groups = [
    {'params': model[0].parameters(), 'lr': 0.001},
    {'params': model[2].parameters(), 'lr': 0.0005}
]

ARGS = {
    'optimizer': 'adam',
    'optim_groups': optim_groups,
    'base_learning_rate': 0.001,
    'adam_w_mode': True,
    'adam_beta1': 0.9,
    'adam_beta2': 0.98,
    'adam_epsilon': 1e-05
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AdamW — a AdamW output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a AdamW output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
import_config Ran
ran; our contract draft was wrong, not the code
mlpen/lookupffn/src/args.py
code served (permissive licence) · get_code("a00e41e74ad0c0e6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Args. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import os

# Create a temporary directory for test files
tmpdir = tempfile.mkdtemp()

# Test case 1: Create a simple Python config file
config_py_path = os.path.join(tmpdir, 'test_config.py')
with open(config_py_path, 'w') as f:
    f.write("""
# Test configuration file
learning_rate = 0.001
batch_size = 32
num_epochs = 10
model_name = "test_model"
""")

# Test case 2: Create a pickle config file
import pickle
config_pkl_path = os.path.join(tmpdir, 'test_config.pkl')
config_dict = {
    'learning_rate': 0.002,
    'batch_size': 64,
    'num_epochs': 20,
    'optimizer': 'adam'
}
with open(config_pkl_path, 'wb') as f:
    pickle.dump(config_dict, f)

ARGS = {
    'path': config_py_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Args — a Args output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Args output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
import_from_string Ran
ran; our contract draft was wrong, not the code
mlpen/lookupffn/src/args.py
code served (permissive licence) · get_code("204b883a4c318423")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# The function import_from_string takes a string parameter
# It splits on '.', takes the last part as the name, and everything before as the location
# Then it imports the location module and returns the attribute with the given name
# Example: "torch.nn.Linear" would import torch.nn and return Linear

# A valid string for this function would be a fully qualified Python path
# Let's use a built-in module attribute that exists
string_arg = "os.path.join"

ARGS = {
    "string": string_arg
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
write_arrow_file Ran
ran, honoured the contract we drafted
mlpen/lookupffn/src/datasets_scripts/pretrain/jsonl_to_arrow.py
code served (permissive licence) · get_code("68d026dc0e4a5dfc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import pyarrow as pa
import tempfile
import os

# Create a temporary directory for output
temp_dir = tempfile.mkdtemp()
output_file = os.path.join(temp_dir, "test_output.arrow")

# Create sample text data
all_text = [
    "This is the first text sample.",
    "This is the second text sample with more content.",
    "A third sample text.",
    "And finally, a fourth sample."
]

ARGS = {
    "all_text": all_text,
    "output_file": output_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pyarrow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 6 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

While GPU clusters are the de facto choice for training large deep neural network (DNN) models today, several reasons including ease of workflow, security and cost have led to efforts investigating whether CPUs may be viable for inference in routine use in many sectors of the industry. But the imbalance between the compute capabilities of GPUs and CPUs is huge. Motivated by these considerations, we study a module which is a workhorse within modern DNN architectures, GEMM based Feed Forward Networks (FFNs), and assess the extent to which it can be made compute- (or FLOP-) lite. Specifically, we propose an alternative formulation (we call it LookupFFN) to GEMM based FFNs inspired by the recent studies of using Locality Sensitive Hashing (LSH) to approximate FFNs. Our formulation recasts most essential operations as a memory look-up, leveraging the trade-off between the two resources on any platform: compute and memory (since CPUs offer it in abundance). For RoBERTa language model pretraining, our formulation achieves similar performance compared to GEMM based FFNs, while dramatically reducing the required FLOP. Our development is complemented with a detailed hardware profiling of strategies that will maximize efficiency -- not just on contemporary hardware but on products that will be offered in the near/medium term future. Code is avaiable at \url{https://github.com/mlpen/LookupFFN}.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2403.07221")
get_code_for_paper("2403.07221")
have("2403.07221")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2403.07221.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2403.07221.svg)](https://syntology.ai/paper/2403.07221)

Connect an agent — have() is free.