WorksComputer Science
Read the Room Before Your Model Generates
Abstract
Large language models (LLMs) generally rely on sampling temperature to regulate the amount of randomness in their outputs. Mainstream methods for selecting temperature typically involve fixed, heuristic global settings and context or token-level calibration, rather than a geometrically interpretable representation of the communicative scenario. In this work, we introduce a simple and interpretable temperature selection framework, the Scenario-Actor, which adapts decoding to the inferred situational characteristics. Scenario-Actor extracts scenario-relevant structures from Transformer hidden states and determines the temperature from scenario embedding, a structured geometric representation of the communicative setting. Empirical results show that on Llama-3.1-8B-Instruct, Scenario-Actor achieves strong goal-completion performance in interactive social scenarios, significant gains on open-ended instruction following, and competitive performance on multi-turn conversation compared to multiple baselines.
Introduction
Large language models (LLMs) generate text by repeatedly sampling from a conditional next-token distribution. One of the simplest yet most consequential hyperparameters in language generation is the sampling temperature, which controls the sharpness of the next-token probability distribution and, in turn, the rigor and creativity of model output.
Existing systems typically set it globally or adapt it according to predictive uncertainty, context, or learned decoding objectives, which implicitly treat decoding primarily as a property of the model’s predictive state [4, 23]. But socially situated language generation exposes a different source of variation: the interaction itself. A prompt conveys not only semantics but also implies a communicative setting. For example, the conversation could be either an academic discussion or a friendly chitchat, whose desired responses are either rigorous or open-ended, formal or casual. The optimal temperature is then circumstantial, varying across scenarios.
Figure 1. AgentSense goal-outcome flip rate (top) and goal completion score (bottom) by changing temperature.
In our controlled experiment, we decode 245 AgentSense [16] social interactions with four fixed temperatures. We found that first, changing temperature substantially alters interaction quality, moving between mid-range temperatures flips 16 to 17% of individual goal outcomes; second, globally strongest temperature setting does not dominate across interactions.
Such results show a major limitation of viewing temperature as a globally fixed hyperparameter, which motivates us to propose a way to control scenario-aware interaction and language generation. In this work, we propose Scenario-Actor, a framework for scenario-adaptive temperature selection. Scenario-Actor focuses on social interactions and open-ended instruction following, where the prompt provides enough evidence to infer a communicative scenario. We introduce a structured representation of the communicative setting extracted from context - the scenario embedding2, whose span defines the scenario space, and use it to derive the sampling temperature. Specifically, our method maps a representation from the -th layer of the Transformer to an -dimensional scenario space, where each input is represented by a scenario embedding. An Actout function then maps the geometry of this vector to a prompt-level sampling temperature.
Prior work in social psychology provides us with a theoretical support by introducing DIAMONDS [20], a working model of situation characteristics showing that human behavior varies with situation characteristics. We construct scenario axes from nine pre-defined scenario labels. At the end, five scenario axes are constructed, corresponding to five of the eight DIAMONDS - Duty, Intellect, Adversity, Negativity, and Sociality [20]. Evaluations across fixed and random temperature policies, nucleus sampling [8], and EDT [27] baselines indicate Scenario-Actor’s competitive performance on interactive social scenarios, open-ended instruction following, and multi-turn dialogue compared to most decoding strategies.
Background
An autoregressive language model generates a response one token at a time. In each next-token generation, a trained neural network first produces a set of scores, which we call logits, from the prompt and the generated tokens over the vocabulary that represents all possible next tokens. A Softmax function then transforms these logits to a distribution that gives how likely a token is to be the next.
Let and be the -th token to be generated and already generated, and be the -th logits of the token in the vocabulary. Concretely, we have
Now, notice that if we divide each logit with a positive scalar , the relative contribution of each numerator to the denominator will change with . When , each becomes less dominant over , making the probabilities more evenly distributed. When , each becomes more dominant. This scalar therefore controls the sharpness of the next-token distribution, which is commonly referred to as the temperature. Formally, for ,
With all these, the last thing we need to do is to select a token through a process called sampling. Recent work center around language model’s temperature and sampling strategies, which we discuss in the following paragraphs.
Fixed decoding hyperparameters. Early work and much of engineering practice predominantly relied on manually chosen global decoding strategies for task-specific models, such as beam search, top-, and fixed sampling temperatures. Holtzman et al. [8] showed that in open-ended text generation, likelihood-maximizing decoding methods often lead to bland, repetitive, and degenerate outputs, and proposed nucleus sampling (top-) as a more effective alternative. Zhang et al. [26] examined the trade-off between quality and diversity in different decoding strategies. Their findings indicate that all decoding methods perform similarly when diversity is a priority, but nucleus sampling [8] consistently outperforms all other evaluated algorithms when quality is viewed as more important. Wiher et al. [24] revealed that the effectiveness of decoding strategies is highly task-dependent. Later in LLM era, Shi et al. [21] made a more systematic horizontal comparison among decoding methods and revealed that decoding method performance strongly depends on task, model size, alignment, and quantization.
Token-level dynamic temperature. Fixed decoding hyperparameters are not always optimal at every decoding step. An early token-level architecture begins with Chang et al. [2], who proposed to relax the fixed-temperature assumption and adjust temperature dynamically according to its relevance to the source through KL-divergence. Zhu et al. [29] then introduced AdapT sampling for code generation. Zhang et al. [27] further put forth EDT, which adjusts temperature directly from token-level entropy to better balance quality and diversity.
Figure 2. The Scenario-Actor - framework overview.
Figure 3. Visualization of scenario space and Actout.
Context and example-level temperature. Another line of work concerns selecting sampling temperature from context. Wang et al. [23] proposed contextual temperature, which learns a context-dependent temperature vector over the output vocabulary. Li et al. [14] proposed DDS for open-domain dialogue system. DDS copes with two situations - chit-chat and factual QA - and maps context-dependent diversity score to a single decoding temperature. Dhuliawala et al. [4] introduced adaptive decoding, which allows temperature to be predicted either once per example or dynamically at each decoding step.
The Scenario-Actor
Most modern LLMs are built using the celebrated Transformer architecture. In our framework, we assume that our prompt context is represented by a Transformer model and take the -th layer hidden-state matrix as input. The Scenario-Actor has
two fundamental parts: Scenarize and Actout.3 Scenarize takes the hidden-state matrix at the -th Transformer layer as its input and outputs the scenario embedding; Actout takes a scenario embedding and maps it to a sampling temperature .
In the remainder of this section, we discuss these two modules in depth.
Scenarize
Before introducing our first module, let’s establish some basic mathematical setup. For a prompt with tokens, let denote the hidden-state matrix at the -th Transformer layer, and denote the learned -dimensional scenario embedding of prompt . The set be the set of all learned scenario embeddings. We define the scenario space as
Given that the language model interaction is text-only, the underlying prompt scenario is often underdetermined with shorter linguistic sequences. As more tokens are observed, the scenario is generally expected to be more identifiable since longer prompts typically provide additional disambiguating context. As such, we model as a recurrent neural network (RNN) that updates the inferred scenario token by token. The final state at therefore represents the most informed scenario embedding which we will consider. Overall, we compute scenario embedding as
Here, is the activation function; is the scenario transition matrix (STM); is the scenario mapping matrix (SMM); and is the bias term. Each scenario vector is computed as the learned affine combination of the previous token estimate and the current inference from context , as depicted in Figure 4.
Figure 4. The Scenarize module.
Both STM and SMM are expected to be trained on prompt triplets , where denotes the prompt with base scenario, the prompt with similar scenario, and the prompt with opposite scenario. Given such a triplet, we define the loss function as
which compares the distance from the base prompt scenario vector to the similar and opposite scenario vector with a margin . In this work, we employ the squared Euclidean distance and .
Actout
Actout then maps a scenario embedding to a temperature. Drawing on SemAxis [1], we define scenario axes from two non-zero opposite scenario vectors and . Each scenario axis can be defined as . We name the scenario vectors on all scenario axes as subscenario vectors, each representing an elementary component of a more complex scenario. For all scenario axes, two typical temperatures and on both the positive and negative directions are applied. In general, have one-to-one correspondence with .
Let be the signed cosine similarity between the normalized scenario embedding and the axis. For , the temperature is then defined as
Temperature is defined as a normalized weighted average over scenario axes. For each axis , the cosine similarity specifies where the scenario embedding lies along that axis. Endpoint temperatures and are linearly interpolated based on , so that the estimate moves towards if is positive and if negative. The denominator normalizes the weighted sum, eventually yielding a temperature inferred from the prompt’s position in scenario space.
Experiment
We evaluate our proposed Scenario-Actor framework on benchmarks covering interactive social scenarios, open-ended instruction following and multi-turn question answering to test its performance on context-rich and socially-situated interactions. We also use GSM8K [3] as a task-only stress test to study the boundary of scenario-based decoding.
Experimental Setup
Backbone model
Despite the outstanding performance of mainstream LLMs such as ChatGPT and Gemini, we do not have access to the hidden states with API calls. Therefore, we use the open-weight Llama-3.1-8B-Instruct (Grattafiori et al., [7]) as our backbone model. The model is used for both hidden-state extraction and generation.
Data
We collect 37,357 conversational prompts from human-human and human-LLM interaction corpora, including WildChat (Zhao et al., [28]) and DailyDialog (Li et al., [13]), together with targeted supplementary datasets for under-represented scenario types. Each prompt is annotated by GPT-4o (OpenAI, [18]) with one of nine scenario labels. A confidence-based filtering is applied to construct a high-confidence supervision set, resulting in 34,427 training prompts for triplet construction and 2,930 validation prompts.
Baselines
We compare Scenario-Actor against fixed-temperature decoding at , greedy decoding, random temperature selection, nucleus sampling (Holtzman et al., [8]) with and , and entropy-driven temperature decoding (EDT) (Zhang et al., [27]). EDT is included as a training-free and directly reproducible adaptive baseline. DDS and LPO (Li et al., [14]; Dhuliawala et al. [4]) both, in contrast, require training additional components. LPO trains its decoder module via preference optimization over sampled outputs, and DDS trains a diversity regressor designed for a two-way chit-chat vs. QA distinction, with, to our knowledge, no public implementation. Reproducing either method involves substantial heuristic design choices of our own, making the comparison hard to attribute in either direction.
Implementation details
Hidden states Llama-3.1-8B has 32 Transformer layers. For all experiments, we use the hidden states at the 16th Transformer layer. We found that scenario geometry collapses with deeper Transformer layer, which we discuss in § 4.4.
Scenarize Scenarize maps the above hidden states into a 32-dimensional scenario embedding. The implementation follows (1), where is the Transformer layer, is the activation function. Scenarize is trained according to (2) with squared Euclidean triplet loss with margin . AdamW with learning rate 3.0e-4, weight decay 1.0e-4, gradient clipping at 1.0, and early stopping based on validation recall@1 is used as optimizer.
Actout We operationalize five DIAMONDS dimensions with nine scenario labels. We compute the centroid of each scenario label as a sub-scenario vector and use these vectors to define each scenario axes. GPT-4o (OpenAI, [18]) is used as an LLM annotator for the training set. The nine scenario labels are rigorous, brainstorming, formal, playful, adversarial, institutional, casual_conversation, emotional_support_pos, and emotional_support_neg.
Five scenario axes - institutional vs. casual_conversation, rigorous vs. brainstorming, adversarial vs. non-adversarial; emotional_support_pos vs. emotional_support_neg, and formal vs. playful were constructed from combinations of nine subscenario vectors. Non-adversarial is the average over all subscenario vectors that are not adversarial. Detailed description of each scenario can be found in Appendix § 9. Such five scenario axes match five of the DIAMONDS: Duty, Intellect, Adversity, Negativity, and Sociality (Rauthmann et al., [20]).
Each of the five axes is assigned two endpoint temperatures (), which are external hyperparameters of Actout, as shown in Table 2. Actout then maps a scenario embedding generated from Scenarize to a temperature within the range corresponding to Equation (3). In our experiment, we fixed for all benchmarks and comparisons.
| Scenario Label | |
| rigorous | 0.30 |
| institutional | 0.50 |
| formal | 0.55 |
| emotional_support_neg | 0.65 |
| adversarial | 0.75 |
| emotional_support_pos | 1.00 |
| casual_conversation | 1.10 |
| brainstorming | 1.40 |
| playful | 1.50 |
Table 2. Scenario labels and their endpoint temperatures.
Main Result
We evaluate Scenario-Actor across three benchmarks - AgentSense [16], AlpacaEval [6], and MT-Bench (Zheng et al., 2023) - covering situational goal-completion, open-ended instruction following, and multi-turn interactions with respect to all baselines. Goal completion score, Length-Controlled Win Rate (LC-WR), and GPT-4 score were metrics for each of the three main evaluations. The performance is shown in Table 1. Scenario-Actor significantly outperforms most decoding methods on AgentSense and all baselines on AlpacaEval, while remaining competitive on MT-Bench in our experiment.
Among available benchmarks, AgentSense directly evaluates the setting targeted by Scenario-Actor: interactive dialogue in which the model must adapt to complete different goals as the social context develops. Scenario-Actor achieves the highest goal completion score of 0.8015, outperforming greedy decoding, every fixed-temperature setting, EDT, nucleus sampling, and Random-. Scenario-Actor attains significant improvements over all baselines on the range from 3.16 to 10.26 percentage points except for fixed at 0.7801, for which Scenario-Actor’s 2.14 percentage points advantage is not statistically significant.
On AlpacaEval, Scenario-Actor achieves the strongest result among all tested methods with 30.03% Length-Controlled Win Rate (LC-WR),
| Baseline | AgentSense | AlpacaEval | MT-Bench |
| Metric | Goal completion | LC-WR (%) | GPT-4 score |
| Scenario-Actor | 0.8015 | 30.03 | 7.91 |
| Greedy | 0.7582 | 22.87 | 7.79 |
| Fixed | 0.7540 | 23.63 | 7.79 |
| Fixed | 0.7801 | 25.68 | 7.83 |
| Fixed | 0.7692 | 23.42 | 7.61 |
| Fixed | 0.6989 | 8.60 | 6.76 |
| EDT | 0.7671 | 25.58 | 6.74 |
| Nucleus () | 0.7557 | 23.59 | 7.63 |
| Random- | 0.7699 | 20.44 | 7.71 |
caption: Benchmark results comparing Scenario-Actor with fixed-temperature and adaptive decoding baselines. Best results are highlighted.
:::
outperforming the best fixed-temperature baseline by 4.35 percentage points, EDT by 4.45 percentage points, and exceeding nucleus sampling, greedy decoding, Random-, and class-conditioned with statistical significance. On MT-Bench, our framework scores 7.91, which is significantly above fixed , fixed , Random-, nucleus sampling, EDT, and class-conditioned , and is potentially competitive among greedy decoding, fixed , and fixed . Detailed statistical report can be found in Appendix § 8.
Analysis
Agreements To justify the use of LLM for scenario annotation and results judging, we compute both the LLM-human and human-human agreement on the models we used. A gold set on scenario annotation consisting of 306 prompts and a gold set on evaluation consisting of 50 AlpacaEval examples and 50 MT-Bench examples were manually annotated by us.
| Validation | LLM-human | Human-human |
| Annotation | 0.82 / 0.85 | 0.79 |
| AE Agreement | 86.00 / 86.00 | 80.00 |
| AE judge | 0.72 / 0.72 | 0.60 |
| MT Pearson | 0.92 / 0.86 | 0.87 |
| MT Spearman | 0.84 / 0.70 | 0.79 |
| AS Agreement | 80.00 / 72.00 | 76.00 |
| AS Cohen’s | 0.48 / 0.27 | 0.40 |
Table 3. Agreement between LLM-based evaluators and human annotators. Values are rounded to two decimal places. Detailed validation metrics are reported in Appendix § 11.
The results show that the GPT-4o annotator agrees with each human annotator at and . The GPT-4-turbo [17] AlpacaEval judge reaches with each annotator; for MT-Bench scoring, it correlates with human raters at Pearson and ; for AgentSense, it achieves agreement rates of 80% and 72% with the two human judges, comparable to the human-human agreement of 76%, and with Cohen’s of 0.48 and 0.27, respectively.
Geometry To validate if Scenarize learns meaningful scenario geometry, we visualize the learned scenario space using both PCA and UMAP. PCA shows the global variance structure of 900 scenario embeddings, with 100 examples from each scenario label. The first two principal components explain 27.9% and 21.8% of the variance respectively. As shown in Figure 5, nine centroids obtained from nine scenario labels occupy different regions in scenario space. PCA view also shows the five proposed scenario axes used in our experiment - Duty, Intellect, Negativity, Sociality, and Adversity. The patterns therefore reflect that Scenarize learns a structured scenario space.
Figure 5. PCA (left) and UMAP (right) of scenario embedding geometry.
UMAP further confirms local structure of the learned space. The projection achieves a trustworthiness score of 0.96 using cosine distance. The embedding exhibits meaningful relationships among the nine scenario types. Semantically related scenarios also cluster near one another; for example, institutional prompts lie closer to rigorous prompts than to casual conversation.
GSM8K diagnosis To study the boundary of Scenario-Actor, we tested its performance on GSM8K against all other baselines. Scenario-Actor significantly underperforms greedy decoding, fixed , fixed , EDT, and insignificantly lower than Random- baseline by 0.53.
| Baseline | GSM8K |
| Metric | Accuracy (%) |
| Scenario-Actor | 65.28 |
| Greedy | 77.18 |
| Fixed | 69.52 |
| Fixed | 69.07 |
| Fixed | 62.40 |
| Fixed | 45.19 |
| EDT | 69.14 |
| Nucleus () | 61.33 |
| Random- | 65.81 |
Table 4. GSM8K results comparing Scenario-Actor with fixed-temperature and adaptive decoding baselines. The best result is highlighted.
Our GSM8K temperature is distributed within the range of . In theory, GSM8K would exhibit better performance of the model when the sampling temperature is lower. In our experiment, Scenario-Actor selects a GSM8K temperature less than ideal. Nearest-centroid analysis shows that the distribution is concentrated in adversarial, institutional, and brainstorming scenarios, which together account for 77.9% of GSM8K prompts. Only 5.0% are mapped to the rigorous scenario.
| Scenario | Count | Percentage |
| adversarial | 350 | 26.5% |
| institutional | 346 | 26.2% |
| brainstorming | 332 | 25.2% |
| playful | 79 | 6.0% |
| casual_conversation | 67 | 5.1% |
| rigorous | 66 | 5.0% |
| formal | 40 | 3.0% |
| emotional_support_neg | 23 | 1.7% |
| emotional_support_pos | 16 | 1.2% |
Table 5. GSM8K scenario count
All nine centroids look nearly identical to GSM8K prompts in cosine space:
| Scenario Centroid | Cosine Similarity |
| adversarial | 0.9765 |
| institutional | 0.9710 |
| rigorous | 0.9684 |
| brainstorming | 0.9510 |
| playful | 0.9499 |
| casual_conversation | 0.9463 |
| emotional_support_neg | 0.9191 |
| formal | 0.9098 |
| emotional_support_pos | 0.9043 |
Table 6. Mean cosine similarity between GSM8K and nine centroids, with gap of 0.0247 between the nearest and the second-nearest centroid per prompt
The results reflect near-equidistance of GSM8K to all scenario centroids: GSM8K prompts occupy a high-similarity region of the learned space. The current geometry does not reliably map task-only mathematical prompts to a low-temperature rigorous regime, and Scenario-Actor fails to infer the “scenario” of GSM8K prompts. The result illustrates the scope and boundary of Scenario-Actor to be a decoding framework for prompts whose communicative scenario can be inferred from context.
Temperature We examine the temperatures selected by Scenario-Actor across all benchmarks. Scenario-Actor operates within the range of [0.67, 1.16] across turns generated by the evaluated Llama-3.1-8B-Instruct, [0.77, 1.01] on AlpacaEval, and [0.76, 1.02] on MT-Bench. AgentSense temperatures also change with dialogue context, with the mean temperature increasing by approximately 0.16 across turn positions.
Context length We compare outputs generated by Scenario-Actor under short context with only one prior turn versus long context with all prior turns on 100 DailyDialog multi-turn conversations. Long context Scenario-Actor achieves a win rate of 67.0% over short context with a 95% bootstrap confidence interval of [58.0%, 76.0%] in pairwise GPT-4-turbo evaluation. The finding supports our claim that scenario is generally expected to be more identifiable with more context, which motivates the RNN formulation of Scenarize.
Efficiency We measure the latency, memory usage, and throughput of Scenario-Actor over 80 MT-Bench prompts on a single NVIDIA A10G 24 GB GPU (ml.g5.2xlarge). Latency includes hidden-state extraction, Scenarize, Actout, and response generation. As shown in Appendix § 7, Scenario-Actor has similar end-to-end latency and throughput to the tested decoding baselines. Latency is within 2.5% of greedy decoding, while the output and request throughput remain close to standard sampling methods. Peak allocated memory is also nearly unchanged.
Ablation
Geometry contributes more than endpoint temperature lookup. To test whether the gains come from the scenario geometry or from the manually-specified endpoint temperatures, we add a class-conditioned temperature baseline which uses the same Scenarize module but removes Actout’s geometric weighting. Class-conditioned baseline treats the nearest centroid as the prompt’s class label and assigns its sampling temperature from corresponding endpoint.
| Benchmark | Scenario-Actor | Class-conditioned |
| AgentSense | 0.8015 | 0.7536 |
| AlpacaEval | 30.03 | 27.10 |
| MT-Bench | 7.91 | 7.64 |
Table 7. Comparison with the class-conditioned temperature baseline. Metrics are goal completion score, LC-WR (%), and GPT-4 score respectively. Best results are highlighted.
Class-conditioned temperature baseline achieves a goal completion score of 0.7536 on AgentSense, LC-WR of 27.10% on AlpacaEval and a score of 7.64 on MT-Bench, which is lower than Scenario-Actor by 4.79 and 2.93 percentage points, and 0.27 points respectively. The improvements are statistically significant on all three benchmarks: AgentSense ([+1.85, +7.88], ), AlpacaEval ([+0.55, +5.32], ), and MT-Bench ([+0.02, +0.52], ). Since both methods use the same endpoint values, these results suggest the effectiveness of Actout’s geometric interpolation compared to class-level temperature lookup.
Layer 16 provides the best tradeoff for scenario probing. To test which layer would be the optimal for scenario decoding, we evaluate several metrics across different Transformer layers. Four of which are recall@1, which computes how often the nearest retrieved embedding belongs to the same scenario; effective rank, measuring how many embedding dimensions are meaningfully used; tanh saturation, which calculates the percentage of embedding values close to or ; and axis correlation that gives the maximum correlation between scenario axes.
We observe that layer 16 produces competitive scenario retrieval performance, with stronger scenario axis separation and lower representation saturation than deeper layers such as layer 30, as shown in Table 8 below. This observation aligns with recent work suggesting that structured semantic relation signals in LLMs often peak in intermediate layers rather than final generation-oriented layers [5]. Full layer-sweep diagnostics are reported in Appendix § 10.
| Metric | Layer 16 | Layer 20 | Layer 30 |
| Recall@1 | 0.770 | 0.798 | 0.518 |
| Eff. Rank | 24.41 | 22.80 | 7.08 |
| tanh Sat. | 4.33% | 15.42% | 92.24% |
| Axis Corr. | 0.60 | 0.80 | 0.94 |
Table 8. Layer-sweep diagnostics. Best results are highlighted
Larger triplet margins induce geometry-performance tradeoffs. We compare the default margin against while holding the architecture, training data, and inference protocol fixed. As in Table 9, increasing margin produces stronger centroid separation and improves GSM8K accuracy, but reduces performance on multi-turn and open-ended evaluation tasks. These results suggest that larger margins reshape the scenario geometry but does not uniformly improve generation quality.
| Metric | ||
| Geometry | ||
| Mean centroid cosine | 0.9496 | 0.7103 |
| Euclidean silhouette | 0.1835 | 0.2668 |
| Nearest-centroid agreement | 0.6940 | 0.8877 |
| Downstream | ||
| GSM8K Accuracy (%) | 65.28 | 66.41 |
| AlpacaEval LC-WR (%) | 30.03 | 25.54 |
| MT-Bench | 7.91 | 7.66 |
| GSM8K mean | 0.822 | 0.738 |
Table 9. Effect of the triplet-loss margin on scenario geometry and downstream performance. Full table can be found in Appendix § 13.
Conclusion
We propose Scenario-Actor, a sampling temperature selection framework that maps a hidden-state matrix to a structured scenario embedding and derives a sampling temperature from its geometry along interpretable scenario axes. Comparisons of Scenario-Actor with multiple baselines show strong goal-completion performance on AgentSense, significant improvements on AlpacaEval, and competitive results on MT-Bench. In addition, we see Scenario-Actor as a step toward socially adaptive language models. As LLMs become embedded in human society through multimodal agents and embodied systems, their ability to recognize the situations they are in will become increasingly important. We hope this framework allows models to better understand social context, emotional nuance, and the expectations that shape human communication in the future.
Limitations
LLM scenario is narrower than human scenario. Language models take only textual sequence as their input. In actual human-human interaction, scenarios are dependent on cues other than pure linguistic context. Therefore, current language models are still limited in their ability to fully integrate into all aspects of human interactions. The inference of scenario solely from linguistic context is itself insufficient. Compromise on task-only prompts. Scenario-Actor is designed for settings with rich scenario cues, such as multi-turn conversations. But in our dataset, we see a great amount of them being straightforward and utilitarian. Many prompts ask the model to directly solve problems such as writing code, answering math or providing general information. Such a characteristic makes scenario inference almost impossible as task-oriented prompts often contain little evidence for a social setting. For these prompts, a standalone selector can route the input to a standard task-specific decoding policy, which is independent of our framework. This setup is also a compromise to current LLM usage as the language model itself is limited in its interaction modality. We expect this limitation to be alleviated in multimodal or embodied agent settings, where models can access richer interactional cues and become more deeply integrated into human social environments.
Model and taxonomy scope. The current study establishes the results and claims merely on Llama-3.1-8B-Instruct with the nine-label, five-axis scenario taxonomy. In theory, however, our framework is expected to be applicable to other model families and scenario taxonomies, which, due to limited budget and computational power, require more evaluations.
Source balance. A key limitation of the current training data is that scenario labels are not fully balanced from data source. In an ideal setting, each scenario category would be represented across multiple corpora so that Scenarize would be forced to learn merely the scenario structure rather than dataset style. In practice, however, no available dataset covers all of our scenario labels with balanced coverage. We therefore rely on multiple supplementary sources. Developing a more balanced scenario dataset remains an important direction for future work.
Acknowledgments
We thank Professor Haifeng Xu at the University of Chicago and the anonymous reviewers for their valuable comments, as well as Professor Adam Meyers at New York University for his advice on publication. This work was conducted independently by the authors and received no institutional research funding by the time of submission.
Efficiency
| Method | Latency (ms/episode) | Peak memory (GiB) | Throughput | ||
| Allocated | Reserved | Output (tokens/s) | Request (episodes/s) | ||
| Scenario-Actor | 97,000 | 18.59 | 18.71 | 21.59 | 0.01031 |
| Greedy | 87,410 | 18.36 | 18.48 | 21.84 | 0.01144 |
| Fixed | 88,110 | 18.38 | 18.50 | 21.57 | 0.01135 |
| Nucleus () | 88,370 | 18.38 | 18.50 | 21.49 | 0.01132 |
| Random- | 87,340 | 18.38 | 18.50 | 21.59 | 0.01145 |
| EDT | 87,650 | 18.38 | 18.55 | 21.64 | 0.01141 |
Table 10. End-to-end efficiency over 245 AgentSense templates in 15-turn closed-loop interactions.
| Method | Latency (ms/prompt) | Peak memory (GiB) | Throughput | ||
| Allocated | Reserved | Output (tokens/s) | Request (prompts/s) | ||
| Scenario-Actor | 17,109 | 16.31 | 16.68 | 25.35 | 0.0584 |
| Greedy | 17,181 | 16.52 | 16.86 | 25.87 | 0.0582 |
| Fixed | 17,150 | 16.52 | 16.86 | 25.43 | 0.0583 |
| Nucleus () | 17,406 | 16.52 | 16.86 | 25.42 | 0.0575 |
| Random- | 17,284 | 16.52 | 16.86 | 25.42 | 0.0579 |
| EDT | 17,336 | 16.52 | 16.86 | 25.59 | 0.0577 |
Table 11. End-to-end efficiency over 805 AlpacaEval prompts.
| Method | Latency (ms/prompt) | Peak memory (GiB) | Throughput | ||
| Allocated | Reserved | Output (tokens/s) | Request (prompts/s) | ||
| Scenario-Actor | 16,917 | 15.22 | 15.54 | 25.26 | 0.0591 |
| Greedy | 16,513 | 15.19 | 15.26 | 25.75 | 0.0606 |
| Fixed | 17,128 | 15.19 | 15.54 | 25.24 | 0.0584 |
| Nucleus () | 16,845 | 15.19 | 15.26 | 25.29 | 0.0594 |
| Random- | 16,267 | 15.19 | 15.26 | 25.28 | 0.0615 |
| EDT | 16,957 | 15.24 | 21.99 | 25.41 | 0.0590 |
Table 12. End-to-end efficiency over 80 MT-Bench prompts.
Statistical Significance Testing
| Benchmark | Comparison | Difference | 95% CI | -value |
| AgentSense ( Goal completion) | Scenario-Actor vs Greedy | +4.33 pp. | [+1.55, +7.15] | |
| AgentSense ( Goal completion) | Scenario-Actor vs Fixed | +4.75 pp. | [+1.82, +7.76] | |
| AgentSense ( Goal completion) | Scenario-Actor vs Fixed | +2.14 pp. | [, +4.89] | |
| AgentSense ( Goal completion) | Scenario-Actor vs Fixed | +3.23 pp. | [+0.41, +6.11] | |
| AgentSense ( Goal completion) | Scenario-Actor vs Fixed | +10.26 pp. | [+6.97, +13.53] | |
| AgentSense ( Goal completion) | Scenario-Actor vs EDT | +3.44 pp. | [+0.50, +6.47] | |
| AgentSense ( Goal completion) | Scenario-Actor vs Nucleus | +4.58 pp. | [+1.41, +7.70] | |
| AgentSense ( Goal completion) | Scenario-Actor vs Random- | +3.16 pp. | [+0.40, +5.97] | |
| AgentSense ( Goal completion) | Scenario-Actor vs Class-conditioned | +4.79 pp. | [+1.85, +7.88] | |
| AlpacaEval ( LC-WR) | Scenario-Actor vs Greedy | +7.16 | [+3.14, +11.18] | |
| AlpacaEval ( LC-WR) | Scenario-Actor vs Fixed | +6.40 | [+2.48, +10.32] | |
| AlpacaEval ( LC-WR) | Scenario-Actor vs Fixed | +4.35 | [+0.43, +8.27] | |
| AlpacaEval ( LC-WR) | Scenario-Actor vs Fixed | +6.61 | [+2.89, +10.33] | |
| AlpacaEval ( LC-WR) | Scenario-Actor vs Fixed | +21.43 | [+16.63, +26.23] | |
| AlpacaEval ( LC-WR) | Scenario-Actor vs EDT | +4.45 | [+0.43, +8.47] | |
| AlpacaEval ( LC-WR) | Scenario-Actor vs Nucleus | +6.44 | [+2.62, +10.26] | |
| AlpacaEval ( LC-WR) | Scenario-Actor vs Random- | +9.59 | [+5.28, +13.90] | |
| AlpacaEval ( LC-WR) | Scenario-Actor vs Class-conditioned | +2.93 | [+0.55, +5.32] | |
| MT-Bench ( Score) | Scenario-Actor vs Greedy | +0.12 | [, +0.35] | |
| MT-Bench ( Score) | Scenario-Actor vs Fixed | +0.12 | [, +0.36] | |
| MT-Bench ( Score) | Scenario-Actor vs Fixed | +0.08 | [, +0.29] | |
| MT-Bench ( Score) | Scenario-Actor vs Fixed | +0.30 | [+0.05, +0.55] | |
| MT-Bench ( Score) | Scenario-Actor vs Fixed | +1.15 | [+0.79, +1.51] | |
| MT-Bench ( Score) | Scenario-Actor vs EDT | +1.17 | [+0.80, +1.54] | |
| MT-Bench ( Score) | Scenario-Actor vs Nucleus | +0.28 | [+0.05, +0.51] | |
| MT-Bench ( Score) | Scenario-Actor vs Random- | +0.20 | [+0.01, +0.39] | |
| MT-Bench ( Score) | Scenario-Actor vs Class-conditioned | +0.27 | [+0.02, +0.52] | |
| GSM8K ( Accuracy) | Scenario-Actor vs Greedy | [, ] | ||
| GSM8K ( Accuracy) | Scenario-Actor vs Fixed | [, ] | ||
| GSM8K ( Accuracy) | Scenario-Actor vs Fixed | [, ] | ||
| GSM8K ( Accuracy) | Scenario-Actor vs Fixed | +2.88 | [, +5.99] | |
| GSM8K ( Accuracy) | Scenario-Actor vs Fixed | +20.09 | [+16.83, +23.35] | |
| GSM8K ( Accuracy) | Scenario-Actor vs EDT | [, ] | ||
| GSM8K ( Accuracy) | Scenario-Actor vs Nucleus | +3.94 | [+0.76, +7.20] | |
| GSM8K ( Accuracy) | Scenario-Actor vs Random- | [, +2.73] |
Table 13. Statistical significance testing results on AgentSense, AlpacaEval, MT-Bench, and GSM8K. Differences are computed as Scenario-Actor minus the corresponding baseline.
Scenario Descriptions
| Scenario Label | Description |
| rigorous | Interactions centered on correctness, logical structure, technical precision, or verifiable reasoning. |
| institutional | Interactions organized around explicit roles, responsibilities, procedures, or task objectives. The respondent should help resolve the issue efficiently. |
| formal | Interactions where etiquette, tact, face-saving, and socially careful wording are central. |
| emotional_support_neg | Interactions in which the user expresses distress, worry, sadness, frustration, vulnerability, or seeks comfort. |
| adversarial | Interactions involving disagreement, critique, challenge, defense, debate, or pressure to justify a position. |
| emotional_support_pos | Interactions in which the user shares positive affect, appreciation, celebration, affection, or seeks a warm affirming response. |
| casual_conversation | Interactions that are low-stakes, socially light, and not primarily task-, role-, or problem-driven. |
| brainstorming | Interactions that ask for idea generation, alternatives, exploration, or open-ended ideation. |
| playful | Interactions that are primarily humorous, teasing, and entertaining. |
Table 14. Scenario labels and their corresponding communicative descriptions.
Layer Sweep and Geometric Diagnostics
| Layer | Recall@1 | Effective Rank | tanh Sat. | PCA@95% | Max Axis Offdiag | Collapse |
| 16 | 0.770 | 24.41 | 4.33% | 20 | 0.60 | acceptable |
| 20 | 0.798 | 22.80 | 15.42% | 16 | 0.80 | acceptable |
| 24 | 0.739 | 18.21 | 50.70% | 11 | 0.74 | moderate |
| 29 | 0.576 | 10.95 | 88.17% | 6 | 0.99 | severe |
| 30 | 0.518 | 7.08 | 92.24% | 4 | 0.94 | severe |
Table 15. Layer sweep diagnostics for scenario geometry. Collapse severity is assessed jointly from tanh saturation, effective rank, and axis off-diagonal correlation. Deeper layers exhibit increasing saturation, rank collapse, and axis degeneracy.
Agreements
| Metric | LLM-human | Human-human |
| Agreement (%) | 83.66 / 86.27 | 81.37 |
| Cohen’s | 0.82 / 0.85 | 0.79 |
| Macro Precision | 0.84 | 0.83 |
| Macro Recall | 0.84 | 0.80 |
| Macro F1 | 0.83 | 0.81 |
Table 16. LLM annotator validation, values are rounded to two decimal places
| Metric | LLM-human | Human-human |
| AE Agreement (%) | 86.00 / 86.00 | 80.00 |
| AE Cohen’s | 0.72 / 0.72 | 0.60 |
| MT Pearson | 0.92 / 0.86 | 0.87 |
| MT Spearman | 0.84 / 0.70 | 0.79 |
| MT MAE | 0.44 / 0.90 | 0.78 |
| AS Agreement (%) | 80.00 / 72.00 | 76.00 |
| AS Cohen’s | 0.48 / 0.27 | 0.40 |
Table 17. LLM judge validation, values are rounded to two decimal places.
Source Composition
Figure 6. Source composition by scenario.
Triplet-Margin Ablation
| Geometry metric | |||
| Mean pairwise centroid cosine | 0.9496 | 0.7103 | |
| Centered centroid cosine | 0.5258 | 0.5057 | |
| Centroid effective rank at 95% | 5 | 6 | +1 |
| Euclidean silhouette | 0.1835 | 0.2668 | +0.0833 |
| Nearest-centroid agreement | 0.6940 | 0.8877 | +0.1937 |
| tanh saturation () | 0.0938 | 0.0347 |
Table 18. Scenario geometry under two triplet-loss margins.
| Benchmark | Metric | |||
| GSM8K | Accuracy (%) | 65.28 | 66.41 | +1.13 |
| AlpacaEval | LC-WR (%) | 30.03 | 25.54 | |
| MT-Bench | GPT-4 score | 7.91 | 7.66 | |
| DailyDialog NextTurn | WR (%) | 49.70 | 46.94 | |
| DailyDialog ContextLen | WR (%) | 67.00 | 62.00 | |
| Diagnostic | ||||
| GSM8K | Mean selected | 0.822 | 0.738 |
Table 19. Downstream performance under two triplet-loss margins.
Computational Details
We keep the backbone model frozen and train only the Scenarize module, which maps the 4096-dimensional Llama hidden states into a 32-dimensional scenario embedding. All experiments run on a single NVIDIA A10G GPU with 24GB memory. The total computational budget, including hidden-state extraction, Scenarize training, layer sweeps, and evaluation runs, is approximately 125 A10G GPU-hours. This estimate excludes external API inference costs used for GPT-4o annotation and GPT-4-turbo evaluation.
Artifact licenses and terms of use.
We use Llama-3.1-8B-Instruct, WildChat, DailyDialog, ChangeMyView [22], SODA [10], EmpatheticDialogues [19], ESConv [15], OpenAssistant [12], Re² [25], DISAPERE [9], OpenReview review text4, Enron email corpus [11], GPT-4o, and GPT-4-turbo, and previously proposed decoding baselines in accordance with their respective licenses or terms of use. All datasets are used only for research purposes, and no attempt is made to redistribute restricted model weights or proprietary model outputs beyond aggregate experimental results.
References
- [1]Jisun An, Haewon Kwak, and Yong-Yeol Ahn. 2018. SemAxis: A lightweight framework to characterize semantic-specific word semantics beyond sentiment. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2450–2461, Melbourne, Australia. Association for Computational Linguistics.
- [2]Chung-Ching Chang, David Reitter, Renat Aksitov, and Yun-Hsuan Sung. 2023. KL-divergence guided temperature sampling. arXiv preprint arXiv:2306.01286.arxiv.org/abs/2306.01286
- [3]Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reichiro Nakano, Christopher Hesse, and John Schulman. 2021. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168.arxiv.org/abs/2110.14168
- [4]Shehzaad Dhuliawala, Ilia Kulikov, Ping Yu, Asli Celikyilmaz, Jason Weston, Sainbayar Sukhbaatar, and Jack Lanchantin. 2024. Adaptive decoding via latent preference optimization. arXiv preprint arXiv:2411.09661.arxiv.org/abs/2411.09661
- [5]Andor Diera and Ansgar Scherp. 2026. Do language models encode semantic relations? Probing and sparse feature analysis. In Proceedings of the Fifteenth Language Resources and Evaluation Conference, pages 2115–2126, Palma de Mallorca, Spain. ELRA Language Resource Association.
- [6]Yann Dubois, Balázs Galambosi, Percy Liang, and Tatsunori B. Hashimoto. 2024. Length-controlled AlpacaEval: A simple way to debias automatic evaluators. In Conference on Language Modeling (COLM).arxiv.org/abs/2404.04475
- [7]Aaron Grattafiori, Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Alex Vaughan, Amy Yang, Angela Fan, Anirudh Goyal, Anthony Hartshorn, Aobo Yang, Archi Mitra, Archie Sravan-kumar, Artem Kornev, Arthur Hinsvark, and 542 others. 2024. The Llama 3 herd of models. arXiv preprint arXiv:2407.21783.arxiv.org/abs/2407.21783
- [8]Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. 2020. The curious case of neural text degeneration. In International Conference on Learning Representations.
- [9]Neha Nayak Kennard, Tim O’Gorman, Rajarshi Das, Akshay Sharma, Chhandak Bagchi, Matthew Clinton, Pranay Kumar Yelugam, Hamed Zamani, and Andrew McCallum. 2022. DISAPERE: A dataset for discourse structure in peer review discussions. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1234–1249, Seattle, United States. Association for Computational Linguistics.
- [10]Hyunwoo Kim, Jack Hessel, Liwei Jiang, Peter West, Ximing Lu, Youngjae Yu, Pei Zhou, Ronan Le Bras, Malihe Alikhani, Gunhee Kim, Maarten Sap, and Yejin Choi. 2023. SODA: A Million-scale dialogue distillation with social commonsense contextualization. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 12930–12949, Singapore. Association for Computational Linguistics.arxiv.org/abs/2212.10465
- [11]Bryan Klimt and Yiming Yang. 2004. The Enron corpus: A new dataset for email classification research. In Machine Learning: ECML 2004, volume 3201, pages 217–226. Springer.DOI
- [12]Andreas Köpf, Yannic Kilcher, Dimitri von Rütte, Sotiris Anagnostidis, Zhi Rui Tam, Keith Stevens, Abdullah Barhoum, Duc Nguyen, Oliver Stanley, Richárd Nagyfi, Shahul ES, Sameer Suri, David Glushkov, Arnav Dantuluri, Andrew Maguire, Christof Schumann, Huu Nguyen, and Alexander Mattick. 2023. OpenAssistant conversations – democratizing large language model alignment. In Advances in Neural Information Processing Systems, volume 36, pages 47669–47681.arxiv.org/abs/2304.07327
- [13]Yanran Li, Hui Su, Xiaoyu Shen, Wenjie Li, Ziqiang Cao, and Shuzi Niu. 2017. DailyDialog: A manually labelled multi-turn dialogue dataset. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 986–995, Taipei, Taiwan. Asian Federation of Natural Language Processing.arxiv.org/abs/1710.03957
- [14]Yiwei Li, Fei Mi, Yitong Li, Yasheng Wang, Bin Sun, Shaoxiong Feng, and Kan Li. 2024. Dynamic stochastic decoding strategy for open-domain dialogue generation. In Findings of the Association for Computational Linguistics: ACL 2024, pages 11585–11596, Bangkok, Thailand. Association for Computational Linguistics.arxiv.org/abs/2406.07850
- [15]Siyang Liu, Chujie Zheng, Orianna Demasi, Sahand Sabour, Yu Li, Zhou Yu, Yong Jiang, and Minlie Huang. 2021. Towards emotional support dialog systems. 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), pages 3469–3483. Online. Association for Computational Linguistics.arxiv.org/abs/2106.01144
- [17]OpenAI. 2023. GPT-4 technical report. arXiv preprint arXiv:2303.08774.arxiv.org/abs/2303.08774
- [18]OpenAI. 2024. GPT-4o system card. arXiv preprint arXiv:2410.21276.
- [19]Hannah Rashkin, Eric Michael Smith, Margaret Li, and Y-Lan Boureau. 2019. Towards empathetic open-domain conversation models: A new benchmark and dataset. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5370–5381, Florence, Italy. Association for Computational Linguistics.arxiv.org/abs/1811.00207
- [20]John F. Rauthmann, David Gallardo-Pujol, Esther M. Guillaume, Elysia Todd, Christopher S. Nave, Ryne A. Sherman, Matthias Ziegler, Ashley Bell Jones, and David C. Funder. 2014. The situational eight DIAMONDS: A taxonomy of major dimensions of situation characteristics. Journal of Personality and Social Psychology, 107(4):677–718.DOI
- [21]Chufan Shi, Haoran Yang, Deng Cai, Zhishong Zhang, Yifan Wang, Yujiu Yang, and Wai Lam. 2024. A thorough examination of decoding methods in the era of LLMs. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 8601–8629, Miami, Florida, USA. Association for Computational Linguistics.arxiv.org/abs/2402.06925
- [22]Chenhao Tan, Vlad Niculae, Cristian Danescu-Niculescu-Mizil, and Lillian Lee. 2016. Winning arguments: Interaction dynamics and persuasion strategies in good-faith online discussions. In Proceedings of the 25th International Conference on World Wide Web, pages 613–624, Montréal, Québec, Canada. International World Wide Web Conferences Steering Committee.
- [23]Pei-Hsin Wang, Sheng-Lou Hsieh, Shih-Chieh Chang, Yu-Ting Chen, Jia-Yu Pan, Wei Wei, and Da-Chang Juan. 2020. Contextual temperature for language modeling. arXiv preprint arXiv:2012.13575.arxiv.org/abs/2012.13575
- [24]Gian Wiher, Clara Meister, and Ryan Cotterell. 2022. On decoding strategies for neural text generators. Transactions of the Association for Computational Linguistics, 10:997–1012.
- [25]Daoze Zhang, Zhijian Bao, Sihang Du, Zhiyi Zhao, Kuangling Zhang, Dezheng Bao, and Yang Yang. 2025. Re2: A consistency-ensured dataset for full-stage peer review and multi-turn rebuttal discussions. arXiv preprint arXiv:2505.07920.arxiv.org/abs/2505.07920
- [26]Hugh Zhang, Daniel Duckworth, Daphne Ippolito, and Arvind Neelakantan. 2021. Trading off diversity and quality in natural language generation. In Proceedings of the Workshop on Human Evaluation of NLP Systems (HumEval), pages 25–33, Online. Association for Computational Linguistics.arxiv.org/abs/2004.10450
- [27]Shimao Zhang, Yu Bao, and Shujian Huang. 2024. EDT: Improving large language models’ generation by entropy-based dynamic temperature sampling. arXiv preprint arXiv:2403.14541.arxiv.org/abs/2403.14541
- [28]Wenting Zhao, Xiang Ren, Jack Hessel, Claire Cardie, Yejin Choi, and Yuntian Deng. 2024. WildChat: 1M ChatGPT interaction logs in the wild. In The Twelfth International Conference on Learning Representations.
- [29]Yüqi Zhu, Jia Li, Ge Li, YunFei Zhao, Jia Li, Zhi Jin, and Hong Mei. 2024. Hot or cold? Adaptive temperature sampling for code generation with large language models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 38, pages 437–445.





