/ Модель

Характеристики

Контекст
2 048 токенов
Параметры
29,8 млн
Лицензия
Apache 2.0
Архитектура
rh_nanochat · dense
Библиотека
transformers
Опубликована
25 ноя 2026

riemann-nano

Генерация текстаТекст → текст3 профессии

Небольшая языковая модель для генерации Lean 4-кода по формализации доказательства гипотезы Римана и исследования масштабирования обучения на одном корпусе.

150скачиваний за 30 дней3лайкавеса обновлены25 ноя 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

riemann-nano — небольшая языковая модель, разработанная Levent Alpöge и обученная на формализации доказательства гипотезы Римана на Lean 4 и связанных импортах Mathlib. Это плотный авторегрессионный трансформер семейства RHNanoChat с 29,8 млн параметров по метаданным Hugging Face и контекстом 2048 токенов. README приводит другую оценку размера — 61 млн параметров.

Модель предназначена для генерации фрагментов Lean-кода в узком контексте формализации доказательства гипотезы Римана и для изучения масштабных закономерностей обучения на одном математическом корпусе. Она была обучена в эксперименте с примерно 60 nanochat-моделями при разных вычислительных бюджетах; для итоговой модели использовался один ускоритель H200. Модель не является универсальным помощником по Lean или математике.

Автор предупреждает, что сгенерированные доказательства не проверены: их следует считать правдоподобно выглядящим Lean-кодом, пока Lean не подтвердит корректность. Модель видела только одну формализацию и её импорты, поэтому её применение ограничено этим корпусом. Репозиторий использует лицензию Apache-2.0.

Сценарии применения

  • продолжение фрагментов Lean 4 из формализации гипотезы Римана
  • черновая генерация определений и теорем Lean по этому корпусу
  • изучение влияния размера модели и вычислительного бюджета на качество обучения

Ограничения

Сгенерированные доказательства не проверены и могут быть некорректны; результат нужно проверять средствами Lean. Модель обучена на одной формализации и её импортах и не предназначена для общего использования как помощник по Lean.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

riemann-nano

riemann-nano is a small language model trained on one document: the Lean 4 formalization of the proof of the Riemann Hypothesis, released by Levent Alpöge in November 2026. The proof runs to 175,000 files and about 300 million tokens. That's enough to train a language model on, and to ask how big that model should be.

To answer that, we trained about 60 nanochat models at six compute budgets and fitted a scaling law in the style of Chinchilla. We then used the law to predict the compute-optimal model size at a larger budget, 1017 FLOPs, and trained that model. That model is riemann-nano: a 7-layer transformer with 61M parameters. Every model in the sweep, riemann-nano included, was trained on Hugging Face Jobs; riemann-nano itself took one H200.

Scaling laws for riemann-nano

The prediction holds up: in a sweep at 1017 FLOPs, riemann-nano is within noise of the best model of any size.

Samples

Part of the fun of a model trained on a single corpus is seeing what it picks up. Here's riemann-nano, and two smaller models from the scaling sweep, finishing the same prompts.

Watching it learn

Prompt: /-- The completed Riemann zeta function. -/ def

With 100× less compute than riemann-nano, the model has worked out that Lean is full of integers:

