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.
Figures & tables
Figure 1: AgentSense goal-outcome flip rate (top) and goal completion score (bottom) by changing temperature.
Figure 2
Figure 4: The Scenarize module.
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 T=0.5
0.7540
23.63
7.79
Fixed T=0.7
0.7801
25.68
7.83
Fixed T=1.0
0.7692
23.42
7.61
Table 1: Benchmark results comparing Scenario-Actor with fixed-temperature and adaptive decoding baselines. Best results are highlighted .
Scenario Label
τi+/τi−
rigorous
0.30
institutional
0.50
formal
0.55
emotional_support_neg
0.65
adversarial
0.75
emotional_support_pos
1.00
Table 2: Scenario labels and their endpoint temperatures.
Figure 5: PCA (left) and UMAP (right) of scenario embedding geometry.
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 r
0.92 / 0.86
0.87
MT Spearman ρ
0.84 / 0.70
0.79
AS Agreement
80.00 / 72.00
76.00
Table 3: Agreement between LLM-based evaluators and human annotators. Values are rounded to two decimal places. Detailed validation metrics are reported in Appendix E .
Baseline
GSM8K
Metric
Accuracy (%)
Scenario-Actor
65.28
Greedy
77.18
Fixed T=0.5
69.52
Fixed T=0.7
69.07
Fixed T=1.0
62.40
Table 4: GSM8K results comparing Scenario-Actor with fixed-temperature and adaptive decoding baselines. The best result is highlighted .
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%
Table 5: GSM8K scenario count
Scenario Centroid
Cosine Similarity
adversarial
0.9765
institutional
0.9710
rigorous
0.9684
brainstorming
0.9510
playful
0.9499
casual_conversation
0.9463
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
Baseline
Benchmark
Scenario-Actor
Class-conditioned T
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 .
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
Metric
β=0.3
β=1.0
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
Table 9: Effect of the triplet-loss margin on scenario geometry and downstream performance. Full table can be found in Appendix G .
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 T=0.5
88,110
18.38
18.50
21.57
0.01135
Nucleus ( p=0.95 )
88,370
18.38
18.50
21.49
0.01132
Random- T
87,340
18.38
18.50
21.59
0.01145
Table 10: End-to-end efficiency over 245 AgentSense templates in 15-turn closed-loop interactions.
Benchmark
Comparison
Statistical significance
Difference
95% CI
p -value
AgentSense ( Δ Goal completion)
Scenario-Actor vs Greedy
+4.33 pp.
[+1.55,+7.15]
2.44×10−3
Scenario-Actor vs Fixed T=0.5
+4.75 pp.
[+1.82,+7.76]
1.72×10−3
Scenario-Actor vs Fixed T=0.7
+2.14 pp.
[−0.54,+4.89]
1.22×10−1
Scenario-Actor vs Fixed T=1.0
+3.23 pp.
[+0.41,+6.11]
2.63×10−2
Scenario-Actor vs Fixed T=1.5
+10.26 pp.
[+6.97,+13.53]
8.73×10−10
Table 13: Statistical significance testing results on AgentSense, AlpacaEval, MT-Bench, and GSM8K. Differences are computed as Scenario-Actor minus the corresponding baseline.
Table 14: Scenario labels and their corresponding communicative descriptions.
Figure 6: Source composition by scenario.
Geometry metric
β=0.3
β=1.0
Δ
Mean pairwise centroid cosine
0.9496
0.7103
−0.2393
Centered centroid cosine
0.5258
0.5057
−0.0201
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.95 )
0.0938
0.0347
−0.0591
Table 18: Scenario geometry under two triplet-loss margins.