/ Модель

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

Лицензия
CC BY 4.0
Библиотека
pytorch
Опубликована
27 окт 2026

semsimula-ladder-live-code-d384-l2-none-norc-sr2

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

Исследовательская модель второго порядка для продолжения Python-кода, обученная на корпусе CodeParrot.

1 374скачиваний за 30 дней0лайковвеса обновлены18 ноя 2026

Бенчмарки

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

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

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

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

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

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

SR2 — исследовательская модель генерации Python-кода, разработанная в рамках серии Semantic Simulation. Это двухслойная модель с размерностью 384 и консервативной динамикой второго порядка; в экспериментах её сравнивали с парной моделью первого порядка при одинаковых данных и расписании обучения. Модель обучена на 315,392,000 токенах корпуса CodeParrot и использует PyTorch.

Модель предназначена для продолжения Python-кода. В описанном сравнении она показала итоговую валидационную perplexity 6.00 и преимущество 9,2% над парной моделью первого порядка на этом корпусе; при этом сопоставимый GPT-2 показал лучший результат — 4.96. По данным авторов, разница между порядками динамики в основном связана с предсказанием идентификаторов. Длина контекста в карточке не указана; оценка проводилась на блоках длиной 512 токенов. Поддерживаемый язык — английский. Лицензия — CC BY 4.0.

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

  • продолжение фрагментов Python-кода
  • генерация функций и скриптов Python по началу кода
  • сравнение динамики первого и второго порядка в генерации кода

Ограничения

На сопоставимом наборе данных модель уступила GPT-2: perplexity 6.00 против 4.96. Результаты относятся к эксперименту на Python-коде и блокам контекста длиной 512 токенов.

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

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

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

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

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

Открыть на Hugging Face

SR2 on Python code, second order (SO-CODE): second order wins by 9.2%, its largest margin (Gen 3)

The question of this collection: does the conservative core of Semantic Simulation need second-order dynamics (a velocity and inertia), or does a first-order model trained the same way do as well? Each pair trains one model both ways, with everything else the same.

This model: SR2's architecture and settings trained on Python code, the second-order half of the code pair. Verdict: second order wins by 9.2%, its largest margin on any corpus (FO-b-CODE, the true first-order twin, settles at 6.55 against 6.00; TinyStories +2.3%, OpenWebText +4.9%). The first-order model loses on identifiers, and more the further back their earlier occurrence lies. The first-vs-second-order collection holds the pairs.

This model is also the baseline of the dead-wells collection: XI6-CODE, this model with a sixth context channel, loses its layer-1 wells and settles at 8.55 (+43%); with V_θ's learning rate × 0.25 the wells stay alive and it settles at 5.98, level with this model; with unit-norm input to V_θ's bank instead, at 5.95. Neither switch is free on this model: the slower V_θ costs it 1.6%, unit-norm input 5.8%. The root cause and the analysis are in Dead_Wells_in_the_Joint_V_theta_Bank.md.

It is also the two-layer point of the depth-on-code collection: split into four layers at the same integration time (L4-CODE), it settles at 5.48 (−8.5%); into eight (L8-CODE), at 5.35 (−10.7%). The gain is spread over every kind of token.

Result

paircorpus, tokenssecond orderfirst orderfirst order against second
OpenWebText, no wells532.5MSR2 58.32FO-b-OWT 61.16+4.9%
TinyStories, true first order (FO-b), no wells315MSO-TS 5.16FO-b-TS 5.28+2.3%
Python code, true first order (FO-b), no wells315MSO-CODE 6.00FO-b-CODE 6.55+9.2%
Python code, with 2 Poisson-mode wells315MPM2-CODE 5.71FO-b-PM2-CODE 5.62−1.6%

