/ Модель

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

Контекст
1 024 токена
Лицензия
Apache 2.0
Архитектура
looped_gpt2 · dense
Базовая модель
music-large-800k
Библиотека
transformers
Опубликована
1 дек 2026

music-large-800k-looped

Генерация текстаТекст → текст
240скачиваний за 30 дней0лайковвеса обновлены1 дек 2026

Описание модели

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

Архитектурная конверсия GPT-2 для авторегрессионной генерации продолжений символической музыки в виде последовательностей событий.

DangerLabs подготовила Looped Anticipatory Music Transformer — архитектурную конверсию авторегрессионной GPT-2-модели stanford-crfm/music-large-800k для генерации продолжений символической музыки. Модель принимает последовательности музыкальных событий и предсказывает следующие токены; в README описано кодирование событий через время начала, длительность и ноту.

Веса 36 блоков GPT-2 распределены между прелюдией из 9 слоёв, общим ядром из 18 слоёв и кодой из 9 слоёв. Ядро повторно выполняется с общими весами, а обучаемые параметры LoopGate стабилизируют активации между проходами. Контекст составляет 1024 токена; при одном проходе модель заявлена как бит-в-бит идентичная базовой. Чекпойнт содержит 780-миллионную базовую модель и 7 681 новых параметров LoopGate; продолженное обучение не проводилось.

Модель предназначена для авторегрессионной генерации MIDI-подобных последовательностей событий. В README приведены результаты тестов сохранения музыкальной грамматики и стабильности при нескольких проходах, однако они не заменяют независимую оценку качества музыки. Доступна по лицензии Apache-2.0.

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

  • генерация продолжения MIDI-последовательности
  • создание последовательностей нот и длительностей
  • авторегрессионное сочинение символической музыки

Ограничения

Чекпойнт является конверсией весов без продолженного обучения; параметры LoopGate инициализированы заново. Заявленные результаты стабильности и скорости приведены в README и не являются независимой оценкой качества генерируемой музыки.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

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

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

Открыть на Hugging Face

Looped Anticipatory Music Transformer (DangerLabs/music-large-800k-looped)

DangerLabs/music-large-800k-looped is a Looped Transformer architectural conversion of stanford-crfm/music-large-800k (Thickstun et al., TMLR 2024, arXiv:2306.08620), implementing the prelude / core / coda weight-sharing layout and gated inter-pass stabilization described in David Louapre's Looped Transformers: Thinking twice with the same weights (Nov. 2026), drawing on Thinking Machines' Inkling 2 Mini and Z.ai's GLM-5.4.

Training State Note: This checkpoint is a weight-preserving architectural conversion initialized directly from stanford-crfm/music-large-800k with freshly initialized LoopGate parameters (7,681 added parameters, +0.00098%). No continued training has been run yet. At num_passes=1, the model is bit-for-bit identical (max_abs_diff = 0.0, KL = 0.0) to stanford-crfm/music-large-800k; at num_passes >= 2, the GLM-5.4-style per-token gate keeps activations bounded and distributions tightly aligned with the base model, ready for fixed-pass or variable-loop continued training on symbolic music corpora.


Architecture Comparison vs. Original

PropertyOriginal (stanford-crfm/music-large-800k)Patched (DangerLabs/music-large-800k-looped)
ArchitectureGPT2LMHeadModelLoopedGPT2LMHeadModel (looped_gpt2)
Stored Layers3636 (9 prelude + 18 core + 9 coda)
Effective Depth3618 + 18 × num_passes (default num_passes=2 → 54 layers)
Parameters780,139,520780,147,201 (+7,681 / +0.00098% from LoopGate)
Hidden Size / Heads1280 / 201280 / 20 (unchanged)
Vocabulary / Context55,030 / 102455,030 / 1024 (unchanged AMT arrival-time + anticipation vocab)
Inter-Pass StabilizationN/APer-token scalar LoopGate: h ← h + g · (core(h) - h) (default "gated", also supports "inject" and "plain")
Attention Scalingscale_attn_by_inverse_layer_idx=TruePreserved per pretrained block
KV Cache Strategy36 layersIsolated per-pass virtual cache slots (9 + 18 × num_passes + 9 layers)
Test-Time ComputeFixed (36 layers)Variable num_passes per forward() call (1, 2, 3, ...)

