/ Модель

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

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

dual-lm-470m

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

Экспериментальная языковая модель на 470 млн параметров совмещает авторегрессионную генерацию текста и двунаправленное предсказание замаскированных токенов.

161скачиваний за 30 дней1лайквеса обновлены28 апр 2026

Бенчмарки

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

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

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

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

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

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

ltg/dual-lm-470m — языковая модель, разработанная Дэвидом Самуэлем и Лукасом Жоржем Габриэлем Шарпантье для исследования двойной цели обучения. Она сочетает авторегрессионное обучение и masked diffusion в стандартном трансформере с LLaMA-бэкбоном, поэтому поддерживает генерацию текста и двунаправленное предсказание замаскированных токенов. В README описаны результаты исследования, представленного на ICLR 2026.

В основной версии около 470 млн параметров, 24 слоя, словарь из 51 200 BPE-токенов и контекст 2 048 токенов. Модель обучена на 32 млрд токенов англоязычного набора HPLT2.0_cleaned. В README также указаны варианты обучения в отдельных ветках репозитория, включая модели с разным соотношением целей и числом повторов данных. Для загрузки используются классы Transformers с trust_remote_code=True.

Модель подходит для генерации продолжений текста, двунаправленного языкового моделирования и оценки правдоподобия последовательностей. README сообщает о небольшом улучшении двунаправленных возможностей при сохранении авторегрессионного качества в рекомендуемой конфигурации, но приведённые оценки относятся к небольшим моделям и конкретным бенчмаркам. Лицензия репозитория — Apache-2.0.

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

  • генерация продолжения англоязычного текста
  • двунаправленное предсказание пропущенных токенов
  • оценка правдоподобия текста
  • сравнение авторегрессионного и masked-diffusion обучения
  • эксперименты с двунаправленным контекстом при генерации

Ограничения

Контекст ограничен 2 048 токенами, а обучение ориентировано на английский язык. Для загрузки требуются пользовательские классы модели и trust_remote_code=True; качество следует оценивать с учётом небольшого размера модели и приведённых в README бенчмарков.

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

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

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

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

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

Открыть на Hugging Face

Dual-objective Language Model (470M)

This is the model repository for the paper Dual-Objective Language Models: Training Efficiency Without Overfitting, published at ICLR 2026.

The dual-objective approach combines autoregressive and masked-diffusion training objectives within a single standard transformer — no architectural changes required. The resulting model can be used as a causal language model, a masked (MNTP) language model, or with prefix attention at inference time.

AuthorsDavid Samuel and Lucas Georges Gabriel Charpentier
PaperarXiv:2512.14549
Codegithub.com/ltgoslo/dual-language-models
LicenseApache 2.0

Model Overview

  • Parameters: 470M total (360M non-embedding)
  • Layers: 24
  • Hidden size: 1024
  • Attention heads: 16 (head dim = 64)
  • Intermediate size: 3554 (SwiGLU)
  • Vocabulary: 51,200 BPE tokens
  • Context length: 2,048 tokens
  • Training tokens: 32 billion
  • Positional encoding: RoPE (θ = 160,000)
  • Normalization: RMSNorm (pre-norm, ε = 1e-7)

Main Branch

The main branch contains the model trained with the recommended configuration for regular data settings (Remark 1 in the paper):

SettingValue
α (autoregressive weight)63/64 (0.984375)
Data repetitions1× (32B total tokens)
Training objective98.4% autoregressive + 1.6% masked-diffusion

This configuration achieves strong autoregressive performance while gaining bidirectional capabilities essentially for free.

All Trained Models

All 50 models from the paper are available as branches. Each branch is named alpha_{α:.3f}_n-reps={R}:

The models span:

  • Repetitions (R): 1, 2, 4, 8, 16, 32, 64, 128, 256
  • Alpha (α): 0 (pure masked-diffusion) to 1 (pure autoregressive), with values at 0, 1/256, 1/64, 1/16, 1/4, 1/2, 3/4, 15/16, 63/64, 255/256, 1

