/ Модель

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

Контекст
8 192 токена
Параметры
395 млн
Лицензия
Apache 2.0
Архитектура
modernbert · dense
Базовая модель
ModernBERT-large
Библиотека
transformers
Опубликована
24 авг 2026

SenseShift-large

Заполнение пропусковТекст → текст3 профессии

Англоязычная модель на базе ModernBERT-large для переписывания или добавления предложений с заданной тональностью в контексте отрывка.

179скачиваний за 30 дней1лайквеса обновлены24 авг 2026

Бенчмарки

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

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

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

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

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

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

SenseShift-large — англоязычная модель для управляемого редактирования текста, разработанная на базе answerdotai/ModernBERT-large. Она переписывает выбранное предложение в отрывке или добавляет новое, ориентируясь на целевую тональность от −1,0 до +1,0 с шагом 0,1, и учитывает текст до и после изменяемого места.

Модель построена на двунаправленном энкодере ModernBERT-large с архитектурой ModernBertForMaskedLM и содержит около 394,7 млн параметров. Для генерации маскирует слова в целевом предложении и восстанавливает их с помощью поиска по лучам; контекст модели — 8192 токена. Подходит для изменения эмоциональной окраски прозы, отзывов и описаний, а также для создания размеченных вариантов текста и проверки устойчивости классификаторов. Лицензия — Apache-2.0.

Модель обучалась на коротких детских историях с оценками тональности VADER и переносится на другую английскую прозу, но отрицательная тональность представлена в обучающих данных слабее положительной. Крайние значения −1,0 и +1,0 практически не обучались; для более надёжного управления README рекомендует диапазон от −0,9 до +0,9 и проверку фактически достигнутой тональности. Генерация выполняется неавторегрессионным заполнением масок, поэтому может отличаться от обычной генерации текста слева направо.

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

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

Ограничения

Модель обучалась на коротких детских историях; отрицательная тональность представлена хуже положительной, а крайние целевые значения практически не обучались. Для целевого диапазона −0,9…+0,9 рекомендуется проверять фактически достигнутую оценку VADER.

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

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

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

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

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

Открыть на Hugging Face

SenseShift-large

Rewrite any sentence in a passage — or write a new one — at a sentiment you choose on a continuous scale from −1.0 to +1.0, in context.

ModelBaseParams
SenseShift-baseModernBERT-base150M
SenseShift-large (this model)ModernBERT-large396M

Accepted to EMNLP 2026.

How it works

Sentiment is a control vocabulary: 21 special tokens [-1.0] … [1.0] on a 0.1 grid, added to the ModernBERT tokenizer.

Training: every sentence in a passage is scored with VADER and prefixed with its own sentiment token. One sentence is then masked out. The model must reconstruct it from the token it was given and the text on both sides — so it learns to write a sentence that hits a requested sentiment and fits its neighbours.

Generation reverses this. Prefix each sentence with its current sentiment, give the target sentence the sentiment you want, mask its words, and fill the masks with beam search. Because the generator is a bidirectional encoder rather than a decoder, every token it writes is conditioned on the text before and after — which is what lets it replace a sentence mid-passage.

Examples

Rewriting sentence [3] at −0.8. The model picks up "tunnel" from the preceding sentence:

Once upon a time, there was a little boy named Timmy. One day, Timmy went to a park with his mommy. At the park, there was a big tunnel that Timmy wanted to explore. Timmy's mommy said he could choose whether or not to go through the tunnel. → But Timmy's mommy said no because it was too dangerous. Timmy was brave and decided to go through the tunnel. As Timmy crawled through the tunnel, he felt mighty and strong. When he came out the other side, he was so happy and proud of himself. From that day on, Timmy loved going on adventures and choosing to be brave.

Rewriting sentence [2] of a restaurant review at +0.8. The model carries the business name "Lotus 2" in from context:

I ordered delivery this evening and I must say that I was pleasantly surprised at the level of customer service on the phone and at my door. I usually get my Chinese take out from best wok 2 and they pale in comparison to lotus 2. I ordered the exact same things that I usually order from best wok and everything tasted better and was of better quality and was even a little less expensive. → Lotus 2 are very friendly and always make sure that I get the best quality of food and I get a lot of value for my money. I am so happy that I've found a new Chinese take out. And they deliver! Of course its not P.F. Changs. But its well worth what you pay.