Prelude / Core / Coda Layout

Following Inkling 2 Mini's 1:2:1 split, the 36 GPT-2 blocks of music-large-800k are partitioned as:

  • Prelude (h[0..8], 9 layers, runs once): Maps arrival-time, duration, note, and anticipation control embeddings into internal musical representations.
  • Core (h[9..26], 18 layers, runs num_passes times): Shared weights executed iteratively for deeper sequential processing without adding model parameters.
  • Coda (h[27..35], 9 layers, runs once): Projects refined internal representations back to next-token logits.

Each (pass_idx, core_layer) writes to its own virtual slot in DynamicCache, ensuring cached autoregressive generation matches full-sequence forward passes (max_abs_diff < 2e-5 at num_passes=2) while preserving each pretrained block's original inverse-layer-index attention scaling.


Executive Summary of Performance Differences

All benchmarks were executed on an NVIDIA GB10 GPU (PyTorch 2.14.1+cu130, transformers 5.5.0) with strict single-model GPU memory isolation (only one model resident on GPU per phase). Full raw metrics are included in benchmark_results.json.

  • Near-zero wrapper overhead at num_passes=1: Prefill, decode, and training throughput are within 0–2% of the original GPT2LMHeadModel across all batch sizes and sequence lengths, with 0.00e+00 logit difference and 100.00% exact greedy rollout parity.
  • Constant weight VRAM across passes: During use_cache=False prefill, peak VRAM stays completely flat from p=1 to p=4 (4,730 MB at bs=1, seq=1024; 5,515 MB at bs=8, seq=1024), delivering up to 2.5× effective depth (90 layers) in the exact same weight footprint as the 36-layer original.
  • Faster than real-time music generation up to num_passes=4: At full 1024-token context (bs=1), p=2 generates at 56.3 tok/s (1.88× real-time) and even p=4 (90 effective layers) sustains 34.4 tok/s (1.15× real-time) assuming ~10 MIDI events/sec (30 tok/s).
  • Flat ~6.8 GB training VRAM with gradient checkpointing: Uncheckpointed training VRAM scales linearly with passes (14.1 → 25.8 GB at bs=2, seq=1024), whereas enabling gradient checkpointing holds peak VRAM flat at 6.84–6.95 GB across p=1..4 (−62% to −73% VRAM).
  • 100% musical grammar preservation: Across 126-token (42-event) greedy and sampled rollouts, all pass counts (p=1..4) maintain 100.0% valid (time, duration, note) triplets and 100.0% monotonic arrival times.
  • Gating prevents multi-pass collapse: Over 8 passes, naive weight-tied looping (plain) blows up hidden norms 3.82× (25.1 → 95.9, KL = 2.25, top-1 drops to 65.8%), whereas default gated (gate_init_bias=-2.0) keeps norms bounded (33.1, KL = 0.042, 98.1% top-1) and inject converges to a fixed point (27.3, KL = 0.0038, 98.8% top-1).

Detailed Benchmarks vs. Original (stanford-crfm/music-large-800k)

1. Prefill Scaling Across Batch Sizes & Sequence Lengths (bfloat16, use_cache=False)

Measured over 10 timed iterations (after 3 warmup iterations) with isolated GPU memory:

Batch Size 1 (Interactive / Single-Stream)