Without wells the gap grows with the corpus, from TinyStories (short children's stories) through OpenWebText to code. With two Poisson-mode wells it closes on the first two corpora; on code, with two wells, the first-order model is ahead.

  • This model: settled 6.00 (mean of the evals at steps 18,000, 18,500 and 19,000: 5.87, 6.02, 6.10); best 5.87 at step 18,000. Validation perplexity at block 512, on the first 2M tokens of CodeParrot's validation files (a file-level split, so no file is in both).
  • Trained on exactly 315,392,000 tokens (19,250 steps × 32 × 512) in one session: the ladder's WSD schedule over 16,250 steps, then 3,000 steps at its floor learning rate, the TinyStories learning-rate curve. Python source with each four-space indentation level written as one tab. Both twins start from step 0 at seed 0 on the same batches.
  • Paired by step: +9.1% to +9.5% over the last seven evaluations (steps 16,000–19,000; the two arms' evaluations correlate at 0.996), and FO-b-CODE is worse in 98% of 512 validation windows.
  • Against a transformer: the matched GPT-2 (d = 384, L = 8) on the same code tokens and schedule settles at 4.96; this model is +20.9% behind it (its twin +32.0%). That model is not on the Hub yet.
  • Pre-registered (Code_Set_First_vs_Second_Order.md, MS5, calls written before either arm trained): CODE1 (FO-b-CODE settles more than 2% above SO-CODE), called 65%: HIT, +9.2%. CODE2 (the gap is larger than OpenWebText's +4.9%), called 35%: HIT. Scored without an extension: both arms fail the settling check by its letter (−0.020 and −0.023 nats over the last 3,000 steps, against a residual scatter of 0.015) but fall together, and the paired gap moves by 0.003 nats over that window. CODE3–CODE5 were scored on the two-well pair on code (all three HIT; see PM2-CODE and FO-b-PM2-CODE).
  • Run health: 19,250 steps in 5.92 h in one session; 0 watchdog triggers; largest rise between logged training losses 0.073; gradient norm median 0.46, maximum 1.67; SCAF leak monitor CLEAN at all 4 audits.

How the pair compares through training

stepphaseSO-CODE (second order)FO-b-CODE (first order)first order against second
500warmup44.0241.91−4.8%
2,000stable17.6716.60−6.1%
5,000stable9.279.26−0.1%
10,500stable, end7.027.77+10.7%
13,000decay6.387.06+10.7%
16,000decay, end6.126.70+9.5%
17,000floor6.076.62+9.1%
18,000floor, best5.876.43+9.5%
19,000floor, last eval6.106.65+9.0%
  • As on the other corpora, first order learns faster at first and then falls behind: it leads until step 5,000, then trails by 11.1% at the end of the stable phase, 10.5% in the decay and 9.2% at the floor.

Where the gap sits: the copy split

Both models' loss per token on the same 262,144 validation targets (512 windows of 512 tokens), grouped by what the context offers each target. Identifier-like tokens are words of letters, digits and underscores: names the programmer chose, and Python keywords. A target's earlier occurrence is its last appearance in the window before it.

targetsshareFO-b − SO, natsshare of the gapSO − GPT-2, nats
all100%+0.086100%+0.186
identifier-like (names and keywords)49.3%+0.15287%+0.253
indentation, newlines, spaces21.9%+0.0082%+0.042
numbers, punctuation and other28.8%+0.03411%+0.182
first occurrence in the window27.7%+0.08527%+0.189
earlier occurrence 1–16 tokens back34.8%+0.04317%+0.109
earlier occurrence 17–64 tokens back25.2%+0.10230%+0.208
earlier occurrence 65–256 tokens back10.8%+0.17822%+0.342
earlier occurrence 257–512 tokens back1.5%+0.1974%+0.395
  • The gap is in identifiers: half the targets, 87% of the gap. Whitespace, a fifth of the targets, carries 2%.
  • It grows with the distance to the earlier occurrence, and not because later positions are harder: among targets at positions 256–511 alone it is +0.04, +0.10, +0.18, +0.20 nats over the four distance bins.
  • It is not a failure to find the earlier occurrence. The context channels ξ are causal weighted averages of earlier tokens' states with learned decays and a content term. When the earlier occurrence lies more than 64 tokens back, the longest channel of FO-b-CODE's second layer puts 24.5% of its weight on it (29 times its uniform share, over about 26 effective positions), SO-CODE's 22.3% (26 times, over about 36). Both look in the same places; the first-order model does less with what it finds.
  • SO-CODE's own gap to GPT-2 has the same shape at twice the size (last column): the conservative core's weakness on code, against attention, is long-range recall of names, and first order makes it worse.

Why second order helps here: a reading

readingSO-CODE (second order)FO-b-CODE (first order)
stiffness of V_θ's modes at the endpoint, median ω·Δt (Cell 6b-13)7.550.86
the same, layer 0 / layer 19.58 / 4.941.17 / 0.002
share of readings past the explicit-integrator wall (2.0)99.97%22.9%

The first-order model builds a soft potential, as it does on OpenWebText (0.74 against 7.55). A gradient-flow step contracts a stiff mode by exp(−(ω·Δt)²/2) and erases the distinctions between tokens along it, so a first-order model cannot keep stiff modes and keep tokens apart; the second-order step turns a stiff mode through a phase and keeps its amplitude. A channel that reaches far back delivers the earlier identifier diluted, about a quarter of its weight spread over some 30 positions, and telling which of many names that mixture carries needs a sharply curved readout, which stiff modes provide. Nearby occurrences arrive almost undiluted through the short channels, and there first order is nearly level (+0.005 nats on tokens other than identifiers within 16 tokens). The softness is the same on every corpus; what changes is how many distinctions the prediction needs, which would explain why the gap orders the corpora as it does. This is an interpretation of these readings, not a measured mechanism, at one seed and L = 2. The argument is Future_of_Semantic_Simulation_When_Second_Order_Earns_Its_Keep.md §3 and the book, §26.9 item (x).

Off the trained schedule (Cell 6b-7)

readingSO-CODE (second order)FO-b-CODE (first order)
Gate 1: perplexity cost of resetting the velocity at inference+4.0%0 (no velocity carried)
Gate 2: one extra layer at the trained step+42%+3.6%
Gate 2: eight layers+6,186%+3,987%
Gate 3: three steps over the trained time, nats0.6390.277
  • One extra layer and standard refinement cost the first-order model little, as on the other corpora: nothing it carries between layers is tuned to the step. Eight layers break both models.

Reproduction

colab_fock_cfc_baoab_lowrank_depth_ladder_openwebtext_d384.ipynb, Cell 0 changed from the defaults:

REVERSE_CHANNEL=False, VPHI_GRAD_PATH='live', XI_GRAD_PATH='live',
LOWRANK_DAMPED_FLOW=True,                 # SR2
VPHI_ANALYTIC_FORCE=True, LAYER_CHECKPOINT=False,   # speed switches, same arithmetic
CORPUS='code', LADDER_STEPS=16_250, EXTRA_FLOOR_STEPS=3_000   # Python code, then 3,000 steps at the floor

Run Cells 0, 1, 1b, 1c, 1d, 2, 3, 4, 5, 5b and 6, then 8, 7, 6b-7 and 6b-13. The first code run builds the token cache (about 25 minutes). The copy split is debug/copy_split.py and the channels' reach debug/xi_reach.py (CPU, on the downloaded run folders).

Training artefacts were written to semsimula_fock_cfc_baoab_code_xi5long_topk16_dt32da16_mh4_aniso_dcvt5x8_vtjoint_cgqk_norc_vplive_xilive_sr2_st16250_L2probe_ob_untied_wsd_e5c_plgate_rep0.05_fockreg0.005_g0.1_baoab_cfc_lowrank_idt4_lr0p0012_noattn/.

Glossary

termmeaning
settled PPLvalidation perplexity at block 512, the mean of the last three evals (on this corpus, steps 18,000–19,000). Best is the lowest single eval
Gen 1 / Gen 2 / Gen 3the model generations. Gen 1: explicit integrators. Gen 2: the CfC/BAOAB ladder with the sources of Vφ and ξ (and of an exchange field) detached, which keeps every force causal, but no loss gradient ever reaches an earlier token through them. Gen 3: the same forward pass with those gradients live
live / detached gradientswhether the loss gradient flows into the earlier tokens that act as sources of a force. Detaching changes no forward value; it only cuts that backward path
Vθthe learned scalar potential on a token's state h, given its context ξ: a bank of anisotropic Gaussian wells. Its negative gradient is the conservative force on the token
Vφa pair potential between a token and a few selected earlier tokens (sparse top-k)
ξthe causal context channels: exponential moving averages of earlier states at several horizons, which condition Vθ
Fock mechanism, registers, reverse channela pool of register particles, created and destroyed from the token context. The reverse channel is the register-to-token force; it is not the gradient of any potential on the tokens, so it is the model's non-conservative part
exchange fieldan attention-like token-to-token interaction added to the conservative core. Each token is pushed by earlier tokens through learned query, key and value projections, as in attention. The ladder tests it in two forms, attention and attention_potential
attention (non-conservative exchange field)the exchange term enters as a force directly. It is not the gradient of anything, so the step stops being a geodesic step
attention_potential (attention as a potential)the same interaction written as a scalar potential whose gradient is the force. The routing weights are computed from the hidden states and held fixed with respect to the state being moved, so the force stays an exact gradient and the model stays conservative
no-exchange (LADDER_MECHANISM = 'none')the arm with no exchange field at all: Vθ, Vφ and ξ, plus the Fock register mechanism unless the arm is conservative-only
live exchange field (RELAX_GRAD_PATH = 'live')attention_potential with the identical forward force written out over live tensors, so the loss gradient reaches the field's sources and routing. In Gen 2 these were detached, and the field sent no gradient into any hidden state
Gen 2 probea Gen 2 arm retrained with one gradient path changed, to test a hypothesis before the full Gen 3 ladder. The live-exchange-field probe (attention_potential with RELAX_GRAD_PATH = 'live', the full 32,500 steps) is the one that found the gradient starvation
gpt2-matchedthe reference transformer: GPT-2 architecture, d = 384, L = 8, tied embeddings (33.7M parameters), trained on the same tokenizer, corpus, batches and token budget. Shared by Gen 2 and Gen 3
tag components (vplive, xilive, rglive, norc, L4probe, idt…)pieces of the run's variant tag, so that every configuration gets its own Drive folder: live Vφ sources, live ξ, live exchange field, no reverse channel, the depth L, and the integrator step Δt
conservative-onlya model in which every force is a gradient: no reverse channel and no non-conservative exchange field
CfC/BAOAB low-rank propagatorthe integrator. Each layer step is split into position (A), force kick (B) and friction (O) substeps, and the stiff harmonic modes of Vθ are integrated exactly in closed form
ω·Δt, θa stiff mode's frequency times the step size. Past 2, an explicit integrator would be unstable (the wall); the closed-form propagator is not. θ/sin θ is the factor by which a split step's dissipation depends on the mode's phase, largest near θ = π
geodesic step, R(geo), sharethe step a damped particle would take under Vθ alone; R(geo) is the distance of the real step from it, relative to the step's length. A component's share is how much it moves that distance (6b-9 attribution)
Gates 1–3, FLOW / MAPSsee Terms in the geometry section
CG1–CG7, 6b-Nthe CfC-geometry experiments, and the ladder-notebook cells that run them
SCAF, Tier A, Tier Bthe in-flight causal-leak monitor. Its core test changes future tokens and requires the logits at earlier positions to stay bit-identical. Tier A asks the same of the hidden states, as 1 − cos between the clean and perturbed state at each earlier position and layer. Tier B asks whether the perturbation moves any earlier state into a different dominant Vθ well (the basin-crossing rate). All three read 0 for a causal model
leak tax, prefix-onlythe loss difference between scoring a position with only its prefix and with the full sequence; about 0 for a causal model
clip-hitthe share of logged steps whose gradient norm exceeded the clipping threshold (1.0)
pre-registereda prediction recorded, with its threshold, before the run

Files

pathwhat
README.mdthis card
config.jsonarchitecture, training, the first-vs-second-order switch, result and diagnostics
checkpoints/fock_cfc_*noattn_best.ptweights at the best eval (step 18,000), optimizer state stripped
results/the training log, the diagnostic cells' outputs, the copy split (copy_split_report*, against GPT-2 and against SO-CODE) and the channels' reach (xi_reach_*)
code/the notebook and the model code the switches belong to (it also carries later, default-off switches)

Companion notes

notewhat it covers
Code_Set_First_vs_Second_Order.md§5.13: the code set (MS5), its calls, these results, the copy split and its reading
Future_of_Semantic_Simulation_When_Second_Order_Earns_Its_Keep.mdwhat the equations say about when second order earns its keep

Caveats

  • One seed per model. The pairing removes the evaluation noise, not the training-seed spread, which has not been measured; at 9.2% the gap is several times the differences of about 1% that the series reads as ties.
  • Not settled by the letter of the settling rule: both arms still fall by about 0.02 nats over their last 3,000 steps, against a scatter of 0.015. They fall together, so the gap is settled; the levels may drop a little with more training.
  • The hyperparameters were tuned for the second-order models on OpenWebText (learning rate 1.2e-3, the WSD fractions, the clip groups).
  • L = 2, and perplexities on code are not comparable with OpenWebText's or TinyStories'.

Citation

@misc{Gueorguiev2026SemSim,
  author    = {Gueorguiev, Dimitar P.},
  title     = {Semantic Simulation: A Prescriptive Lagrangian Framework
               for Semantic Inference --- Conservative Potentials,
               Conservative and Non-Conservative Memory, and Competing Mechanisms},
  year      = {2026},
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.19712427},
  url       = {https://doi.org/10.5281/zenodo.19712427},
  note      = {Version v25 (Nov 9, 2026).
               Companion code repository (DOI 10.5281/zenodo.24066016):
               \url{https://github.com/dimitarpg13/semsimula-paper}}
}

Card generated from _ladder/ladder.json on 2026-11-17.

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

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

GPU в ailist

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

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

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

Ревизия весов
5e0bbc4

0 моделей