Paper deep dive
SENSESHIFT: Continuous Sentiment-Controlled Text Generation via Encoder-based Mask Infilling
Shahed Masoudian, Markus Frohmann, Emmanouil Karystinaios, Navid Rekabsaz, Markus Schedl
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 93%
Last extracted: 8/29/2026, 4:20:58 AM
Summary
The paper introduces SenseShift, an encoder-based framework for fine-grained, sentence-level controllable text generation (CTG) focused on sentiment control. Unlike dominant decoder-based models that use causal attention, SenseShift utilizes bidirectional attention, quantized sentiment signals, and iterative mask infilling to generate sentences conditioned on specific sentiment intensities. Evaluated on story and review datasets, SenseShift demonstrates superior sentiment controllability and contextual fit compared to larger decoder-based baselines.
Entities (10)
Relation Signals (9)
SenseShift → employsmechanism → Bidirectional Attention
confidence 95% · SenseShift leverages bidirectional attention
SenseShift → employsmethod → Iterative Mask Infilling
confidence 95% · SenseShift leverages... iterative mask infilling
SenseShift → evaluatedon → TinyStories
confidence 95% · Through training and evaluation on review and story-writing datasets... TinyStories
SenseShift → evaluatedon → Yelp Reviews
confidence 95% · Through training and evaluation on review and story-writing datasets... Yelp Reviews
SenseShift → uses → ModernBert
confidence 95% · We instantiate SenseShift on ModernBert Warner et al. (2025) base and large
SenseShift → uses → VADER
confidence 90% · We automatically derive sentiment scores using VADER Hutto and Gilbert (2014)
SenseShift → usesmetric → Delta Sentiment
confidence 90% · Our metrics capture... Delta Sentiment (Δs). Measures the mean absolute error...
SenseShift → outperforms → GPT4o Mini
confidence 85% · SenseShift consistently outperforms decoder-based baselines including... GPT4o-Mini
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Recent controllable text generation (CTG) for sentiment control has largely focused on decoder-based large language models, making causal attention the dominant paradigm. While effective for fluent generation, these models still struggle to satisfy complex constraints and follow fine-grained sentiment signals specified by users. Existing sentiment-aware CTG methods typically simplify the problem by treating sentiment either as a coarse categorical label (e.g., positive or negative) or as a single fine-grained control signal applied to an entire document. Consequently, more challenging settings such as sentence-level sentiment control within long-form text remain underexplored. To address these limitations, we introduce SenseShift , an encoder-based framework for fine-grained sentence-level CTG. Unlike standard decoder architectures, SenseShift leverages bidirectional attention, quantized sentiment signals, and iterative mask infilling to generate local sentences conditioned on target sentiment intensity. Empirical evaluations on story and review generation demonstrate that SenseShift achieves stronger sentiment controllability while maintaining text quality and robustness to out-of-domain generation compared to larger decoder-based baselines.
Tags
Links
- Source: https://arxiv.org/abs/2608.24304v1
- Canonical: https://arxiv.org/abs/2608.24304v1
Trouble viewing inline? Open PDF directly →
Full Text
76,828 characters extracted from source content.
Expand or collapse full text
SenseShift: Continuous Sentiment-Controlled Text Generation via Encoder-based Mask Infilling Shahed Masoudian Affiliation: Johannes Kepler University Linz Markus Frohmann Affiliation: Thomson Reuters Labs Affiliation: University of Toronto, Vector Institute Correspondence:shahed.masoudian@jku.at Emmanouil Karystinaios Affiliation: Johannes Kepler University Linz Navid Rekabsaz Affiliation: Thomson Reuters Labs Markus Schedl Affiliation: Johannes Kepler University Linz Abstract Recent controllable text generation (CTG) for sentiment control has largely focused on decoder-based large language models, making causal attention the dominant paradigm. While effective for fluent generation, these models still struggle to satisfy complex constraints and follow fine-grained sentiment signals specified by users. Existing sentiment-aware CTG methods typically simplify the problem by treating sentiment either as a coarse categorical label (e.g., positive or negative) or as a single fine-grained control signal applied to an entire document. Consequently, more challenging settings such as sentence-level sentiment control within long-form text remain underexplored. To address these limitations, we introduce SenseShift, an encoder-based framework for fine-grained sentence-level CTG. Unlike standard decoder architectures, SenseShift leverages bidirectional attention, quantized sentiment signals, and iterative mask infilling to generate local sentences conditioned on target sentiment intensity. Empirical evaluations on story and review generation demonstrate that SenseShift achieves stronger sentiment controllability while maintaining text quality and robustness to out-of-domain generation compared to larger decoder-based baselines. 11 1 The source code for experimental setup and training is available at https://github.com/ShawMask/SenseShift, and the model checkpoints for inference can be found at https://huggingface.co/shawhed/SenseShift-large. 1 Introduction Controllable Text Generation (CTG) aims to steer generated text toward desired attributes specified using external conditions Zhang et al. (2023). In sentiment-aware CTG, the goal is to regulate the emotional tone of text based on users desire Lorandi and Belz (2023). Prior works investigated categorical sentiment control for desired segments Yuan et al. (2022); Liang et al. (2024) and fine-grained sentiment control of full-document Luo et al. (2019b); Tang and Wu (2021). These works predominately rely on decoder LLMs Yang et al. (2024), making causal attention a default paradigm for sentiment-aware CTG. We argue that this choice of architecture is not best fit for scenarios where users wish to rewrite sentences of a document with a desired fine-grained sentiment value, an area still underexplored. Recent studies show that decoder-only architectures are fundamentally constrained by their unidirectional information flow Kopiczko et al. (2025). Moreover, CTG via prompting requires precise task definition which often result in unstable or weakly controlled outputs, especially under ambiguous or subtle sentiment targets Labroo et al. (2026); Laban et al. (2025); Zhao et al. (2021). In particular, controlling sentiment intensity even as categorical attribute (e.g., happy vs very happy) remains challenging for prompting-based approaches. We provide empirical evidence for this limitation in our task setting in Appendix A.1. Figure 1: SenseShift VS decoder-based prompting for sentiment CTG. Based on a given text, target sentence and sentiment, SenseShift places sentiment tokens before each sentence. encoder-architecture allows SenseShift to predict masked tokens attending to each target sentiment while distinguishing prior context from posterior. To address these limitations, we introduce SenseShift, a novel encoder framework for fine-grained sentiment-aware in-text generation. Unlike decoder-based approaches that rely on causal attention and generate strictly left-to-right, SenseShift leverages bidirectional attention together with iterative mask infilling. This enables in-text generation conditioned jointly on prior and posterior context, so that generated sentences integrate more naturally with the surrounding text. SenseShift consists of three stages: automatic sentiment signal construction and quantization, control-aware MLM fine-tuning, and iterative mask infilling at inference. Together, these enable fine-grained manipulation of sentiment in arbitrary sentences within a long text. Figure 1 illustrates how SenseShift generation differs from decoder prompting.22 2 Qualitative examples of text modified with SenseShift can be found in Figures 6 and 7. We instantiate SenseShift on ModernBert Warner et al. (2025) base and large substantially smaller than the decoder baselines. Through training and evaluation on review and story-writing datasets we demonstrate empirically that SenseShift consistently outperforms decoder-based baselines including prompting, activation steering, and instruction tuned models many times its size on sentiment control while maintaining fluency and contextual fit. Human evaluation confirms this: annotators judge SenseShift outputs slightly more fit to context compared to a larger decoder baseline model while also preferring SenseShift for sentiment alignment. Together, these findings suggest that encoder-based generation is an effective and competitive alternative to autoregressive decoding for fine-grained sentiment-aware in-text generation. 2 Related Work Early approaches to sentiment and style control used latent-variable or recurrent formulations to inject attribute information during generation Hu et al. (2017); Peng et al. (2018). These works assume that sentiment is a categorical label and steer generation toward those classes, for tasks such as poetry generation Shao et al. (2021), multi-aspect control over sentiment and topic Ding et al. (2023), reinforcement-style unlearning Lu et al. (2022), and contrastive prefix methods Qian et al. (2022); Zheng et al. (2023). Decoding-time steering methods Pascual et al. (2021); Krause et al. (2021); Liu et al. (2021); Yang and Klein (2021) and supervised fine-tuning approaches Yang et al. (2024); Żal et al. (2024) share the same coarse-grained, document-level limitation. Across all these lines, sentiment is treated as a polarity signal and control operates over full sequences. A smaller body of work has explored fine-grained control signals, including early work on controlling gender information within encoders for fairness Masoudian et al. (2024) using gated adapters. Subsequent works in decoder-based generation focuse on fine-grained sentiment transfer via Gaussian kernel conditioning on standalone sentences Luo et al. (2019b), scorer-based unsupervised control Jain et al. (2019), emotional control in story generation via decoder-side guidance Wang et al. (2022), and continuous interpolation mechanisms Kangaslahti and Alvarez-Melis (2024); Samuel et al. (2025). These methods target sentiment granularity but operate at the document level (i.e., ignoring sentiment dynamics). The works structurally most similar to ours introduce positional awareness into CTG. Story-ending control uses fine-grained sentiment and Gaussian kernel conditioning to guide only the concluding segment of stories Luo et al. (2019a). Other methods use conditional variational auto-encoder, aspect-level disentanglement, hierarchical templates, and dynamic attribute graphs to control sentiment of parts of a text Qiao et al. (2020); Yuan et al. (2022); Nawezi et al. (2023); Liang et al. (2024). These works demonstrate the value of structural awareness but use categorical sentiment and do not move beyond decoder-based architecture. From an architectural perspective, SenseShift is most closely related to the text infilling paradigm Donahue et al. (2020). Unlike their work, which fine-tunes a decoder model on masked text without attribute signal, SenseShift leverages the encoder that attends jointly to both surrounding context and a quantized sentiment intensity signal before generating the target sentence. 3 Methodology We aim to have sentence-level and fine-grained control over the sentiment of generated text which is particularly suitable for encoders. Their bidirectional attention and masked token prediction allow them to generate within a long context, a special feature that autoregressive decoders do not inherently have Kopiczko et al. (2025). SenseShift achieves this goal using the following steps: 3.1 Automatic Sentiment Signal Construction and Quantization First key obstacle for fine-grained sentiment control is the lack of high-quality labeled sentence-level sentiment in long-form corpora, which can be used to train the models. We automatically derive sentiment scores using VADER Hutto and Gilbert (2014) as done in prior works Konen et al. (2024) with one major difference: We extract the sentiment scores per sentence. We chose VADER over more accurate but slower alternatives such as RoBERTa Barbieri et al. (2020) because it is fast, deterministic, and derived from human annotation, making it practical for large-scale pre-processing and online inference without adding additional complexity, parameters, and latency. Given a document D segmented into m sentences =s1,s2,…,smD=\s_1,s_2,…,s_m\, we compute for each sentence sis_i the sentiment score vi∈[−1,1]v_i∈[-1,1]. Scores are then quantized to a discrete control grid with step size δ=0.1:σsi=round(viδ)⋅δ=0.1: _s_i=round\! ( v_iδ )·δ Each quantized value is mapped to a unique sentiment token [σsi][ _s_i] and placed at the beginning of its respective sentence. This converts unlabeled document into sentence-level controllable training data, providing the model with local sentiment intensity signals rather than a single document-level sentiment. 3.2 Control-Aware MLM Fine-Tuning Training SenseShift is standard Mask Language Modeling (MLM) under two control-aware modifications. First, sentiment tokens [σsi][ _s_i] are never masked and remain visible throughout training as persistent conditioning anchors.33 3 Initial experiments revealed that when sentiment tokens are trainable, overall performance degrades, as the model tends to reproduce them rather than using them as generation constraints. Second, we increase the masking ratio to 40%40\%, to encourage stronger dependence on both surrounding context and sentiment anchors when reconstructing masked content rather than relying on local co-occurrence patterns. 3.3 Iterative Mask Infilling Predicting all masked tokens in parallel often results in repetitive and incoherent generations, since top token probabilities are predicted independently without sequence-level awareness (see Appendix A.3). To address this, we mimic iterative generation and beam search generation of decoders and implement a simplified iterative mask infilling approach Wu et al. (2016); Vijayakumar et al. (2016) inspired by prior works. During generation, the original sentiment token of a target sentence [σsi][ _s_i] is replaced with a user-defined target sentiment [σsi′][σ _s_i]. The target sentence sis_i is fully corrupted with [MASK][MASK] token, producing a masked input Xmasked′X _masked. Starting from the first masked position after the sentiment token, SenseShift predicts one token at a time. At each step t, the model computes a probability distribution over the vocabulary given the current context ZtZ_t, which includes the surrounding document, previously predicted tokens, and the target sentiment signal: P(⋅∣Zt)=Softmax(fθ(Zt)τ)P(· Z_t)=Softmax ( f_θ(Z_t)τ ) where fθ(Zt)f_θ(Z_t) is the model’s logit vector and τ is a temperature parameter controlling output sharpness. Beam Search and Scoring. To explore the high-probability candidate space, we maintain B active beams from the top-k tokens. Candidates are evaluated using a length-normalized log-probability score to prevent bias toward shorter completions: S=1LP(n)∑t=1nlogP(wt∣Zt)S= 1LP(n) _t=1^n P(w_t Z_t) where LP(n)=(5+n)α(5+1)αLP(n)= (5+n)^α(5+1)^α. Here n is the number of predicted tokens, α is the length penalty hyperparameter, and 5 is a smoothing constant following Wu et al. (2016). To prevent beams from collapsing into repetitive outputs, we apply a diversity penalty γ that discourages multiple beams from selecting the same token. Formally, when scoring token w for beam b, we count how many higher-ranked beams b′<b <b have already selected w at the current step and penalize accordingly: Sfinal=S−γ⋅∑b′<b[wb′=w]S_final=S-γ· _b <b1[w_b =w] . A beam is marked complete when the predicted token belongs to the terminal punctuation set,44 4 Punctuation tokes are . , ; , ! , ?. at which point any remaining [MASK][MASK] tokens in that beam are replaced with [PAD][PAD] tokens. Generation is also capped at a maximum of 30 tokens to prevent degenerate outputs.55 5 This threshold can alternatively be set to the original sentence length to enforce length-matched generation. The resulting sentence si′s _i is conditioned on the surrounding bidirectional context ∖siD \s_i\, the neighboring sentiment signals, and the target constraint σsi′σ _s_i. 4 Experimental Setup We deployed SenseShift on ModernBert Warner et al. (2025) in two sizes namely ModernBert-E-0.15b (base, 149M parameters and ModernBert-E-0.4b (large, 395M parameters), a pre-trained bidirectional encoder we preferred over predecessors such as BERT Devlin et al. (2019) and RoBERTa Liu et al. (2019) due to its significantly higher contextual length and modernized training recipe. Regardless, SenseShift framework is considered independent of model and can be deployed on any other encoder model with Masked Language Modeling. For evaluation we compared SenseShift across three baseline categories: prompting, activation steering, and fine-tuning methods, all of which we introduce in detail in the following. To assess our method, we train and evaluate on two distinct datasets, measuring both in-domain performance and out-of-domain (OOD) performance. The latter specifically checks for robustness and is relevant for prompting, which by nature operates domain-agnostic. Our dataset selection ensures that both text structure and sentiment dynamics vary throughout the text. TinyStories Eldan and Li (2023) is a corpus of ∼ 4.5M short stories generated by GPT-3.5/4.0. The stories are two to three paragraph while including various arcs (e.g., bad ending, inclusion of a twist, dialogues) resulting in sentiment changes. Yelp Reviews Zhang et al. (2015) ∼ 300K samples of human-written reviews spanning multiple service domains with user ratings. We discard user ratings and capture sentence-level sentiments (e.g., praising food quality while criticizing service) using the approach described in Section 3.1. We remove formatting artifacts, discard single-sentence documents, and exclude texts exceeding 500 words, allowing high-quality, structurally complete data. From each dataset, 2000 samples are held out as test sets, unseen during training/validation. SenseShift is trained/validated independently on each dataset but tested on both. Training hyperparameters, sentiment distribution and datasets statistics, are reported in Appendix A.2.3. 4.1 Baselines We compare SenseShift against four controllable generation paradigms, covering the main families of LLM-based sentiment control. Baselines include open-weight models: ModernBert-D-28m (28M)66 6 A small version of ModernBert architecture trained from scratch for next token prediction with causal attention., LLaMA Instruct (3.2-3B, 3.1-8B), Gemma2 Instruct (2B, 9B), Qwen 3 Reasoning (32B), and OSS model (20B, 120B), as well as a closed-source GPT4o-Mini. Due to GPU memory constraints models up to 3 billion parameters were trained for all controlling methods while larger models are only controlled using zero-shot prompting. Details of prompts and instructions can be found in Section A.2.1. The sentiment controlling methods are as follow: Prompting. We asked models to replace a randomly selected sentence with one sentence matching a numerically specified target sentiment. Instruction Tuning. Fine-tunes decoder models specifically for sentence generation given a target sentiment score. Models are trained to replace a [Missing-Sentence] with a substitute. Token Instruction Tuning. Extends instruction tuning with the quantized sentiment tokens from SenseShift (Section 3), conditioning generation on the target sentiment at inference. This decoder baseline shares SenseShift’s sentiment representation, isolating the effect of bidirectional infilling. Activation Steering. Identifies and steers the activation vectors of models without training, following Rimsky et al. (2024). During decoding, internal activations are steered along a sentiment axis learned from contrastive sentence pairs, to control generated output without fine-tuning. Full implementation details are provided in Appendix A.2.2. 4.2 Evaluation Metrics We utilize standardized evaluation protocol applied identically to all baselines and SenseShift. For each document, we randomly select a sentence and assign it a random target sentiment. Models then generate the sentence conditioned on the target. All generated outputs are scored using VADER, the same sentiment analyzer used for training of all baselines, ensuring a consistent and unbiased comparison across baselines (except for zero-shot prompting). Our metrics capture two key aspects: (1) adherence to the target sentiment signal, and (2) fluency and fitness of the generated sentence with its surrounding context. Delta Sentiment (Δs _s). Measures the mean absolute error between the target sentiment and the generated sentence sentiment. For a sentence sis_i from document j, this is defined as Δsi=|σ^si−σsi′| _s_i=| σ_s_i-σ _s_i| where σ^si σ_s_i is the new sentiment of the generated sentence and σsi′σ _s_i is the target sentiment. Sentiment Accuracy (Acc.Acc.). We evaluate sentiment accuracy based on standard positive, neutral, and negative categories. We define neutral band as [−0.2,0.2][-0.2,0.2] (wider compared to VADER threshold of ±0.05± 0.05 Hutto and Gilbert (2014)) to avoid considering near-neutral intensity targets as failed control, and uniformly across all baselines and original sentences. Scores higher and lower than this range are labeled positive or negative respectively. Correlation (Corr.Corr.). measures the Pearson correlation between target sentiment σsi′σ _s_i and generated sentence sentiment σ^si σ_s_i. A value of 1.0 indicates perfect linear adherence to the control signal, while 0.0 indicates complete failure in sentiment steering. Perplexity (PPL.PPL.). is computed at the sentence level using GPT-2 and serves as a standard proxy for fluency and coherence. It measures the predictability of generated tokens but does not capture alignment with the surrounding document context, motivating the following metric. Fitness (Δf _f). Standard n-gram metrics such as BLEU or ROUGE are not the best choice to measure contextual fitness because the generated sentence may intentionally diverge from the original sentence through sentiment manipulation. Hence, we propose a composite metric combining semantic similarity and entity-level overlap. For a generated sentence si′s _i at position i, we compute cosine similarity scores using Sentence-BERT embeddings Reimers and Gurevych (2019)77 7 Specifically all-mpnet-base-v2. for the preceding context s<is_<i and following context s>is_>i separately. Boundary sentences only have single similarity: CS<iCS_<i alone for the final sentence and CS>iCS_>i alone for the first sentence. We complement the similarity score with an entity overlap score that checks whether named entities in the generated sentence are grounded in the surrounding document. Formally we write: ECi=|Entities(si′)∩Entities(∖si)||Entities(si′)|EC_i= |Entities(s _i) (D \s_i\)||Entities(s _i)| and when si′s _i contains no named entities, we set ECi=1EC_i=1, since the absence of entities introduces no grounding violation. The fitness score for a non-boundary sentence combines the two similarity scores with the entity overlap score, weighting the latter by 2 so that entity grounding contributes on par with the aggregate similarity signal: Ci=CS<i+CS>i+2⋅ECi4C_i= CS_<i+CS_>i+2· EC_i4 Entity overlap flags fabricated entities but does not verify that entities are used in contextually appropriate relations, which we leave to the similarity terms. For every document we compute the fitness score for the generated and original sentence, and report the calibrated fitness score as: Δfi=C(si′)−C(si) _f_i=C(s _i)-C(s_i) A value of zero indicates no relative change in contextual fit, while a positive value indicates improved fitness, and a negative value indicates degradation. We assess whether Δfi _f_i significantly diverges from zero using a two-sided t-test, with results reported in Section 5. Human Evaluation. We complement automatic evaluation with a user preference study comparing SenseShift against the closest competitive baseline, namely Gemma2-2b trained with token instruction tuning. Eight annotators evaluated 100 parallel documents (55 stories and 45 reviews) generated by both models using the same target sentence and sentiment intensity. They selected their preferred anonymized output based on three quality criteria: contextual fit (fitness with the surrounding text), grammatical fluency (sentence fluency independent of context), and sentiment following (alignment with the target sentiment value on a −1-1 to +1+1 scale). For each criterion, annotators chose among four options namely A, B, Both, or Neither without knowing which model produced each sentence. We report the preference percentages in Section 5, with full details provided in Appendix A.4. Table 1: Overall comparison between baselines and SenseShift. Significantly different changes (p-value<0.01) compared to the 0 baseline are marked with an asterisk. Note that columns under green are same models trained on story and columns under red are same models trained on review. in table PPLoldPPL_old refers to perplexity of the original sentence calculated using GPT-2 and PPLnewPPL_new refers to generated sentence perplexity Model Story Evaluation Review Evaluation PPLold PPLnew↓_new Δs _s ↓ Δf _f ↑ Corr. ↑ Acc. ↑ PPLold PPLnew↓_new Δs _s ↓ Δf _f ↑ Corr. ↑ Acc. ↑ Prompting ModernBert-D-28m 80.6 255.5 0.56 -0.29* 0.07 0.36 222.3 161.2 0.69 -0.13* -0.19 0.23 Llamma3.2-3b 81.1 118.1 0.50 -0.05* 0.25 0.41 239.4 113.1 0.51 -0.00 0.21 0.38 Gemma2-2b 88.6 139.2 0.56 -0.00 0.15 0.37 245.1 117.3 0.55 0.02* 0.14 0.37 Gemma2-9b 83.6 126.2 0.39 -0.03* 0.65 0.55 268.3 97.8 0.44 0.00 0.53 0.50 Llamma3.1-8b 73.4 92.7 0.48 -0.05* 0.34 0.44 236.2 81.7 0.49 -0.00 0.27 0.41 GPT4o-mini 82.6 82.6 0.44 -0.00 0.53 0.54 253.8 159.7 0.42 -0.00 0.48 0.49 OSS-20b 74.2 97.5 0.31 -0.04* 0.75 0.64 236.2 107.1 0.34 -0.00 0.68 0.59 Qwen3-32b 73.1 81.6 0.32 -0.08* 0.76 0.65 229.3 92.1 0.35 -0.01 0.66 0.58 OSS-120b 72.1 110.2 0.30 -0.03* 0.793 0.66 236.0 143.4 0.31 -0.00 0.74 0.64 In-Domain Evaluation Story Trained Review Trained Instruction Tune ModernBert-D-28m 82.2 402.7 .43 -0.04* 0.43 .49 285.7 140.7 0.35 -0.02 0.62 0.59 Llamma3.2-3b 80.7 75.4 0.50 -0.03* 0.23 0.44 219.5 81.6 0.45 0.04* 0.41 0.50 Gemma2-2b 77.9 75.5 0.43 -0.03* 0.44 0.49 276.1 88.5 0.43 -0.01 0.45 0.53 Token Instruction Tune ModernBert-D-28m 79.1 318.0 0.35 -0.17* 0.57 0.54 266.3 207.8 0.43 -0.07* 0.42 0.41 Llamma3.2-3b 80.3 77.6 0.28 -0.00 0.71 0.66 217.8 87.2 0.32 0.04* 0.64 0.62 Gemma2-2b 77.9 72.1 0.21 -0.03* 0.74 0.75 285.5 108.4 0.30 -0.01 0.64 0.67 Steering ModernBert-D-28m 82.6 108.2 0.55 -0.30* 0.04 0.31 241.8 186.2 0.54 -0.00* 0.095 0.34 Llamma3.2-3b 78.3 221.3 0.54 -0.10* 0.08 0.32 255.1 186.2 0.54 -0.00* 0.095 0.34 Gemma2-2b 85.3 135.0 0.56 -0.01 0.18 0.39 229.6 124.0 0.54 0.03* 0.17 0.36 SenseShift ModernBert-E-0.15b 78.3 91.6 0.26 -0.00 0.77 0.69 260.3 55.3 0.29 0.06* 0.71 0.66 ModernBert-E-0.4b 81.7 53.6 0.20 -0.00 0.790 0.78 261.5 57.5 0.26 0.04* 0.71 0.69 Out of Domain Evaluation Review Trained Story Trained Instruction Tune ModernBert-D-28m 81.0 366.0 0.35 -0.24* 0.61 0.57 251.5 614.1 0.49 -0.03* 0.30 0.42 Llamma3.2-3b 81.2 86.6 0.48 -0.04* 0.35 0.46 281.5 80.2 0.49 0.07* 0.27 0.43 Gemma2-2b 80.0 113.2 0.42 -0.06* 0.45 0.49 269.5 75.5 0.43 -0.03* 0.44 0.49 Token Instruction Tune ModernBert-D-28m 88.0 186.1 0.39 -0.27* 0.52 0.49 277.8 667.6 0.39 -0.08* 0.52 0.49 Llamma3.2-3b 78.1 82.8 0.40 -0.06* 0.50 0.51 276.6 62.8 0.31 0.08* 0.66 0.64 Gemma2-2b 76.3 89.8 0.34 -0.08* 0.59 0.60 229.3 64.9 0.23 0.01 0.73 0.73 Steering ModernBert-D-28m 83.4 133.3 0.56 -0.30* -0.00 0.30 237.4 127.7 0.55 -0.15 0.01 0.28 Llamma3.2-3b 84.2 153.1 0.53 -0.09* 0.12 0.34 235.1 183.6 0.53 -0.00 0.125 0.36 Gemma2-2b 82.1 138.9 0.55 -0.01 0.17 0.39 261.9 125.0 0.56 0.03* 0.12 0.35 SenseShift ModernBert-E-0.15b 87.1 65.6 0.38 -0.00 0.58 0.57 293.6 63.1 0.28 0.07* 0.73 0.69 ModernBert-E-0.4b 77.2 83.0 0.34 -0.00 0.62 0.61 260.3 31.4 0.15 0.07* 0.85 0.85 5 Results and Discussion Figure 2: Δs _s across three evaluation dimensions. Shaded regions indicate variance. Left: Δs _s vs. target sentiment. Center: Δs _s vs. relative sentence position. Right: Δs _s vs. number of masked tokens. Table 1 reports results on the story and review datasets. The top block include prompting baselines that require no training and are domain agnostic. In the table, columns PPLoldPPL_old and PPLnewPPL_new demonstrate the perplexity of the sentences before and after the generation respectively. Note that sentences are selected randomly from the same pool of 2000 evaluation samples hence the selected sentencce perplexity value has variation. More over in general the original PPLoldPPL_old of the review dataset is high due to unconventional human review writing style (e.g., best best best food that i had) which shows reveals itself in old sentence perplexity value. The old perplexity of sentences is used as a reference point to give some idea about the distribution of sentence perplexity randomly selected for evaluation and how models new generation perplexity compares with the old sentences. The In-Domain Evaluation block reports models trained and evaluated on the same dataset, while the Out-of-Domain Evaluation block reports models trained on one dataset and evaluated on the other. Note that we use green and red color code to distinguish models trained on story from review. For instance models trained on story are evaluated on story as in-domain while same models evaluated on review as OOD evaluation. The OOD block is provided to allow a fairer comparison with domain agnostic prompting and should be read as robustness check not generalization claim. Among prompting baselines, sentiment following improves with scale: Gemma2-9b already has decent sentiment accuracy of 0.55 and OSS-120b achieves the highest correlation (0.793 on story, 0.74 on review) and accuracy (0.66, 0.64), though at a very high computational cost. Its elevated perplexity relative to OSS-20b is likely attributable to more complex vocabulary penalized by the GPT-2 scorer. Across prompting baselines, Δf _f on story are often significantly negative, indicating that prompted sentence generations are typically less contextually well-fitted than the original sentence even-though models have access to the original sentence during prompting unlike other baselines. Standard instruction tuning improves Δs _s, Corr. and Acc. over the corresponding prompting baselines, but gains are uneven. ModernBert-D-28m is the most unstable, with perplexity spiking above 400 and better but significant Δf _f drops, likely reflecting the small size of the model. Token instruction tuning improves even more: Gemma2-2b during In-domain evaluation improves accuracy from 0.49 to 0.75 on stories and 0.49 to 0.67 for reviews as with Δs _s of 0.21 by injecting SenseShift sentence-level controllable sentiment tokens. However, most decoder models under this paradigm when evaluated as out-of-domain show significant Δf _f drops (except for Llamma3.2-3b trained on story evaluated on review), suggesting that their generation, while grammatically acceptable, often break contextual fitness. Steering underperforms across all model sizes, with Δs≈0.53 _s≈ 0.53–0.560.56, near-zero or negative correlations, accuracy in the 0.28–0.39 range, and perplexity up to 221, frequently worse than the corresponding prompting baseline even when steering vectors are extracted from the same dataset. With steering only Gemma2-2b shows a marginal improvement, hinting that activation steering might be poorly suited for fine-grained sentiment control at sentence level. Overall SenseShift achieves the strongest overall performance. ModernBert-E-0.4b achieves the lowest perplexity (53.6 on Story, with ModernBert-E-0.15b at 55.3 on Review) during in-domain evaluation, the smallest sentiment deviation (Δs _s of 0.20 on Story), and the highest in-domain accuracy on Story (0.78). Crucially, ModernBert-E-0.4b maintains Δf _f at or near zero across both domains advocating contextual fitness of the generated sentences. ModernBert-E-0.15b already delivers strong results relative to all baselines, indicating that SenseShift scales favorably with model capacity. In the out-of-domain setting, SenseShift remains competitive with, and on most metrics outperforms, the baselines trained on the matching domain. More importantly, SenseShift is the only method to maintain near-zero Δf _f in both the in-domain and out-of-domain blocks, suggesting that encoder conditioning preserves contextual fit while controlling sentiment intensity robust to change of training source. Sentiment Following Analysis. Next we analyze sentiment following capabilities of competing baselines by examining how Δs _s is influenced by: (1) target sentiment specified by the user, (2) relative sentence position (sentence indextotal number of sentences) ( sentence indextotal number of sentences ), and (3) generation length as words: short (<5<5), normal (5≤l<105≤ l<10), long (10≤l<2010≤ l<20), and very-long (≥20≥ 20). We compare ModernBert-E-0.4b with competitive baselines namely prompting OSS-120b and token instruction tuning of Llamma3.2-3b, and Gemma2-2b. Figure 2 visualizes these analysis. On left, all models demonstrate higher Δs _s when targeting strongly negative sentiment values, whereas performance improves then slightly deteriorates toward highly positive targets. Exceptionally, OSS-120b demonstrates a monotonic improvement as the target sentiment becomes more positive while performing slightly better than ModernBert-E-0.4b at extreme sentiments. Llamma3.2-3b, Gemma2-2b and ModernBert-E-0.4b all exhibit their lowest Δs _s around neutral zone, showing difficulty in producing highly polarized outputs despite strong overall controllability. We attribute this behavior to sentiment distribution of the training corpus for trained models. The story dataset sentence sentiments are heavily skewed toward neutral and positive sentiment, which likely biases models toward conservative sentiment shifts (see Table 3). With respect to sentence position, all decoder models exhibit a mild increase in Δs _s when the target sentence occurs later in the story. This suggests that models benefit less from richer preceding context when performing sentiment-controlled generation. This behavior is particularly different for ModernBert-E-0.4b, which maintain the least Δs _s, however exhibits higher Δs _s on earlier sentences but improves steadily toward later positions. We hypothesize that encoder-based architectures rely more heavily on contextual buildup, making early-sentence editing inherently more challenging due to limited narrative grounding. Finally, we analyze the effect of generation length. Llamma3.2-3b and OSS-120b show increased Δs _s as generation length grows, while ModernBert-E-0.4b overall has the least Δs _s and again demonstrates a different trend: Δs _s decreases for normal and long generations before slightly increasing again. Gemma2-2b also shows improved control for normal length generations before degrading on longer sentences.88 8 Joint analysis of SenseShift is provided in Section A.5. In summary, our analysis suggests that SenseShift maintains a robust Δs _s advantage over baselines independent of target sentiment, sentence position, and generation length, indicating that the gap reflects a genuine difficulty in maintaining sentiment coherence rather than an artifact of any single evaluation condition. Table 2: Users preference (%\%) of sentences generated by ModernBert-E-0.4b-story vs Gemma2-2b trained with Token-Instruction-Tuning. Rows correspond to evaluation criteria: contextual fitness, grammatical correctness, and sentiment following. Criterion Gemma2-2b SenseShift Both Neither Fitness 22.1 23.0 46.9 8.0 Fluency 6.2 6.2 85.0 2.7 Sentiment 28.3 31.0 28.3 12.4 Overall 18.9 20.1 53.4 7.7 Human Evaluation. Table 2 summarizes human preference results across three criteria: contextual fit, grammatical fluency, and sentiment following. Notably, ModernBert-E-0.4b achieves these results with only 395M parameters, compared to Gemma2-2b (2B parameters) a 5× reduction in parameters (described in Section4.2). On fluency and contextual fit, both models perform comparably. Annotators rated the outputs as equally fluent in 85.0% of samples and equally well-fitting to the surrounding context in 46.9% of cases, indicating that sentiment control does not substantially degrade linguistic quality. Among the remaining contextual-fit judgments, ModernBert-E-0.4b is preferred at a slightly higher rate to Gemma2-2b (23.0% vs. 22.1%), showing that the smaller encoder-based model matches a substantially larger generative model on contextual integration. Differences are more pronounced for sentiment following. Annotators judged ModernBert-E-0.4b sentiment satisfactory in 31.0% of examples versus 28.3% for Gemma2-2b, selected both models in 28.3%, and preferred neither model in 12.4% of cases. This indicates that ModernBert-E-0.4b achieves stronger sentiment alignment while preserving contextual coherence. Overall, annotators rated ModernBert-E-0.4b as equivalent to or better than Gemma2-2b in 73.5% of evaluated samples. Achieving this with a fraction of the parameters suggests that encoder-centric approaches are a strong and competitive alternative for fine-grained sentiment-aware controllable text generation, particularly in settings requiring simultaneous preservation of context and precise sentiment manipulation. 6 Conclusion This paper introduced SenseShift, a lightweight generative framework base on encoder language models for fine-grained sentiment-aware in-text generation. SenseShift utilizes quantized sentence level sentiment token, to condition mask prediction of encoder models. Using our modfied sequential mask prediction strategy SenseShift is able to produce coherent text following the fine-grained sentiment signal. Through extensive in-domain and out-of-domain evaluation on story and review generation of two encoder models in two sizes we demonstrate that SenseShift can generate sentences at various positions using fine-grained sentiment control signals, while preserving overall fluency, contextual fitness, and sentiment adherency compare to fine-tuned and prompting autoregressive models. Furthermore, our results indicate that ModernBert-E-0.4b performs robust in out-of-domain scenarios, allowing stable performance for in-text generation task. 7 Limitations and Ethical Consideration Sentiment Analysis. Our framework relies on VADER Hutto and Gilbert (2014) for all sentiment scoring, both during training signal construction and at inference time, where sentiment must be evaluated repeatedly over the full text to guide and assess each rewrite. This design choice priorities speed: More accurate neural sentiment models (e.g., RoBERTa Barbieri et al. (2020)) would substantially increase latency per generation, damaging a main contribution of the work, i.e., providing lightweight framework. VADER’s deterministic nature, however, limits sensitivity to implicit or contextually nuanced sentiment, and reported Δs _s values should be interpreted with this constraint in mind. Access to human level sentence sentiment or replacing VADER with a lightweight but more accurate sentiment scorer is a promising direction for future work. Furthermore, sentiment is an inherently subjective construct: human annotators frequently disagree on the polarity and intensity of the same sentence, which places an upper bound on how precisely any model including SenseShift can be evaluated against a "true" sentiment label. Training Corpora and Sentiment Distribution. Our models are trained on TinyStories and a review corpus, both of which are narrow in domain. The choice of dataset stems from the task which supposedly requires changing dynamics of the sentiment (partly negative, partly positive) which can be found in long text generation. These constraints prevent us from making strong claims about true generalization to unseen domains such as news, social media, or formal writing. A further challenge is the sentiment distribution of both corpora: Extreme sentiment values appear very infrequently, meaning the model sees comparatively few training examples of strongly positive or strongly negative targets, with negative ones being significantly less observed. This imbalance makes fine-grained control at the tails of the sentiment range harder, and likely contributes to the elevated Δs _s we observe at s=−1.0s=-1.0. We expect that curating higher-quality, sentiment-balanced training data, particularly with more uniform coverage of extreme values would meaningfully improve performance, and we leave this exploration to future work. During editing we observed that the errors of the model with respect to target sentiment also is effected by the sentiment of the sentences surrounding it where the more positive the context surrounding , the more edits models required to change the sentiment to opposite polarity. Due to the constrained scope we did not delve into this effect and leave this analysis to future works. Baseline Selection and Compute Constraints. Baselines were selected to enable quantifiable, reproducible comparison across prompting, instruction tuning, and activation steering paradigms with a special version of instruction tuning with our sentence level quantized tokenization of sentiment. The choice of baselines was based on compatibility with our method, and comparison between decoder and encoder model architectures. The specific models chosen reflect resource constraints: All experiments were conducted under a fixed compute budget, which precluded evaluation of the largest available open-weight models. Results for prompting-based baselines should therefore be read as representative rather than exhaustive, and stronger frontier models may narrow the observed performance gap. Our model is designed to edit text toward an arbitrary target sentiment intensity, including strongly negative values. This capability carries clear misuse potential. Because edits are designed to be fluent and contextually coherent, modified outputs may be difficult to distinguish from originals without provenance tracking. We strongly recommend that any deployment of sentiment controllable systems be accompanied by appropriate safeguards, including use-case restrictions, output disclosure to end users, and, where feasible, watermarking or audit logging. Responsible use of this technology is the obligation of both developers and practitioners who build upon it. References Barbieri et al. (2020) F. Barbieri, J. Camacho-Collados, L. Espinosa Anke, and L. Neves TweetEval: unified benchmark and comparative evaluation for tweet classification. In Findings of the Association for Computational Linguistics: EMNLP 2020, Online, p. 1644–1650. External Links: Link, Document Cited by: §3.1, §7. Chen et al. (2025) J. Chen, S. Karimi, D. Molla, and C. Paris To labor is not to suffer: exploration of polarity association bias in LLMs for sentiment analysis. In Proceedings of the 14th International Joint Conference on Natural Language Processing and the 4th Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics, K. Inui, S. Sakti, H. Wang, D. F. Wong, P. Bhattacharyya, B. Banerjee, A. Ekbal, T. Chakraborty, and D. P. Singh (Eds.), Mumbai, India, p. 70–78. External Links: Link, ISBN 979-8-89176-299-2 Cited by: §A.1. Devlin et al. (2019) J. Devlin, M. Chang, K. Lee, and K. Toutanova BERT: pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), J. Burstein, C. Doran, and T. Solorio (Eds.), Minneapolis, Minnesota, p. 4171–4186. External Links: Link, Document Cited by: §4. Ding et al. (2023) H. Ding, L. Pang, Z. Wei, H. Shen, X. Cheng, and T. Chua MacLaSa: multi-aspect controllable text generation via efficient sampling from compact latent space. In Findings of the Association for Computational Linguistics: EMNLP 2023, H. Bouamor, J. Pino, and K. Bali (Eds.), Singapore, p. 4424–4436. External Links: Link, Document Cited by: §2. Donahue et al. (2020) C. Donahue, M. Lee, and P. Liang Enabling language models to fill in the blanks. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, D. Jurafsky, J. Chai, N. Schluter, and J. Tetreault (Eds.), Online, p. 2492–2501. External Links: Link, Document Cited by: §2. Eldan and Li (2023) R. Eldan and Y. Li TinyStories: how small can language models be and still speak coherent english?. arXiv preprint arXiv:2305.07759. External Links: Link Cited by: §4. Hu et al. (2017) Z. Hu, Z. Yang, X. Liang, R. Salakhutdinov, and E. P. Xing Toward controlled generation of text. In Proceedings of the 34th International Conference on Machine Learning - Volume 70, ICML’17, p. 1587–1596. Cited by: §2. Hutto and Gilbert (2014) C. Hutto and E. Gilbert VADER: a parsimonious rule-based model for sentiment analysis of social media text. Proceedings of the International AAAI Conference on Web and Social Media 8 (1), p. 216–225. External Links: Link, Document Cited by: §3.1, §4.2, §7. Jain et al. (2019) P. Jain, A. Mishra, A. P. Azad, and K. Sankaranarayanan Unsupervised Controllable Text Formalization. Proceedings of the AAAI Conference on Artificial Intelligence 33 (01), p. 6554–6561 (en). External Links: ISSN 2374-3468, 2159-5399, Link, Document Cited by: §2. Kangaslahti and Alvarez-Melis (2024) S. Kangaslahti and D. Alvarez-Melis Continuous Language Model Interpolation for Dynamic and Controllable Text Generation. arXiv. Note: arXiv:2404.07117 [cs]Comment: 20 pages, 22 figures External Links: Link, Document Cited by: §2. Konen et al. (2024) K. Konen, S. Jentzsch, D. Diallo, P. Schüt, O. Bensch, R. El Baff, D. Opitz, and T. Hecking Style Vectors for Steering Generative Large Language Models. In Findings of the Association for Computational Linguistics: EACL 2024, Y. Graham and M. Purver (Eds.), St. Julian’s, Malta, p. 782–802. External Links: Link Cited by: §3.1. Kopiczko et al. (2025) D. J. Kopiczko, T. Blankevoort, and Y. M. Asano Bitune: leveraging bidirectional attention to improve decoder-only LLMs. In Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, C. Christodoulopoulos, T. Chakraborty, C. Rose, and V. Peng (Eds.), Suzhou, China, p. 9510–9536. External Links: Link, Document, ISBN 979-8-89176-332-6 Cited by: §1, §3. Krause et al. (2021) B. Krause, A. D. Gotmare, B. McCann, N. S. Keskar, S. Joty, R. Socher, and N. F. Rajani GeDi: generative discriminator guided sequence generation. In Findings of the Association for Computational Linguistics: EMNLP 2021, M. Moens, X. Huang, L. Specia, and S. W. Yih (Eds.), Punta Cana, Dominican Republic, p. 4929–4952. External Links: Link, Document Cited by: §2. Laban et al. (2025) P. Laban, H. Hayashi, Y. Zhou, and J. Neville LLMs Get Lost In Multi-Turn Conversation. arXiv. Note: arXiv:2505.06120 [cs] External Links: Link, Document Cited by: §1. Labroo et al. (2026) A. Labroo, I. Sheth, V. Raina, A. Ahmed, and M. Fritz Funny or persuasive, but not both: evaluating fine-grained multi-concept control in LLMs. In Proceedings of the 19th Conference of the European Chapter of the Association for Computational Linguistics (Volume 2: Short Papers), V. Demberg, K. Inui, and L. Marquez (Eds.), Rabat, Morocco, p. 522–554. External Links: Link, Document, ISBN 979-8-89176-381-4 Cited by: §1. Liang et al. (2024) X. Liang, H. Wang, S. Song, M. Hu, X. Wang, Z. Li, F. Xiong, and B. Tang Controlled Text Generation for Large Language Model with Dynamic Attribute Graphs. In Findings of the Association for Computational Linguistics: ACL 2024, L. Ku, A. Martins, and V. Srikumar (Eds.), Bangkok, Thailand, p. 5797–5814. External Links: Link, Document Cited by: §1, §2. Liu et al. (2021) A. Liu, M. Sap, X. Lu, S. Swayamdipta, C. Bhagavatula, N. A. Smith, and Y. Choi DExperts: decoding-time controlled text generation with experts and anti-experts. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), C. Zong, F. Xia, W. Li, and R. Navigli (Eds.), Online, p. 6691–6706. External Links: Link, Document Cited by: §2. Liu et al. (2019) Y. Liu, M. Ott, N. Goyal, J. Du, M. Joshi, D. Chen, O. Levy, M. Lewis, L. Zettlemoyer, and V. Stoyanov RoBERTa: a robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. External Links: Link Cited by: §4. Lorandi and Belz (2023) M. Lorandi and A. Belz How to control sentiment in text generation: a survey of the state-of-the-art in sentiment-control techniques. In Proceedings of the 13th Workshop on Computational Approaches to Subjectivity, Sentiment, & Social Media Analysis, J. Barnes, O. De Clercq, and R. Klinger (Eds.), Toronto, Canada, p. 341–353. External Links: Link, Document Cited by: §1. Lu et al. (2023) A. Lu, H. Zhang, Y. Zhang, X. Wang, and D. Yang Bounding the Capabilities of Large Language Models in Open Text Generation with Prompt Constraints. In Findings of the Association for Computational Linguistics: EACL 2023, A. Vlachos and I. Augenstein (Eds.), Dubrovnik, Croatia, p. 1982–2008. External Links: Link, Document Cited by: §A.1. Lu et al. (2022) X. Lu, S. Welleck, J. Hessel, L. Jiang, L. Qin, P. West, P. Ammanabrolu, and Y. Choi QUARK: Controllable Text Generation with Reinforced Unlearning. Advances in Neural Information Processing Systems 35, p. 27591–27609 (en). External Links: Link Cited by: §2. Luo et al. (2019a) F. Luo, D. Dai, P. Yang, T. Liu, B. Chang, Z. Sui, and X. Sun Learning to control the fine-grained sentiment for story ending generation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, A. Korhonen, D. Traum, and L. Màrquez (Eds.), Florence, Italy, p. 6020–6026. External Links: Link, Document Cited by: §2. Luo et al. (2019b) F. Luo, P. Li, P. Yang, J. Zhou, Y. Tan, B. Chang, Z. Sui, and X. Sun Towards Fine-grained Text Sentiment Transfer. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, A. Korhonen, D. Traum, and L. Màrquez (Eds.), Florence, Italy, p. 2013–2022. External Links: Link, Document Cited by: §1, §2. Masoudian et al. (2024) S. Masoudian, C. Volaucnik, M. Schedl, and N. Rekabsaz Effective controllable bias mitigation for classification and retrieval using gate adapters. In Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics (Volume 1: Long Papers), Y. Graham and M. Purver (Eds.), St. Julian’s, Malta, p. 2434–2453. External Links: Link, Document Cited by: §2. Nawezi et al. (2023) G. Nawezi, L. Flek, and C. Welch Style Locality for Controllable Generation with kNN Language Models. In Proceedings of the 1st Workshop on Taming Large Language Models: Controllability in the era of Interactive Assistants!, D. Hazarika, X. R. Tang, and D. Jin (Eds.), Prague, Czech Republic, p. 68–75. External Links: Link Cited by: §2. Pascual et al. (2021) D. Pascual, B. Egressy, C. Meister, R. Cotterell, and R. Wattenhofer A plug-and-play method for controlled text generation. In Findings of the Association for Computational Linguistics: EMNLP 2021, M. Moens, X. Huang, L. Specia, and S. W. Yih (Eds.), Punta Cana, Dominican Republic, p. 3973–3997. External Links: Link, Document Cited by: §2. Peng et al. (2018) N. Peng, M. Ghazvininejad, J. May, and K. Knight Towards Controllable Story Generation. In Proceedings of the First Workshop on Storytelling, M. Mitchell, T. ‘. Huang, F. Ferraro, and I. Misra (Eds.), New Orleans, Louisiana, p. 43–49. External Links: Link, Document Cited by: §2. Qian et al. (2022) J. Qian, L. Dong, Y. Shen, F. Wei, and W. Chen Controllable Natural Language Generation with Contrastive Prefixes. In Findings of the Association for Computational Linguistics: ACL 2022, S. Muresan, P. Nakov, and A. Villavicencio (Eds.), Dublin, Ireland, p. 2912–2924. External Links: Link, Document Cited by: §2. Qiao et al. (2020) L. Qiao, J. Yan, F. Meng, Z. Yang, and J. Zhou A Sentiment-Controllable Topic-to-Essay Generator with Topic Knowledge Graph. In Findings of the Association for Computational Linguistics: EMNLP 2020, T. Cohn, Y. He, and Y. Liu (Eds.), Online, p. 3336–3344. External Links: Link, Document Cited by: §2. Reimers and Gurevych (2019) N. Reimers and I. Gurevych Sentence-BERT: sentence embeddings using Siamese BERT-networks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), K. Inui, J. Jiang, V. Ng, and X. Wan (Eds.), Hong Kong, China, p. 3982–3992. External Links: Link, Document Cited by: §4.2. Rimsky et al. (2024) N. Rimsky, N. Gabrieli, J. Schulz, M. Tong, E. Hubinger, and A. Turner Steering llama 2 via contrastive activation addition. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), L. Ku, A. Martins, and V. Srikumar (Eds.), Bangkok, Thailand, p. 15504–15522. External Links: Link, Document Cited by: §4.1. Samuel et al. (2025) V. Samuel, H. Diddee, Y. Zhang, and D. Ippolito CIE: Controlling Language Model Text Generations Using Continuous Signals. In Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, C. Christodoulopoulos, T. Chakraborty, C. Rose, and V. Peng (Eds.), Suzhou, China, p. 3815–3825. External Links: ISBN 979-8-89176-332-6, Link, Document Cited by: §A.1, §2. Shao et al. (2021) Y. Shao, T. Shao, M. Wang, P. Wang, and J. Gao A Sentiment and Style Controllable Approach for Chinese Poetry Generation. In Proceedings of the 30th ACM International Conference on Information & Knowledge Management, CIKM ’21, New York, NY, USA, p. 4784–4788. External Links: ISBN 978-1-4503-8446-9, Link, Document Cited by: §2. Sun et al. (2023) J. Sun, Y. Tian, W. Zhou, N. Xu, Q. Hu, R. Gupta, J. Wieting, N. Peng, and X. Ma Evaluating Large Language Models on Controlled Generation Tasks. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, H. Bouamor, J. Pino, and K. Bali (Eds.), Singapore, p. 3155–3168. External Links: Link, Document Cited by: §A.1. Tang and Wu (2021) Y. Tang and C. Wu Latent Attribute Control for Story Generation. In 2021 International Conference on Asian Language Processing (IALP), p. 148–153. External Links: Link, Document Cited by: §1. Vijayakumar et al. (2016) A. K. Vijayakumar, M. Cogswell, R. R. Selvaraju, Q. Sun, S. Lee, D. Crandall, and D. Batra Diverse beam search: decoding diverse solutions from neural sequence models. arXiv preprint arXiv:1610.02424. Cited by: §3.3. Wang et al. (2022) X. Wang, H. Jiang, Z. Wei, and S. Zhou CHAE: Fine-Grained Controllable Story Generation with Characters, Actions and Emotions. In Proceedings of the 29th International Conference on Computational Linguistics, N. Calzolari, C. Huang, H. Kim, J. Pustejovsky, L. Wanner, K. Choi, P. Ryu, H. Chen, L. Donatelli, H. Ji, S. Kurohashi, P. Paggio, N. Xue, S. Kim, Y. Hahm, Z. He, T. K. Lee, E. Santus, F. Bond, and S. Na (Eds.), Gyeongju, Republic of Korea, p. 6426–6435. External Links: Link Cited by: §2. Warner et al. (2025) B. Warner, A. Chaffin, B. Clavié, O. Weller, O. Hallström, S. Taghadouini, A. Gallagher, R. Biswas, F. Ladhak, T. Aarsen, G. T. Adams, J. Howard, and I. Poli Smarter, better, faster, longer: a modern bidirectional encoder for fast, memory efficient, and long context finetuning and inference. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), W. Che, J. Nabende, E. Shutova, and M. T. Pilehvar (Eds.), Vienna, Austria, p. 2526–2547. External Links: Link, Document, ISBN 979-8-89176-251-0 Cited by: §1, §4. Wu et al. (2016) Y. Wu, M. Schuster, Z. Chen, Q. V. Le, M. Norouzi, W. Macherey, M. Krikun, Y. Cao, Q. Gao, K. Macherey, et al. Google’s neural machine translation system: bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144. Cited by: §3.3, §3.3. Yang and Klein (2021) K. Yang and D. Klein FUDGE: controlled text generation with future discriminators. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, K. Toutanova, A. Rumshisky, L. Zettlemoyer, D. Hakkani-Tur, I. Beltagy, S. Bethard, R. Cotterell, T. Chakraborty, and Y. Zhou (Eds.), Online, p. 3511–3535. External Links: Link, Document Cited by: §2. Yang et al. (2024) N. Yang, W. Ma, and P. Cheng Plug-in Language Model: Controlling Text Generation with a Simple Regression Model. In Findings of the Association for Computational Linguistics: NAACL 2024, K. Duh, H. Gomez, and S. Bethard (Eds.), Mexico City, Mexico, p. 2165–2181. External Links: Link, Document Cited by: §1, §2. Yuan et al. (2022) L. Yuan, J. Wang, L. Yu, and X. Zhang Hierarchical template transformer for fine-grained sentiment controllable generation. Inf. Process. Manage. 59 (5). External Links: ISSN 0306-4573, Link, Document Cited by: §1, §2. Żal et al. (2024) P. A. Żal, G. Lu, and N. Gu Sentiment- and Keyword-Controllable Text Generation in German with Pre-trained Language Models. In Proceedings of the 9th edition of the Swiss Text Analytics Conference, C. Capol, M. Cieliebak, A. Weichselbraun, C. Musat, E. Maier, and L. Zimmermann (Eds.), Chur, Switzerland, p. 68–88. External Links: Link Cited by: §2. Zhang et al. (2023) H. Zhang, H. Song, S. Li, M. Zhou, and D. Song A survey of controllable text generation using transformer-based pre-trained language models. ACM Comput. Surv. 56 (3). External Links: ISSN 0360-0300, Link, Document Cited by: §1. Zhang et al. (2015) X. Zhang, J. Zhao, and Y. LeCun Character-level Convolutional Networks for Text Classification. arXiv:1509.01626 [cs]. External Links: 1509.01626 Cited by: §4. Zhao et al. (2021) Z. Zhao, E. Wallace, S. Feng, D. Klein, and S. Singh Calibrate before use: improving few-shot performance of language models. In Proceedings of the 38th International Conference on Machine Learning, M. Meila and T. Zhang (Eds.), Proceedings of Machine Learning Research, Vol. 139, p. 12697–12706. External Links: Link Cited by: §1. Zheng et al. (2023) C. Zheng, P. Ke, Z. Zhang, and M. Huang Click: controllable text generation with sequence likelihood contrastive learning. In Findings of the Association for Computational Linguistics: ACL 2023, A. Rogers, J. Boyd-Graber, and N. Okazaki (Eds.), Toronto, Canada, p. 1022–1040. External Links: Link, Document Cited by: §2. Appendix A Appendix A.1 Problem Statement and Motivation Further to related research supporting LLMs challenges of controllability through prompting we also did a small experiment to further show that models are incapable of following prompt-based controlling strategies. We directed GPT4o-mini model to provide stories with three distinct endings namely Positive, Negative, and Neutral with/without intensifying adverb "Very". We passed the endings provided by GPT4o-mini to VADER sentiment analyzer to score the sentiment of the stories. Figure 3 shows the result of this experiment. As it can be seen from the figure there are three major problems with the provided endings: (1) weak separation between adjective and intensified-adjective conditions, indicating limited intensity control Samuel et al. (2025); (2) a distributional shift toward more positive sentiment, even under negative targets Chen et al. (2025); and (3) compressed score ranges that rarely reach sentiment extremes. These findings are consistent with earlier reports that LLMs struggle with fine-grained controllability and strict prompt constraints (Sun et al., 2023; Lu et al., 2023). Together, this motivates moving beyond prompt-only control and focus on architectural changes and controllable frameworks. Figure 3: Sentiment of story ending written by GPT4o-Mini for Negative, Positive, and Neutral ending with and without intensifying adverb "Very" in the prompt. A.2 Baselines In This section we provide more technical detail on our baselines namely, Prompting, Instruction Tuning, Token Instruction Tuning and Steering Activation. A.2.1 Prompts When evaluating decoder models the choice of prompt is of great importance, slight changes in the prompt might lead to variations in the outcome of the model which further motivates our work. However, In order to have a robust evaluation we modified and re-evaluated the decoder models iteratively to come-up with the best instructions that led to the most accurate outcome in both response of the model and accuracy in following the sentiment. In this section we provide specific prompts used for each of the evaluation. Note that prompting variation is only important when evaluating off-the-shelf models and for instruction tuning, token instruction tuning the choice of prompt is not strongly related as the model will be evaluated with the same prompt to ensure a fair comparison with SenseShift. Prompting: For prompting we observed that masking the target sentence and asking to generate a sentence that fits best to that location is not performing accurately hence the prompt provides the full text while asking model to replace the existing sentence in text with a new sentence of another sentiment. Below we can find the specific prompt for every setup. Prompting Consider that every sentence has a sentiment where -1 is the most negative and 1 is the most positive sentiment. Given this text: FULL_TEXT Rewrite TARGET_SENTENCE to have a sentiment value of TARGET_SENTIMENT but still make sense to overall text. Write only the sentence and nothing else. Instruction Tuning: For instruction tuning to work the model requires the sentence to be predicted hence having the sentence in the text was not desirable and considered as leakage of information, Hence we modified the instruction and included [MISSING_SENTENCE] as masked version of the sentence and asked the models to write the missing sentence to have the specific value. Instruction Tuning Consider that every sentence has a sentiment where -1 is the most negative and 1 is the most positive sentiment. Given this text: MASKED_TEXT Rewrite [MISSING_SENTENCE] to have a sentiment value of TARGET_SENTIMENT but still make sense to overall text. Write only the sentence and nothing else. Token Instruction Tuning: The difference between this variation and the normal instruction tuning is the introduction of new controlling tokens to the model just as SenseShift is trained on. We equiped decoder models with SenseShift sentiment tokens [σi][ _i] as special untrainable tokens as well as added [MISSING_SENTENCE] as a new special token totalling 22 new tokens. in this version of the prompt each sentence has the control signals attached at the beginning of every sentence to give them context just like SenseShift: Token Instruction Tuning Consider that every sentence has a sentiment where -1 is the most negative and 1 is the most positive sentiment. Given this text: MASKED_TEXT_WITH_SENTIMENT_TOKENS Rewrite [MISSING_SENTENCE] to have a sentiment value of [σi]\[ _i]\ but still make sense to overall text. Write only the sentence and nothing else. [σi]\[ _i]\ A.2.2 Activation Steering Over the past few years, activation steering has emerged as an effective technique for controlling generated text using contrastive samples. These samples are typically constructed from the original dataset as minimally differing pairs, where small, targeted changes (e.g., sentiment polarity) induce measurable shifts in model activations. Although this approach does not require additional model training, its effectiveness depends critically on the quality and construction of the contrastive pairs. In our setup, we construct contrastive pairs by selecting sentences with extreme sentiment values (i.e., |σsi|>0.9| _s_i|>0.9). We then use the steering vector library 99 9 https://github.com/steering-vectors/steering-vectors to extract activation directions from these pairs. Here, “training” refers not to updating model parameters, but to computing steering vectors that capture the latent direction corresponding to the desired attribute shift. For each dataset, we sample 10k10k contrastive pairs from the pool of possible combinations to estimate these directions. At inference time, the steering strength is controlled via a scaling factor (the multiplier), which determines the extent to which the model output is shifted toward the target attribute. While the original method is primarily designed for categorical control, it also suggests the potential for continuous modulation. Following this insight, we adapt the multiplier dynamically based on the target sentiment value, enabling more fine-grained, continuous control over the generated text. A.2.3 Dataset Statistics and Training Hyper-Parameters During pre-processing we removed major samples in the dataset which were not suitable for our task (e.g., reviews with one sentence). In Table 4 we report the statistics of the training data and hyperparameters used for model training. Table 3: Dataset statistics for the train splits. Sentiment scores are in [−1,1][-1,1]. Statistics TinyStories Yelp Num Samples 4439352 252085 Positive (>0.2) 53.7% 41.0% Negative (<-0.2) 0.3% 4.3% Neutral 46.0% 54.8% Text Avg Sentences 14.2 ± 7.77 6.4 ± 4.86 Median Sentences 13. 5 Min/Max Sentences 2 / 195 2 / 86 Avg Words 152.90 ± 53.52 90.28 ± 80.34 Median Words 143.00 68.00 Min/Max Words 9 / 902 1 / 1004 Avg VADER 0.21 ± 0.14 0.15 ± 0.20 Median VADER 0.21 0.14 Min/Max VADER -0.68 / 0.92 -0.91 / 0.96 Avg RoBERTa 0.27 ± 0.22 -0.0206 ± 0.64 Sentences Avg Words 10.7 ± 5.36 13.9 ± 9.61 Median Words 10 12 Min/Max Words 1 / 702 1 / 550 Avg VADER sent. 0.1978 ± 0.38 0.13 ± 0.37 Min/Max VADER -1.0 / 1.0 -0.99 / 0.99 Avg RoBERTa sent. 0.25 / 0.52 -0.078 / 0.94 Min/Max RoBERTa -1.0 / 1.0 -0.99 / 0.99 For our models we have not used any PEFT method and all models’ full number of parameters are tuned for the task to ensure that none of the results are effected by the number of parameters that are trained. Table 4: Default hyperparameters used across different training paradigms for controllability. * value for Qwen is 1024 to ensure finalizing thinking process. State Hyperparameter Prompt/Steer Inst-Tune Token-Inst-Tune SenseShift Training Learning rate (lr) – 1e-5 1e-5 1e-5 Batch size (bs) – 32 32 50 Dropout (dp) – 0.0 0.0 0.0 Warmup steps – 500 500 500 Epochs – 30 30 50 Weight decay – 0.01 0.01 0.01 Scheduler – Linear Linear Linear Regime – Causal Causal MLM Generation Temperature (T) 0.7 0.7 0.7 0.9 Top-p 0.9 0.9 0.9 0.9 Repetition penalty (rp) 1.1 1.1 1.1 - Max tokens 128* 128 128 30 A.3 Iterative Infilling Versus One Shot Prediction Table 5: Comparison between Iterative Mask Infilling and Whole Mask prediction Model Train Story Generation Review Generation Ppl. ↓ Δs _s ↓ Δf _f ↑ Corr. ↑ Acc. ↑ Ppl. ↓ Δs _s ↓ Δf _f ↑ Corr. ↑ Acc. ↑ Whole Mask Prediction ModernBert-E-0.15b Story 596.8 0.42 -0.01 0.54 0.44 303.1 0.44 -0.02* 0.48 0.38 Review 482.9 0.50 -0.04* 0.27 0.31 325.2 0.43 -0.01 0.55 0.44 ModernBert-E-0.4b Story 869.9 0.4 -0.039* 0.55 0.5 571.3 0.43 0.01 0.48 0.39 Review 426.3 0.50 -0.041* 0.29 0.32 288.8 0.44 -0.013 0.51 0.41 Iterative Mask infilling ModernBert-E-0.15b Story 91.6 0.26 -0.00 0.77 0.69 63.1 0.28 0.07* 0.73 0.69 Review 65.6 0.38 -0.00 0.58 0.57 55.3 0.29 0.06* 0.71 0.66 ModernBert-E-0.4b Story 53.6 0.20 -0.00 0.79 0.78 31.4 0.15 0.07* 0.85 0.85 Review 83.0 0.34 -0.00 0.62 0.61 57.5 0.26 0.04* 0.71 0.69 Mask prediction was not used for long text generation due to their one-shot prediction of all masks which result in several repetitive high probability tokens appearing in different parts of the text without rational connection. Here we present an ablation study of removing infilling mask prediction from the model to show the effectiveness of the technique. Table 5 compares our iterative mask infilling strategy against a whole mask prediction using SenseShift, in which all masked tokens are predicted in a single forward pass. The results strongly favour the iterative approach across every metric and configuration. Perplexity improvements are the most striking: iterative infilling reduces PPL by a factor of 5–10× across all model sizes and training domains (e.g., ModernBert-E-0.4b Story drops from 869.9 to 53.6), indicating that generating masked spans token-by-token produces substantially more fluent text than predicting the entire span at once. Sentiment control follows the same pattern: Δs _s is consistently lower under iterative infilling, with reductions of 0.15–0.25 across configurations, while Δf _f values remain near zero compared to the small but consistent negative drift observed under whole mask prediction. These results suggest that whole mask prediction suffers from exposure bias where the model must generate a coherent span without access to its own intermediate outputs whereas iterative infilling conditions each token on the previously generated context, allowing sentiment and fluency constraints to be satisfied progressively rather than in a single unconstrained step giving advantage of decoder models to encoder ones. A.4 Human Evaluation Protocol To ensure that our results are comparable with human understanding of fitness and sentiment we compared SenseShift rewrites with parallel rewrites of closest comparable competing decoder-based model namely Gemma2-2b. Both models are trained on story and Gemma2-2b is selected for human evaluation because of its competetive performance in automatic evaluation. Furthermore Gemma2-2b is the closest comparable baseline when it comes to evaluation while it goes through the same sentiment token training as ModernBert-E-0.4b and in contrast to prompting method which the original sentence is visible to the model Gemma2-2b does not have access to the original sentence. Our human evaluation is a user preference study where users are asked to select which model they think generated a higher quality sentence given a document. We developed a simple annotation platform and selected 100 samples from stories (n=55) and reviews (n=45) where models both models rewrite for the exact same sentence and the exact same sentiment. We shared the annotation link with 8 annotators volunteered to give their preference on the rewrites. We did not collect their demographic information nor collected any other sensitive information rather than labels from the annotators. We provided them full document context (review or story), the original sentence which was targeted for replacement, and two anonymized candidate generated sentences which one produced by Gemma2-9b trained with token instruction tuning and one by ModernBert-E-0.4b. We display the sentences in randomized order to control for position bias of annotators and also to protect model identities. For each pair, annotators respond to three questions: • Contextual Fit. Which rewrite fits better into the surrounding text? Judge whether it matches the tone, vocabulary, register, and stylistic quirks of the full passage. If the original writing is formal, poetic, blunt, or otherwise distinctive, a good rewrite preserves those features and sits well inside the position to produce a coherent text. • Grammar and Fluency. Ignoring the surrounding text, which sentence is more grammatically correct and naturally written as a standalone sentence? Annotators focus purely on syntax, word choice, and fluency. • Sentiment Match. Which rewrite better achieves the target sentiment, specified on a scale from −1-1 (very negative) to +1+1 (very positive)? Annotators judge how well each sentence’s emotional tone matches the indicated target value. For each criterion, annotators select one of four options: A, B, Both (both outputs are equally good), or Neither (neither output is satisfactory) where A and B represent Gemma2-2b and ModernBert-E-0.4b-story in random order. We report average preference of annotators in Table 2 across the three quality criteria. Tables 6 and 7 report the results in detail for each domain. Table 6: Human preference evaluation on the Story domain (n=55 sentence pairs). The specific model used for evaluation is ModernBert-E-0.4b trained on stories. Similarity to Original is reported as a diagnostic metric and excluded from the Overall score. Criterion Gemma2-2b SenseShift Both Neither Fitness 17.2 23.4 54.7 4.7 Grammar 4.7 4.7 89.1 1.6 Sentiment 29.7 28.1 31.2 10.9 Overall 17.2 18.8 58.3 5.7 Table 7: Human preference evaluation on the Review domain (OOD n=45 sentence pairs). The specific model used for evaluation is ModernBert-E-0.4b trained on stories. Similarity to Original is reported as a diagnostic metric and excluded from the Overall score. Criterion Gemma2-2b SenseShift Both Neither Fitness 27.7 23.4 36.2 12.8 Grammar 8.5 8.5 78.7 4.3 Sentiment 25.5 36.2 23.4 14.9 Overall 20.6 22.7 46.1 10.6 A.5 Joint Analysis of Δs _s Figure 4 extends the univariate analysis of Section 5 by examining Δs _s across pairs of evaluation dimensions for the large-story model. Figure 4: Mean Δs _s as a joint function for the ModernBert-E-0.4b-story. Left: Target sentiment vs. relative sentence position. Center: Target sentiment vs. number of masked tokens. Right: Relative sentence position vs. number of masked tokens. Lower values (green) indicate better sentiment control. Strongly negative target sentiment (s=−1.0s=-1.0) dominates error across all positions, peaking at Δs=0.66 _s=0.66 at late document positions where accumulated context compounds the difficulty. Across non-extreme sentiment values, sentence position has comparatively little effect, suggesting position-dependent degradation is largely confined to the sentiment extremes. The interaction between large mask counts and strongly negative targets is the most pronounced pattern across all three heatmaps, reaching a global maximum of Δs=0.72 _s=0.72. At neutral-to-positive targets, increasing mask size has only a modest effect, indicating that additional generation freedom is primarily problematic when the target register is already difficult to maintain. Error increases moderately toward late positions and large mask counts, though the interaction between the two is approximately additive. Notably, mid-document positions (0.44–0.69) yield the lowest Δs _s, suggesting that a moderate amount of preceding context aids sentiment following more than editing at the document start. A.6 Qualitative Examples To demonstrate the model’s capabilities, we provide a demo program that allows users to inspect model behavior on arbitrary input text. Figure 5 visualizes the interactive demo. We present qualitative examples of iterative sentiment editing applied to a story (in-distribution) and a hotel review (out-of-distribution), both edited using ModernBert-E-0.4b trained on the story dataset. Figure 5: Interactive demo of SenseShift. Users can choose or randomly select data from both dataset and edit different sentences with their desired sentiment intensity Figure 6 illustrates the story editing process using our custom visualization tool. Figure 6(a) shows the original sentiment trajectory, revealing a mix of positive, neutral, and negative tones that makes fine-grained control challenging. In Figure 6(b), we shift the story toward a more negative tone without altering its core theme where a boy, a fish, and his mother contribute while transforming a harmless event into one involving a dead fish and an angry mother. This required 20 edits across all sentences. We observed stronger negative transformations sometimes necessitate modifying surrounding context, as locally extreme changes can conflict with the overall tone of prior or posterior sentences. Figure 6(c) shows the opposite transformation toward a more positive tone, requiring only 12 edits across 7 of 8 sentences, suggesting that positive sentiment shifts are more efficient when the original context already leans positive. Figure 7 presents the same editing process applied to a hotel review as an out-of-distribution test. Figures 7 (a), (b), and (c) show the original review, negative arc shift (8 edits), and positive arc shift (6 edits) respectively. ModernBert-E-0.4b demonstrate strong OOD capability in review domain despite being trained exclusively on stories, maintaining coherent and fluent edits across both sentiment directions. Overall, these examples demonstrate that ModernBert-E-0.4b achieves fine-grained controllable sentiment editing while preserving narrative coherence, with the number of required edits reflecting the asymmetry between negative and positive sentiment shifts observed in the quantitative results. (a) Original story and its sentiment arc. (b) Shifting sentiment arc toward negative with 20 edit. Less-hued numbers show actual post-edit sentiment; larger gaps indicate lower faithfulness. (c) Shift Arc toward positive with 12 edits. Positive shifts required fewer edits reflecting the sentiment asymmetry in the quantitative results. Figure 6: Qualitative examples of iterative sentiment editing on a story (in-distribution). Each subfigure shows the sentiment arc (top) and annotated text (bottom). (a) Original review and its sentiment arc. (b) Shifting sentiment arc toward negative with 8 edits. Less-hued numbers show actual post-edit sentiment; larger gaps indicate lower faithfulness. (c) Shifting sentiment arc toward positive with 6 edits. Figure 7: Qualitative examples of iterative sentiment editing on a hotel review (out-of-distribution). Each subfigure shows the sentiment arc (top) and annotated text (bottom). A.7 Usage of AI We used Claude to assist with plotting and writing the HTML code for the user-study interface. We also used OpenAI models and Claude to revise the authors’ original writing for grammar and clarity. Gusfield:97