Model / PassesEff. LayersSeq 128 (ms / tok/s)Seq 256 (ms / tok/s)Seq 512 (ms / tok/s)Seq 1024 (ms / tok/s)Peak VRAM @ 1024
Original (GPT2LMHeadModel)3615.76 / 8,12319.88 / 12,87846.03 / 11,123124.23 / 8,2434,703 MB
Looped (p=1)36 (1.0×)15.88 / 8,05820.24 / 12,64645.49 / 11,256127.87 / 8,0084,732 MB
Looped (p=2, default)54 (1.5×)23.36 / 5,48029.63 / 8,63968.89 / 7,432185.60 / 5,5174,730 MB
Looped (p=3)72 (2.0×)30.61 / 4,18139.11 / 6,54689.97 / 5,691250.98 / 4,0804,730 MB
Looped (p=4)90 (2.5×)37.42 / 3,42048.37 / 5,292111.72 / 4,583317.09 / 3,2294,730 MB

Batch Sizes 4 & 8 (Batched Scoring / Offline Processing)

Model / Passesbs=4, s=512 (ms / tok/s)bs=4, s=1024 (ms / tok/s)bs=8, s=512 (ms / tok/s)bs=8, s=1024 (ms / tok/s)Rel. Speed @ bs=8, s=1024Peak VRAM @ bs=8, s=1024
Original268.57 / 7,626569.00 / 7,199574.08 / 7,135787.65 / 10,4011.00×5,486 MB
Looped (p=1)273.17 / 7,497581.51 / 7,044577.96 / 7,087794.55 / 10,3100.99×5,516 MB
Looped (p=2)408.62 / 5,012863.71 / 4,742863.85 / 4,7421,187.41 / 6,8990.66×5,515 MB
Looped (p=3)546.22 / 3,7491,148.94 / 3,5651,146.99 / 3,5711,574.11 / 5,2040.50×5,515 MB
Looped (p=4)680.01 / 3,0121,434.83 / 2,8551,434.01 / 2,8561,969.82 / 4,1590.40×5,515 MB

Prefill latency scales almost ideally with effective depth (18 + 18 × num_passes) / 36 (1.00×, 1.50×, 2.00×, 2.50×), with zero additional peak VRAM for extra passes.


2. Autoregressive Decode Scaling Across Context Lengths & Batch Sizes (bfloat16, use_cache=True)

AMT represents each musical event as a 3-token triplet (arrival_time, duration, note). The RT Factor column measures per-stream speed relative to real-time playback at 10 events/sec (30 tok/s).

Single-Stream Decode (batch_size=1)

Model / PassesShort 64→128 (ITL / tok/s)Med 256→320 (ITL / tok/s)Long 512→576 (ITL / tok/s)Full Context 896→1024 (TTFT / ITL / tok/s)RT Factor @ 1024KV Cache @ 1024Peak VRAM @ 1024
Original10.38 ms / 96.310.86 ms / 92.111.32 ms / 88.4151.2 ms / 12.08 ms / 82.82.76×180.0 MB (36L)4,835 MB
Looped (p=1)10.40 ms / 96.210.89 ms / 91.811.35 ms / 88.1150.4 ms / 12.19 ms / 82.12.74×180.0 MB (36L)4,865 MB
Looped (p=2)15.19 ms / 65.815.95 ms / 62.716.65 ms / 60.0197.0 ms / 17.76 ms / 56.31.88×270.0 MB (54L)4,951 MB
Looped (p=3)19.94 ms / 50.220.89 ms / 47.921.90 ms / 45.7249.8 ms / 23.40 ms / 42.71.42×360.0 MB (72L)5,032 MB
Looped (p=4)24.73 ms / 40.425.96 ms / 38.527.18 ms / 36.8312.8 ms / 29.03 ms / 34.41.15×450.0 MB (90L)5,111 MB

Batched Decode (batch_size=4, 64 new tokens per stream)

