/ Модель

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

Лицензия
MIT
Архитектура
cbt · dense
Библиотека
pytorch
Опубликована
22 окт 2026

CBT

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

Компактный символьный Transformer для сложения длинных чисел и простых вызовов инструментов в англоязычном формате.

74скачиваний за 30 дней1лайквеса обновлены25 окт 2026

Бенчмарки

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

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

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

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

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

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

CBT-18.95M — компактный символьный Transformer от автора репозитория Neithanvarvas. Модель содержит 18,94 млн параметров и использует Decoupled 2D-RoPE: каждому символу назначаются координаты столбца и шага внутри столбца. Архитектура состоит из шести слоёв с общими весами, каждый слой применяется трижды; ширина модели — 512, число голов внимания — 8.

Модель предназначена прежде всего для сложения неотрицательных целых чисел и экспериментов с обобщением на числа длиннее обучающих. По README, она обучалась на суммах до 25 цифр и сохраняла точность на проверках вплоть до 55 цифр; контекст в 1024 символа ограничивает длину сумм примерно 75 цифрами. Также CBT умеет выполнять простые вызовы инструментов в узком синтетическом формате диалога: погоду, поиск, калькулятор и конвертацию единиц. Работает на CPU, веса доступны в safetensors.

Результаты арифметических и инструментальных проверок получены на небольших тестовых наборах и одиночных запусках. Точность сложения падает за пределами 55 цифр; после результата инструмента ответы могут становиться бессвязными. Это не универсальный чат-ассистент: модель обучена только сложению неотрицательных чисел и синтетическим диалогам с фиксированным набором инструментов, обладает скудными знаниями о мире и работает только с английскими ASCII-символами. Лицензия — MIT.

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

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

Ограничения

Модель обучена только сложению неотрицательных целых чисел; точность снижается за пределами 55 цифр, а контекст ограничивает суммы примерно 75 цифрами. Диалоговые возможности узкие, ответы после вызова инструмента могут искажаться; поддерживаются только английские ASCII-символы.

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

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

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

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

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

Открыть на Hugging Face

CBT-18.95M

A 19M-parameter character-level Transformer that adds numbers longer than any it was trained on.

CBT (Character-Based Transformer) gives every token a two-dimensional position: which column it belongs to and which step inside that column. With that layout, a model trained on sums of up to 25 digits keeps adding correctly at 26, 40 and 55 digits. An identical twin with ordinary 1D positions gets every one of those wrong.

The same model also does simple tool calling (weather, search, calculator, unit conversion, ...) in a small chat format.

Paper (PDF) · Paper (Markdown) · Code on GitHub


Try it

pip install -U huggingface_hub
hf download Neithanvarvas/CBT --local-dir CBT && cd CBT
pip install -r requirements.txt
python chat.py

git clone https://huggingface.co/Neithanvarvas/CBT also works; without git-lfs the weights are fetched on first run.

> 123456789+987654321
  scratchpad : (0+9+1)=10(1+8+2)=11(1+7+3)=11(1+6+4)=11 ... (1+0+0)=01
  answer     : 1111111110   [PASS]

> What is the weather in Tokyo?
  think      : The user requests current weather information. I will query the get_weather tool.
  call       : get_weather(city="Tokyo")
  result     : {"temp": 22, "condition": "Sunny", "city": "Tokyo"}
  answer     : The weather in Tokyo is currently Sunny with a temperature of 22 degrees Celsius.

Runs on a CPU; no GPU needed. Pass --online to let the search tool query Wikipedia, or --raw to see the token stream.

From Python

from cbt import load, add, chat

model, tok = load()   # uses this folder, or downloads from the Hub if run elsewhere

add(model, tok, 31415926535897932384626433832795, 27182818284590452353602874713527)["answer"]
# '58598744820488384738229308546322'

chat(model, tok, "Convert 10 km to miles")["answer"]

chat runs one user turn and executes at most one tool call. Tools are offline stand-ins in cbt/tools.py; pass tool_executor=your_function to connect real ones.

Compare with the 1D-RoPE twin

The control model from the results below ships in twin_1d/. Give both the same long sum:

twin, _ = load(variant="twin_1d")
a, b = 31415926535897932384626433832795, 27182818284590452353602874713527   # 32 digits, unseen
add(model, tok, a, b)["correct"]   # True
add(twin, tok, a, b)["correct"]    # False

From the terminal: python chat.py --variant twin_1d.


Results

Greedy decoding, 30 random problems per length. Training covered sums of 1 to 25 digits.

Addition: CBT vs. its 1D-RoPE twin

The twin has the same architecture, data and number of training steps. Only the position encoding differs. Its weights are in twin_1d/.

Operand digitsSeen in training?CBT (2D)1D twin
4, 8, 12, 14, 16yes150 / 150149 / 150
20, 25yes60 / 6057 / 60
26no30 / 300 / 30
30, 35, 40, 45, 50, 55no180 / 1800 / 180
60no25 / 300 / 30
70no19 / 300 / 30
All unseen (26-70)no254 / 2700 / 270

Tool use: exact tool and arguments

Test setPromptsCBT (2D)1D twin
Rephrased requests262625
Out-of-distribution entities181818
Entities never seen in training303030

Both models do equally well here, so tool use comes from the training data, not from the 2D layout. The fine-tuning data was broadened after an earlier model failed the first two sets, so the unseen-entity set is the fairer test.

All numbers come from single training runs with small test sets. Raw per-problem results are in evaluation/; limitations are discussed in the paper.


How it works

Each token gets a coordinate (p, tau):

  • Arithmetic: p is the decimal place (units, tens, ...) and tau is the step within that column of the scratchpad.
  • Chat: p is the dialogue segment (user, think, call, result, answer) and tau is the character position inside it.

Half of each attention head is rotated by p and half by tau (Decoupled 2D-RoPE). Aligning digits of the same place becomes one fixed relation, "same p", which does not change as numbers get longer, so the model learns it once. During training, p is randomly shifted by up to 45, so the model has seen place values up to 70.

Parameters18.94M (18.89M non-embedding)
Layers6, each applied 3 times with shared weights (effective depth 18)
Width / heads512 / 8 (head dim 64)
Context1024 characters
Vocabulary111: 97 ASCII characters (letters, digits, punctuation, space, tab, newline) + 14 control tags
PositionsDecoupled 2D-RoPE, coordinate shift k = 45
TrainingPretraining, then several supervised fine-tuning rounds (23,927 steps in the last)

Prompt formats

Addition:  <BOS>123+456=<THINK>(0+3+6)=09(0+2+5)=07(0+1+4)=05</THINK>=579<EOS>
Chat:      <BOS><USER>question</USER><THINK>...</THINK><CALL>tool(arg="...")</CALL><RESULT>{json}</RESULT><ANSWER>...</ANSWER>

Scratchpad steps read (carry + digit_a + digit_b) = carry_out digit, from the units column upward.


Limitations

  • Addition of non-negative integers is the only arithmetic it was trained on. Accuracy drops beyond 55 digits, and the 1024-character context caps sums at roughly 75 digits.
  • Replies can drift into garbled text after the tool result (for example, "What is the weather in Paris?" ends with misspelled filler).
  • The chat ability is narrow: it was trained on synthetic tool-calling dialogues with a fixed set of tools. It is not a general assistant and has little world knowledge.
  • Character-level, English-only, ASCII-only. Other characters become <UNK>.

Files

README.md               this card
config.json             model hyperparameters
model.safetensors       weights
twin_1d/                the matched 1D-RoPE control (config.json, model.safetensors)
cbt/                    model, tokenizer, tool stubs, load/add/chat helpers
chat.py                 terminal demo
requirements.txt
paper/                  the paper (PDF and Markdown)
evaluation/             per-problem results behind the tables above

Citation

@article{vargas2026cbt,
  title  = {From Digits to Characters: Two-Dimensional Rotary Coordinates for Length Generalization in a Compact Character-Level Transformer},
  author = {Vargas Vargas, Neithan},
  year   = {2026}
}

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

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

GPU в ailist

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

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

Архитектура cbt неизвестна transformers в образе рантайма.

Ревизия весов
8414bb4

0 моделей