Use cases

  • Writing assistant for fiction. Adjust the emotional arc of a draft one sentence at a time — darken a turning point, soften an ending — without rewriting the surrounding prose.
  • Review and copy editing. Retune the tone of a testimonial, product description or release note while keeping the concrete details intact.
  • Data augmentation. Generate sentiment-varied paraphrases of a corpus at known target values: balance a skewed sentiment dataset, or produce minimal pairs that differ in sentiment but share context.
  • Counterfactual and robustness testing. Probe a downstream classifier with inputs where exactly one sentence's sentiment moved, holding everything else fixed.
  • Controllable-generation research. A non-autoregressive baseline for continuous attribute control, and a testbed for how far a control signal can be pushed at inference time.

Usage

No install needed — the inference code ships in this repo.

git clone https://huggingface.co/shawhed/SenseShift-large
import sys
sys.path.insert(0, "SenseShift-large")

from senseshift import SenseShift

shifter = SenseShift.from_pretrained("SenseShift-large")

text = ("At the park, there was a big tunnel that Timmy wanted to explore. "
        "Timmy's mommy said he could choose whether or not to go through the tunnel. "
        "Timmy was brave and decided to go through the tunnel.")

# Rewrite a sentence at a target sentiment
out = shifter.generate(text, generation_mode="rewrite", sentence_index=1, sentiment=-0.8)
print(out.sentence)
print(out.text)

# Write a new sentence and splice it in after sentence 2
out = shifter.generate(text, generation_mode="add", sentence_index=2, sentiment=0.9)
print(out.text)

Requires torch, transformers, huggingface-hub, nltk. The VADER lexicon downloads itself on first use.

generate arguments

ArgumentDefaultMeaning
text—The passage to edit.
generation_mode"rewrite""rewrite" replaces the sentence at sentence_index; "add" inserts a new sentence after it.
sentimentNoneNone keeps the current sentiment; "random" draws from the grid; a number in [-1, 1] is snapped to the nearest 0.1.
sentence_indexNoneWhich sentence to act on. Defaults to a random sentence (rewrite) or the last one (add). Negative indices count from the end.
num_masksNoneMask slots given to the model, i.e. roughly how long the new sentence is. Defaults to the replaced sentence's word count, or 12 for add.
seedNoneSeeds the random index / sentiment draws.

Decoding parameters — leave any at None to use the model's defaults:

ArgumentDefaultMeaning
beam_size2Hypotheses kept alive. Higher is slower and usually more fluent. num_beams works as an alias.
top_k40Candidate tokens considered per masked position.
temperature0.8Below 1.0 is more conservative, above 1.0 more varied.
alpha0.7Length-normalisation exponent; higher tolerates longer output.
gamma0.05Diversity penalty on beams reusing the same token.
max_iters30Cap on mask-filling steps.
min_words3Tokens filled before the model may stop at punctuation. Raise to avoid very short rewrites.
out = shifter.generate(text, sentence_index=1, sentiment=-0.8, beam_size=8, top_k=60, temperature=0.9)

generate returns a SenseShiftOutput with .text (the edited passage), .sentence (what was written), .original_sentence, .target_sentiment, .achieved_sentiment (VADER of the result) and .beams. str(out) gives the passage.

Training data

TinyStories-style short children's stories, labelled per sentence with VADER. Despite the narrow training domain it transfers to other English prose — the review example above is out-of-domain.

Negative sentiment is under-represented in that corpus, so the negative half of the range is a looser steer than the positive half, and the extremes ±1.0 are effectively untrained. Use targets in −0.9 … +0.9, and read out.achieved_sentiment if you need a specific value.

Citation

Accepted to EMNLP 2026. A preprint and BibTeX entry will be linked here once they are public.

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

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

GPU в ailist

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

Можно запустить

Подбираем GPU…

Класс архитектуры
ModernBertForMaskedLM
Ревизия весов
0176c45

0 моделей