Model / Passesbs=4, 256→320 Total tok/s (Per-Stream)bs=4, 512→576 Total tok/s (Per-Stream)RT Factor @ 512→576KV Cache @ 512→576Peak VRAM @ 512→576
Original268.4 (67.1)231.2 (57.8)1.93×405.0 MB5,178 MB
Looped (p=1)267.5 (66.9)230.8 (57.7)1.92×405.0 MB5,207 MB
Looped (p=2)180.7 (45.2)156.0 (39.0)1.30×607.5 MB5,386 MB
Looped (p=3)137.1 (34.3)117.6 (29.4)0.98×810.0 MB5,565 MB
Looped (p=4)109.8 (27.5)94.4 (23.6)0.79×1,012.5 MB5,747 MB

3. Precision Comparison (bfloat16 vs. float16 vs. float32, bs=1)

Prefill measured at seq=512; decode measured at prompt=128 → 64 new tokens:

Model / PassesPrecisionPrefill 512 (ms / tok/s)Decode (ITL / tok/s)Peak VRAM
Originalbfloat1645.08 ms / 11,35810.56 ms / 94.74,650 MB
Originalfloat1642.92 ms / 11,93010.55 ms / 94.74,650 MB
Originalfloat3288.51 ms / 5,78518.18 ms / 55.03,191 MB
Looped (p=1)bfloat1644.72 ms / 11,44810.67 ms / 93.74,679 MB
Looped (p=1)float1643.77 ms / 11,69810.63 ms / 94.14,679 MB
Looped (p=1)float3288.37 ms / 5,79418.25 ms / 54.83,220 MB
Looped (p=2)bfloat1668.20 ms / 7,50715.48 ms / 64.64,678 MB
Looped (p=2)float1663.45 ms / 8,06915.48 ms / 64.64,678 MB
Looped (p=2)float32128.96 ms / 3,97026.85 ms / 37.23,220 MB

(Note: float32 shows lower peak VRAM than autocast because autocast retains bf16/fp16 cast copies alongside fp32 master weights during inference; loading directly in torch_dtype=torch.bfloat16 cuts weight memory in half to ~1.56 GB.)


4. Continued-Training Step Benchmark (Forward + Backward, bfloat16)

Crucial for fixed-pass or variable-loop continued training (5 timed steps after 2 warmup steps, full parameter gradients):

Model / Passesbs=2, s=512 (ms / tok/s / VRAM)bs=4, s=512 (ms / tok/s / VRAM)bs=2, s=1024 No Ckpt (ms / tok/s / VRAM)bs=2, s=1024 Grad Ckpt (ms / tok/s / VRAM)
Original360.6 ms / 2,840 / 9.26 GB716.6 ms / 2,858 / 13.89 GB722.9 ms / 2,833 / 13.89 GB995.1 ms / 2,058 / 6.60 GB
Looped (p=1)365.2 ms / 2,804 / 9.50 GB712.4 ms / 2,875 / 14.13 GB719.8 ms / 2,845 / 14.13 GB990.3 ms / 2,068 / 6.84 GB
Looped (p=2)510.3 ms / 2,007 / 11.46 GB1,047.0 ms / 1,956 / 18.04 GB1,051.3 ms / 1,948 / 18.03 GB1,447.1 ms / 1,415 / 6.84 GB
Looped (p=3)677.0 ms / 1,513 / 13.41 GB1,373.1 ms / 1,492 / 21.94 GB1,367.6 ms / 1,498 / 21.94 GB1,906.2 ms / 1,074 / 6.84 GB
Looped (p=4)833.3 ms / 1,229 / 15.37 GB1,710.6 ms / 1,197 / 25.84 GB1,719.3 ms / 1,191 / 25.84 GB2,360.1 ms / 868 / 6.95 GB

Key takeaway: With gradient checkpointing enabled (model.gradient_checkpointing_enable()), continued training of 54–90 effective layers fits in < 7 GB VRAM (a 62–73% reduction vs. uncheckpointed), enabling variable-loop training on a single 12–16 GB GPU.


5. Zero-Shot Musical Quality & Per-Token-Type Sensitivity Across 4 AMT Regimes (float32)