For example:

  • alpha_0.750_n-reps=32 — dual model (α=3/4) trained with 32 data repetitions
  • alpha_0.125_n-reps=128 — dual model (α=1/8) trained with 128 data repetitions
  • alpha_1.000_n-reps=1 — pure autoregressive baseline with 1 repetition
  • alpha_0.000_n-reps=128 — pure masked-diffusion with 128 repetitions

Recommended Configurations

RegimeRepetitionsRecommended αBranch
Regular data (≤16 reps)1×63/64 (0.984375)main
Data-constrained (32 reps)32×3/4 (0.75)alpha_0.750_n-reps=32
Data-constrained (128 reps)128×1/8 (0.125)alpha_0.125_n-reps=128

Usage

This model uses a LLaMA-backbone-based implementation (LlamaModel from transformers) with a custom GELU projection head. All model classes require trust_remote_code=True.

Loading the Model

from transformers import AutoTokenizer, LlamaConfig
from hf_model_llama.modeling_dlm_llama import DLMLlamaForCausalLM

model_id = "ltg/dual-lm-470m"

tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
config = LlamaConfig.from_pretrained(model_id)
model = DLMLlamaForCausalLM.from_pretrained(model_id, config=config, trust_remote_code=True)

Text Generation (Autoregressive)

import torch
from transformers import AutoTokenizer, LlamaConfig
from hf_model_llama.modeling_dlm_llama import DLMLlamaForCausalLM

model_id = "ltg/dual-lm-470m"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
config = LlamaConfig.from_pretrained(model_id)
model = DLMLlamaForCausalLM.from_pretrained(model_id, config=config, trust_remote_code=True)
model.eval()

prompt = "The history of artificial intelligence begins with"
inputs = tokenizer(prompt, return_tensors="pt")

with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=100,
        do_sample=True,
        top_p=0.95,
        temperature=0.8,
    )

print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Masked Language Model (Bidirectional / MNTP)

The model can also be used bidirectionally by loading it as DLMLlamaForMaskedLM. This uses full (non-causal) attention, enabling the model to attend to all positions.

import torch
from transformers import AutoTokenizer, LlamaConfig
from hf_model_llama.modeling_dlm_llama import DLMLlamaForMaskedLM

model_id = "ltg/dual-lm-470m"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
config = LlamaConfig.from_pretrained(model_id)
model = DLMLlamaForMaskedLM.from_pretrained(model_id, config=config, trust_remote_code=True)
model.eval()

# Mask token id
mask_id = tokenizer.convert_tokens_to_ids("<mask>")

# Predict masked tokens with bidirectional context
text = "The capital of <mask> is Paris"
inputs = tokenizer(text, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)

# The model uses MNTP: prediction at position i is for token i+1
# Find the mask position and get the prediction from position before it
mask_pos = (inputs["input_ids"] == mask_id).nonzero(as_tuple=True)[1].item()
predicted_id = outputs.logits[0, mask_pos - 1].argmax(dim=-1)
print(f"Predicted: {tokenizer.decode(predicted_id)}")

Perplexity / Log-Likelihood Scoring

import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, LlamaConfig
from hf_model_llama.modeling_dlm_llama import DLMLlamaForCausalLM

model_id = "ltg/dual-lm-470m"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
config = LlamaConfig.from_pretrained(model_id)
model = DLMLlamaForCausalLM.from_pretrained(model_id, config=config, trust_remote_code=True)
model.eval()

text = "Language models predict the next token in a sequence."
inputs = tokenizer(text, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs, labels=inputs["input_ids"])

print(f"Loss (NLL per token): {outputs.loss.item():.4f}")
print(f"Perplexity: {torch.exp(outputs.loss).item():.2f}")

Loading a Specific Branch

from transformers import LlamaConfig
from hf_model_llama.modeling_dlm_llama import DLMLlamaForCausalLM