def (Λ : Submodule ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ ℤ

With 10× less, it knows a definition needs a name and a type, if not what goes in them:

def B/4 : ℝ/4444444444444444444444444444445444444444445444455454444545444444454444444444554454544

riemann-nano writes a full definition, then closes a namespace it never opened:

def Basic : Prop := ∀ (L : PeriodPair) (h : SCFTAll) (ψ : ℂ →+ ℂ), IsHomClass L ψ → IsCharClass L (h * ψ) →
  ∀ σ : ℂ ≃+* ℂ, (∀ z, ‖σ z‖ = ‖z‖) → ∀ (s : ℂ) (a : ℕ), 0 < a → (a : ℂ) ^ 2 * σ h = h * (s ^ 2 * σ (h * ψ (Complex.I ^ a / s)))

end Formalism.HermitianLattices.Ext.L3

The same thing happens with proofs. Asked why ζ(s) ≠ 0 when Re s > 1, the smallest model reaches for simp and lists every lemma it knows: simp [zero_add, zero_add, add_zero, neg_zero, neg_zero, neg_zero, neg_zero]. riemann-nano writes a tidy proof, then moves on to the next lemma in the family. It mixes a lemma it invented with a real one, summable_geometric_of_lt_one, which the proof uses 173 times:

theorem riemannZeta_ne_one_of_one_lt_re {s : ℂ} (hs : 1 < s.re) : riemannZeta s ≠ 1 := by
  have : 1 < s.re := hs
  simp only [riemannZeta_eq_tsum_of_summable_norm summable_norm]
  exact summable_geometric_of_lt_one (by linarith) (by linarith)

Analytic number theory, house style

Prompt: namespace RiemannHypothesis

namespace RiemannHypothesis

def gauss : ℝ := Real.exp (-2 * Real.log 4)

def bnd : ℝ := 2 * Real.log (2 * |2|) / 2

def bnd1 : ℝ := 4 / 3

lemma gauss_nonneg : 0 ≤ gauss := by unfold gauss; positivity

lemma gauss_pos : 0 < gauss := by unfold gauss; positivity

lemma gauss_pos1 : 0 < gauss := by
  unfold gauss; positivity

lemma bnd1_pos : 0 < gauss := by
  unfold gauss; positivity

Define a constant, prove it's positive, prove it again just in case, then prove it a third time under bnd1's name. The real proof calls positivity more than 45,000 times, and riemann-nano has picked up the habit.

A proof of the Riemann Hypothesis

Prompt: theorem riemannHypothesis : RiemannHypothesis := by

theorem riemannHypothesis : RiemannHypothesis := by
  have h1 := riemannHypothesis
  unfold RiemannHypothesis
  exact mul_le_mul_of_nonneg_right (by norm_num) (by positivity)

theorem riemannHypothesis : RiemannHypothesis :=
  riemannHypothesis

theorem riemannHypothesisE : RiemannHypothesisE := riemannHypothesis

theorem riemannHypothesisT : RiemannHypothesisT := riemannHypothesis

The most efficient proof possible: cite the theorem itself. Once it has one, it reuses it for the variants E and T.

Algebraic geometry on demand

Prompt: structure

structure IsRegularLocalRing (S : Type*) [CommRing S] [IsRegularLocalRing S]
    [IsLocalRing S] [IsRegularLocalRing S] : Prop :=
  ringKrullDim S = 1 ∧ ringKrullDim S = 1 ∧
    ringKrullDim S = ringKrullDim (ResidueField S)

Krull dimensions, residue fields and the right typeclass brackets, all from a one-word prompt. It does assume the structure in its own definition, twice.

A little in-context learning

Show riemann-nano three worked examples, and it picks up the idea of finishing a simple goal with the right tactic:

-- the prompt: three examples
example : 8 ^ 2 + 15 ^ 2 = 17 ^ 2 := by norm_num
example : Nat.Prime 11 := by norm_num
theorem three_mul' (n : ℕ) : 3 * n = n + n + n := by ring

-- riemann-nano's proofs, each checked by Lean ✓
example : 3 ^ 2 + 4 ^ 2 = 5 ^ 2 := by norm_num
example : Nat.Prime 13 := by norm_num
theorem two_mul' (n : ℕ) : 2 * n = n + n := by ring
theorem sq_nonneg' (x : ℝ) : 0 ≤ x ^ 2 := by positivity

Asked for Nat.gcd 12 18 = 6, it reaches for Bézout's identity and stops halfway. Asked to make up Pythagorean triples of its own, it's more creative than correct: 2 ^ 3 + 7 ^ 2 = 17 ^ 2.

Where everything lives

With no prompt at all, riemann-nano starts a file the way the proof does, with a wall of imports:

import Mathlib
import Development.AbelianVarietyTheory.Proofs.InertiaEigenvalues.UnipotentBlockColumnIndex
import Development.AbelianVarietyTheory.Proofs.InertiaEigenvalues.QuotientAveragePeriodicBoundedFreeStatement
import Development.AbelianVarietyTheory.Proofs.InertiaEigenvalues.QuotientAveragePeriodicRelationFamilyStatement
import Development.AbelianVarietyTheory.Proofs.InertiaEigenvalues.QuotientAverageBilinearEquivSymmContinuousStatement

Nearly half the proof lives under AbelianVarietyTheory/Proofs, so that's where it sends you first.

Usage

from transformers import AutoModelForCausalLM, AutoTokenizer

repo = "lewtun/riemann-nano"
tokenizer = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True)

prompt = "theorem riemannHypothesis : RiemannHypothesis := by\n"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=200, do_sample=True, temperature=0.8, top_k=50)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

You need transformers 5.24. The model uses custom code, so trust_remote_code=True is required for both the model and the tokenizer. The tokenizer adds a beginning-of-document token, and generation stops at <|eos|>.

Limitations

  • Its proofs are unchecked. Treat its output as Lean-flavoured fiction until Lean accepts it.
  • It is small and narrow. riemann-nano has only seen this one formalization and its Mathlib imports. It is not a general Lean assistant.
  • It is a research artifact. It exists to test scaling-law predictions on a single, finite mathematical corpus. At larger budgets than this one, the 300M tokens have to be reused many times and the law above stops holding. The training code, data preparation and scaling analysis are on the rh branch of the nanochat fork.

Acknowledgements

Thanks to Ben Burtenshaw for the original idea of training a nanochat model on the Riemann Hypothesis proof.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers

Нельзя запустить

Модели нужен код из репозитория; запуск откроется после проверки совместимости.

Класс архитектуры
RHNanoChatForCausalLM
Ревизия весов
54e6f62

0 моделей