Evaluated across 4 distinct symbolic music regimes (4 sequences × 241 tokens = 964 tokens per regime, 3,856 tokens total), before any continued training:

Musical Regimenum_passesmax_abs_diffKL(orig ‖ looped)Top-1 AgreeTop-5 AgreeBase NLL → Looped NLLCos Sim to p=1
Monophonic Melody10.00e+000.00000100.00%100.00%0.6610 → 0.66101.0000
21.5530.0009598.76%100.00%0.6610 → 0.66310.9982
33.8330.0039198.24%99.59%0.6610 → 0.66700.9935
46.0710.0115297.20%99.59%0.6610 → 0.67600.9866
Polyphonic Ensemble (piano + bass + strings + drums)10.00e+000.00000100.00%100.00%0.4093 → 0.40931.0000
21.2490.0004199.79%100.00%0.4093 → 0.40860.9983
33.2900.0016598.86%99.59%0.4093 → 0.40890.9937
45.9210.0051798.55%99.59%0.4093 → 0.41130.9869
Dense Arpeggios (100 ms 16th-note grid)10.00e+000.00000100.00%100.00%0.3099 → 0.30991.0000
21.1850.00040100.00%100.00%0.3099 → 0.31070.9984
32.5020.00180100.00%100.00%0.3099 → 0.31290.9943
43.6480.0044899.48%99.59%0.3099 → 0.31690.9883
Anticipatory Conditioned (interleaved control + event)10.00e+000.00000100.00%100.00%3.7868 → 3.78681.0000
22.4570.0119096.99%100.00%3.7868 → 3.81010.9980
35.0810.0456993.98%99.07%3.7868 → 3.83300.9927
47.4400.0942591.80%98.44%3.7868 → 3.86060.9851

Per-Token-Type Breakdown at Default num_passes=2

RegimeToken TypeBase NLLLooped (p=2) NLLKL(orig ‖ looped)Top-1 Agreement
Polyphonic EnsembleArrival Time (0..9999)0.32570.32270.0005099.69%
Duration (10000..10999)0.36230.36030.0004199.69%
Note (11000..27511)0.54000.54290.00029100.00%
Anticipatory ConditionedArrival Time (0..9999)7.90207.78700.0595587.50%
Duration (10000..10999)0.26870.26420.00066100.00%
Note (11000..27511)1.21581.20340.0005298.75%
Control (27512..55023)4.44494.53540.0036098.54%

6. Autoregressive Rollout Comparison (4 Prompts × 126 Generated Tokens = 42 Events)

Comparing multi-step generation trajectories (49-token musical prompts → 126 generated tokens) for greedy decoding and nucleus sampling (temperature=1.0, top_p=0.95):

Model / PassesGreedy Exact Match vs. OrigMean First Divergence StepGreedy Valid Triplets / Monotonic TimeGreedy Entropy (nats)Sampled Valid Triplets / Monotonic TimeSampled Unique PitchesSampled Events/sSampled Entropy (nats)
Original(ref)(ref)100% / 100%0.2208100% / 100%327.090.6059
Looped (p=1)100.00%126 / 126 (none)100% / 100%0.2208100% / 100%327.090.6059
Looped (p=2)99.80%125 / 126100% / 100%0.2212100% / 100%295.870.4106
Looped (p=3)94.05%94 / 126100% / 100%0.2866100% / 100%285.870.4174
Looped (p=4)93.45%94 / 126100% / 100%0.2926100% / 100%285.620.3763

At default num_passes=2, 3 of 4 prompts produce 100% identical 126-token greedy continuations to stanford-crfm/music-large-800k, and the 4th matches for the first 122 tokens. Across all pass counts (p=1..4), AMT triplet grammar and monotonic timestamps remain 100% intact.


7. Carry-Mode & gate_init_bias Stability Sweep Across 8 Passes (Reproducing GLM-5.4 / Louapre 2026)

