shawhed commited on
Commit
341023c
Β·
verified Β·
1 Parent(s): 3f3cb2f

Report measured control fidelity and story->review domain transfer

Browse files
Files changed (1) hide show
  1. README.md +64 -20
README.md CHANGED
@@ -34,25 +34,16 @@ Two things make it unusual:
34
 
35
  - **Continuous, not categorical.** Most sentiment-controlled generation offers
36
  you `positive` / `negative` / `neutral`. SenseShift takes a *number* β€” 21
37
- points on a 0.1 grid from βˆ’1.0 to +1.0. Sweeping the target over one sentence
38
- of the example below, holding everything else fixed:
39
 
40
  | target | achieved | rewritten sentence |
41
  | ---: | ---: | --- |
42
- | βˆ’1.0 | +0.0 | He said hello and took our order. |
43
- | βˆ’0.9 | βˆ’0.8 | He looked sad and we felt bad. |
44
- | βˆ’0.6 | βˆ’0.6 | He was very tired from working hard. |
45
- | βˆ’0.3 | +0.0 | He said hello and took our order. |
46
- | +0.0 | +0.0 | He served us some food and drinks. |
47
- | +0.3 | +0.3 | We ordered a salad and shared it. |
48
- | +0.6 | +0.5 | He smiled and gave us our drinks. |
49
- | +0.9 | +0.8 | He smiled and thanked us for coming. |
50
- | +1.0 | +0.8 | He smiled and thanked us for coming. |
51
-
52
- The trend is monotone and most targets land within 0.1–0.2, but the control is
53
- not exact: `βˆ’1.0` and `βˆ’0.3` both missed here, and the saturated ends (`Β±1.0`)
54
- tend to collapse onto their `Β±0.9` neighbours. Treat the dial as a strong
55
- steer, not a guarantee β€” and check `out.achieved_sentiment` if you need one.
56
  - **The generator is an encoder.** Text generation is nearly always
57
  autoregressive decoding. SenseShift generates by iteratively filling masked
58
  positions in a bidirectional ModernBERT, so every token it writes is
@@ -149,13 +140,66 @@ Steps 1–4 live in the `senseshift` package, not in the weights β€” the checkpo
149
  itself is a stock `ModernBertForMaskedLM` and can be loaded with
150
  `AutoModelForMaskedLM` if you want to build your own decoding loop.
151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  ## Limitations
153
 
154
- - English only; trained on short narrative and review-style text.
 
155
  - VADER supplies the sentiment labels, so the model inherits its lexicon-based
156
- view of sentiment. `achieved_sentiment` usually lands within 0.1–0.2 of the
157
- target, but individual targets can miss outright β€” see the sweep above. The
158
- saturated ends (`Β±1.0`) are the least reliable.
 
159
  - The rewrite is length-bounded by `num_masks`, so very long sentences are
160
  usually replaced by something shorter.
161
  - Because the whole passage is re-encoded per mask fill, generation cost grows
 
34
 
35
  - **Continuous, not categorical.** Most sentiment-controlled generation offers
36
  you `positive` / `negative` / `neutral`. SenseShift takes a *number* β€” 21
37
+ points on a 0.1 grid. Sweeping one sentence of a story, everything else fixed:
 
38
 
39
  | target | achieved | rewritten sentence |
40
  | ---: | ---: | --- |
41
+ | βˆ’0.9 | βˆ’0.7 | The water was bitter and made him sick. |
42
+ | βˆ’0.6 | βˆ’0.4 | The water was bitter and made him cough. |
43
+ | +0.0 | +0.0 | The water was cold and made him wet. |
44
+ | +0.6 | +0.7 | The water was clear and tasted very good. |
45
+ | +0.9 | +0.8 | His friends laughed and played games with him. |
46
+
 
 
 
 
 
 
 
 
47
  - **The generator is an encoder.** Text generation is nearly always
48
  autoregressive decoding. SenseShift generates by iteratively filling masked
49
  positions in a bidirectional ModernBERT, so every token it writes is
 
140
  itself is a stock `ModernBertForMaskedLM` and can be loaded with
141
  `AutoModelForMaskedLM` if you want to build your own decoding loop.
142
 
143
+ ## Control fidelity, and how far it transfers
144
+
145
+ Measured over 50 held-out passages per domain, 9 targets each, rewriting one
146
+ randomly chosen sentence. "Achieved" is VADER on the sentence the model wrote.
147
+
148
+ | target | achieved β€” stories *(in-domain)* | achieved β€” reviews *(out-of-domain)* |
149
+ | ---: | ---: | ---: |
150
+ | βˆ’0.9 | βˆ’0.40 | βˆ’0.44 |
151
+ | βˆ’0.6 | βˆ’0.23 | βˆ’0.25 |
152
+ | βˆ’0.3 | βˆ’0.14 | βˆ’0.04 |
153
+ | +0.0 | +0.09 | +0.01 |
154
+ | +0.3 | +0.22 | +0.14 |
155
+ | +0.6 | +0.53 | +0.47 |
156
+ | +0.9 | +0.75 | +0.73 |
157
+ | **MAE** | **0.33** | **0.33** |
158
+
159
+ Two things to read off this.
160
+
161
+ **The response is monotone and the positive half is well calibrated** β€” targets
162
+ of +0.6 and +0.9 land within about 0.15. The negative half is compressed: ask
163
+ for βˆ’0.9 and you reliably get *more negative*, but around βˆ’0.4 rather than βˆ’0.9.
164
+
165
+ **Domain transfer is essentially free.** SenseShift-large was trained only on
166
+ short children's stories, yet product reviews β€” a domain it never saw, with
167
+ different vocabulary, register and length β€” come out at an identical MAE of
168
+ 0.33. The per-target curve is the same shape. Use it outside the story domain
169
+ with reasonable confidence.
170
+
171
+ ## Training data and usable range
172
+
173
+ Trained on TinyStories-style children's stories, labelled per sentence with
174
+ VADER. That corpus is lopsided, which directly shapes what the model can do:
175
+
176
+ | sentiment of training sentences | share |
177
+ | --- | ---: |
178
+ | negative (< 0) | 15.3% |
179
+ | neutral (= 0) | 37.8% |
180
+ | positive (> 0) | 47.0% |
181
+ | exactly βˆ’1.0 | **0.00%** |
182
+ | exactly +1.0 | 0.10% |
183
+
184
+ So:
185
+
186
+ - **Use targets in βˆ’0.8 … +0.9.** The `[-1.0]` control token appears *zero*
187
+ times in training and `[1.0]` almost never; asking for Β±1.0 gives an
188
+ undertrained token and unpredictable output. `-1.0` in particular comes back
189
+ near-neutral.
190
+ - **Negative control is looser than positive**, because negative sentences are
191
+ a third as common in the corpus. For strongly negative text, ask for βˆ’0.9 and
192
+ expect roughly βˆ’0.4, or resample.
193
+
194
  ## Limitations
195
 
196
+ - English only; trained on short children's stories, though it transfers to
197
+ other domains at no measured cost (see above).
198
  - VADER supplies the sentiment labels, so the model inherits its lexicon-based
199
+ view of sentiment.
200
+ - Control is a steer, not a guarantee: MAE 0.33 over the grid, with the negative
201
+ half compressed and `Β±1.0` unusable. Single generations are noisy β€” check
202
+ `out.achieved_sentiment` and resample if you need a specific value.
203
  - The rewrite is length-bounded by `num_masks`, so very long sentences are
204
  usually replaced by something shorter.
205
  - Because the whole passage is re-encoded per mask fill, generation cost grows