# Load the data-constrained model (α=3/4, 32 repetitions)
model_id = "ltg/dual-lm-470m"
config = LlamaConfig.from_pretrained(model_id, revision="alpha_0.750_n-reps=32")
model = DLMLlamaForCausalLM.from_pretrained(
    model_id,
    revision="alpha_0.750_n-reps=32",
    config=config,
    trust_remote_code=True,
)

Available Model Classes

TaskClass
Causal LM (generation)DLMLlamaForCausalLM
Masked LM (bidirectional)DLMLlamaForMaskedLM
Sequence ClassificationDLMLlamaForSequenceClassification
Token ClassificationDLMLlamaForTokenClassification
Question AnsweringDLMLlamaForQuestionAnswering

All classes are in hf_model_llama.modeling_dlm_llama.

Architecture

The model follows the standard modern transformer recipe with no modifications:

  • Pre-normalization with RMSNorm (with learnable scale)
  • Rotary Positional Embeddings (RoPE) with θ = 160,000
  • SwiGLU feed-forward layers
  • Classifier head: RMSNorm → Linear + GELU(tanh) → LM head (with bias)
  • No tied embeddings (tie_weights = false)

The only difference between autoregressive and masked-diffusion modes is the input (original vs. partially masked tokens) and the attention mask (causal vs. bidirectional). Both modes predict the next token at each position.

Training Details

HyperparameterValue
OptimizerMuon (Liu et al., 2025)
Learning rate0.007
LR scheduleWarmup-Stable-Decay (no warmup, 2,048 decay steps)
Total steps8,192
Batch size4M tokens (global)
Sequence length2,048
Weight decay0.1
Z-loss1e-4
Precisionbfloat16
Hardware128× AMD MI250X GPUs (256 logical devices)
Training corpusHPLT v2 (English subset)

The α parameter controls the split of GPUs between objectives: with 256 logical devices, α = 63/64 means 252 devices run autoregressive and 4 run masked-diffusion.

Evaluation Results

Autoregressive (Unidirectional) Performance

Normalized scores where 0% = random baseline, 100% = perfect.

ModelARC-CARC-EBLiMPCSQAHSwagMMLUOBQAPIQASIQAAvg
Dual (α=63/64, 1 rep)5.728.663.735.131.14.917.640.914.326.9
AR-only (α=1, 1 rep)5.930.361.333.531.73.813.639.415.226.1
Dual (α=3/4, 32 reps)3.328.057.931.126.43.614.436.114.623.9
AR-only (α=1, 32 reps)5.024.953.328.525.43.89.933.314.222.0
Dual (α=1/8, 128 reps)1.723.656.124.814.21.68.528.113.319.1
AR-only (α=1, 128 reps)-1.012.333.26.88.11.1-0.515.88.99.4

Key Findings

  1. Regular data (≤16 reps): A small amount of masked-diffusion (α ≈ 63/64) improves bidirectional performance without losing any autoregressive quality.
  2. Data-constrained (>32 reps): Choose α so the autoregressive objective sees ~16 effective repetitions. The dual model dramatically outperforms pure autoregressive (19.1 vs 9.4 at 128 reps).
  3. Prefix attention: Dual-objective models reliably gain ~1+ percentage points by processing the context bidirectionally at inference time — no additional training needed.

Practical Recommendations from the Paper

Remark 1 (Regular data settings): Train with α ≈ 63/64 to gain strong bidirectional performance without losing autoregressive quality.

Remark 2 (Data-constrained settings): Choose α that exposes the autoregressive objective to roughly 16 repetitions of the training data.

Remark 3 (Prefix language modeling): At inference time, process the conditional part of the prompt fully bidirectionally for improved autoregressive performance.

Citation

@inproceedings{
  samuel2026dualobjective,
  title={Dual-objective Language Models: Training Efficiency Without Overfitting},
  author={David Samuel and Lucas Georges Gabriel Charpentier},
  booktitle={The Fourteenth International Conference on Learning Representations},
  year={2026},
  url={https://openreview.net/forum?id=BrPt0GFgOM}
}

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

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

GPU в ailist

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

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

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

Класс архитектуры
DLMLlamaForCausalLM
Ревизия весов
593c193

0 моделей