Comparing carry modes and gate bias initializations on the same pretrained music-large-800k weights over 8 core passes (polyphonic_ensemble, pass-1 norm = 25.09, base NLL = 0.4093):

ConfigurationGate gPass 1 NormPass 2 NormPass 4 NormPass 6 NormPass 8 NormKL @ 8 PassesTop-1 @ 8 PassesNLL @ 8 PassesCos Sim @ 8 Passes
gated (bias=-4.0)0.01825.0925.2425.5525.8726.180.0004699.69%0.40870.9981
gated (bias=-2.0, default)0.11925.0926.1428.3630.6833.060.0421798.13%0.43930.9486
gated (bias=-1.0)0.26925.0927.5832.9138.4043.870.2945589.32%0.65780.8561
gated (bias=0.0)0.50025.0930.0040.2850.3960.291.1232374.27%1.45800.7461
inject (bias=-2.0, Inkling)0.11925.0927.0727.2927.2927.290.0038198.76%0.41100.9902
plain (naive weight-tied)—25.0935.8856.1675.9995.932.2464965.77%2.58700.6091

Without gating (plain), hidden-state norms grow 3.82× over 8 passes and next-token predictions collapse (KL = 2.25, NLL = 2.59), directly reproducing the activation norm blow-up reported for GLM-5.4 and Louapre (2026). Both gated (bias=-2.0) and inject keep norms tightly controlled, with inject converging to a stable fixed point (27.29) by pass 5.


Usage

Loading directly from Hugging Face Hub

import torch
from transformers import AutoModelForCausalLM

model = AutoModelForCausalLM.from_pretrained(
    "DangerLabs/music-large-800k-looped",
    trust_remote_code=True,
    torch_dtype=torch.bfloat16,
).cuda().eval()

# Example AMT arrival-time sequence: [z=0 (55025), (time, dur, note), ...]
input_ids = torch.tensor(
    [[55025, 0, 10050, 11060, 50, 10040, 11064, 100, 10050, 11067]],
    device="cuda",
)

# Default 2 passes (54 effective layers) with loop diagnostics
out = model(input_ids, return_loop_trace=True)
print("Pass norms:", out.loop_trace["pass_norms"])
print("Gate means:", out.loop_trace["gate_means"])

# Override passes at test time (1 = exact original stanford-crfm/music-large-800k)
out_p1 = model(input_ids, num_passes=1)
out_p3 = model(input_ids, num_passes=3)

# Autoregressive generation with isolated per-pass KV caches
generated = model.generate(
    input_ids,
    max_new_tokens=30,
    do_sample=True,
    top_p=0.95,
    use_cache=True,
)

Continued Training Recommendations

To unlock long-range musical structure and harmonic planning gains from extra passes (as in GLM-5.4 and Inkling's variable-loop training):

  • Enable gradient checkpointing (model.gradient_checkpointing_enable()) to keep VRAM flat (~6.8 GB at bs=2, seq=1024) regardless of num_passes.
  • Fixed-pass continued training: Keep num_passes=2 (or 3) with carry_mode="gated" and train on Lakh MIDI arrival-time / anticipatory sequences.
  • Variable-loop training: Sample num_passes ~ Uniform(1, 4) per step during continued training so the model learns an iterative refinement procedure that generalizes across test-time pass counts.

Citations

@article{thickstun2024anticipatory,
  title={Anticipatory Music Transformer},
  author={Thickstun, John and Hall, David and Donahue, Chris and Liang, Percy},
  journal={Transactions on Machine Learning Research},
  year={2024},
  url={https://arxiv.org/abs/2306.08620}
}

@misc{louapre2026_looped_transformers,
  title={Looped Transformers: Thinking twice with the same weights},
  author={Louapre, David},
  year={2026},
  howpublished={\url{https://huggingface.co/spaces/dlouapre/looped-transformers}}
}

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

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

GPU в ailist

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

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

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

Класс архитектуры
LoopedGPT2LMHeadModel
Ревизия весов
86f37f4

0 моделей