# Humor Embeddings: Laughter from Inverted Memory — Bisociation in Computational Embedding Space: v4.7 → v4.8

From v4.7 (2 Jun) to v4.8 (14 Jun): 12,586 words to 14,619 words, 2,033 words in new or rewritten paragraphs and 0 taken out, 19 paragraphs changed.

## Change note of v4.8

**Outside measurements on the same embedding model; gate as an invariant**

Brings in outside evidence measured on the same small embedding model the pilot used. Structural signals such as novelty and clause incongruity scored well (AUROC 0.875 and 0.896), while a trained head for harm scored below chance (0.286). The paper uses this to support its surprise term and to warn that its harm filter is the weaker part. The folder's improvement notes from 13 June ask for both changes.

- New section on two nearby agent-engineering projects that use the same embedding model.
- The sensitivity filter is now stated as an enforcement floor that no path can bypass, separate from its accuracy.
- The filter's accuracy is to be reported as its own measured number.
- A caution against learned versions of the score.

## Changed paragraphs

Marks: [-removed-] {+added+}.

### Abstract

We present a formal computational framework for humor generation that operationalizes Koestler's (1964) bisociation theory as geometry in vector embedding spaces. The central claim is that humor and memory retrieval are dual operations on the same semantic machinery: memory retrieves what lies nearest to a query; humor searches for what lies at the right distance and can still be joined by an unexpectedly valid bridge. We formalize this *memory-humor correspondence* and define a computable humor potential function $h(A, B, \beta)$ grounded in Suls' (1972) two-stage incongruity-resolution model. We identify 12 humor-generating semantic patterns organized into five meta-categories, each defined as a specific embedding-space operation, and propose humor associations as a first-class relationship type in agent memory architectures. A preliminary computational pilot ($n = 15$ concept triplets) falsifies the initial formulation, revealing that naive coherence conflates semantic proximity with comedic validity. This negative result motivates a revised surprise-weighted formulation ($h_{\text{v2}}$) that decomposes bridge quality into independent validity and surprise components. We situate the framework within Attardo and Raskin's (1991) General Theory of Verbal Humor, McGraw and Warren's (2010) Benign Violation Theory, and Hurley, Dennett, and Adams' (2011) computational account of humor. We provide reproducible experimental protocols with power analysis ($N \geq 64$ raters, $\alpha = 0.05$, power $= 0.80$) for validation against human ratings. {+Independent measurements on the same frozen 384-dimensional sentence-embedding substrate this framework runs on—reported in a separate offline study of an agent-safety subsystem—find that structural channels over that substrate carry real discriminative signal (a clause-cosine incongruity channel, the geometric primitive at the core of this framework, reaches AUROC 0.896), whereas a supervised head trained on the same frozen embeddings to predict a semantic property collapses below chance; we use that split to bound which parts of our pipeline the substrate can be trusted to carry.+} The framework is designed as the affective layer of a larger agent architecture: it draws its concept neighborhoods from a semantic-memory index and is gated by a persona layer that decides when humor is appropriate—the computational counterpart of the limbic reward circuit that makes humor feel good in humans.

### 2.7 Adjacent Agent Systems on the Same Substrate

{+### 2.7 Adjacent Agent Systems on the Same Substrate+}

### 2.7 Adjacent Agent Systems on the Same Substrate

{+Two contemporary agent-engineering efforts bear directly on this framework, not because they study humor, but because they exercise the *same* frozen-embedding substrate and the *same* enforcement questions on which our design depends. We treat them as first-class related work rather than implementation footnotes, because they supply the closest available external evidence for two of our load-bearing choices.+}

### 2.7 Adjacent Agent Systems on the Same Substrate

{+The first is a sibling agent-safety subsystem (Serra, 2026; J11/amygdala v3.1), which builds an affective gate for an agent out of structural channels over the identical frozen `all-MiniLM-L6-v2` encoder this framework uses. Its offline validation phase is, to our knowledge, the most relevant external measurement of what that substrate can carry: structural channels (k-NN novelty, clause-cosine incongruity) score AUROC $0.875$–$0.896$, while a supervised head trained on the same frozen features to predict a higher-order semantic property scores below chance ($0.286$). We draw on these numbers throughout—positively for the surprise/incongruity geometry at the core of $h_{\text{v2}}$ (Section 7.1.1) and cautiously for the sensitivity gate, whose harm judgment sits in the failed-head regime (Section 5.5). The same subsystem also supplies the enforcement lesson that hardens Section 5.3: a gate wired as advisory rather than as a non-bypassable deny floor silently never fired despite "running first."+}

### 2.7 Adjacent Agent Systems on the Same Substrate

{+The second is the line of work on reversible context compression for agent memory (the "headroom" approach to lossless, recoverable CCR compression). It is relevant to Section 8's proposal that humor associations live in an append-only event store: that store is exactly the kind of long-horizon memory that reversible compression is designed to keep recoverable under context pressure. Where headroom compresses to *preserve* recall, the humor-association store records discrepancies to *invert* recall (Definition 1); both treat the persistent memory log, not the live context window, as the durable substrate for cross-session learning—here, cross-session humor calibration (Section 8.7). The differentiation is honest and narrow: headroom is a compression mechanism over the memory channel, not a humor mechanism, and we cite it only for the substrate it shares with our association store, not for any comedic capability.+}

### 3.2 Justification of the Multiplicative Form

{+A specific caution attaches to the learned variant. As Section 7.1.1 discusses, the same frozen 384-dimensional substrate this framework runs on has been measured to carry geometric channels (distance, rank, incongruity) with strong AUROC but to fail badly when a supervised head is trained on those frozen features to predict a higher-order semantic property (AUROC 0.286, below chance, in an external same-substrate study). The inputs to $h_{\text{learn}}$ here are the geometric quantities that channel works—so a thin learned combiner over $d$, $v$, and $\sigma$ is on safer ground than a head that tries to regress funniness directly from raw embeddings. But any version of $h_{\text{learn}}$ that asks a frozen-encoder head to recover comedic aptness as a learned property, rather than to reweight already-geometric components, inherits that below-chance warning and should not be adopted without either unfreezing the encoder or moving to a stronger embedding model from the ablation set (Section 7.4).+}

### 3.4 Extended Formulation with Audience and Timing

**Context gating.** Familiarity governs whether the audience *can* parse a joke; a separate decision governs whether a joke is *appropriate at all*. A good comedian reads the room—the same joke that kills at a comedy club bombs at a funeral. The humor potential function does not make that judgment; it presumes humor is already welcome. In an agent, the judgment is delegated to a persona layer: the agent's persona state determines whether humor is contextually appropriate. A persona configured for empathetic support suppresses humor during serious conversations, while one configured for casual banter enables it. The persona layer sets a `humor_enabled` flag for the context; the framework supplies humor only when that flag is true. This gating prevents tone-deaf jokes, and it is distinct from the sensitivity gate of Section 5, which screens the *content* of a joke once humor is permitted rather than deciding *whether* to be [-funny.-] {+funny. These are two separate enforcement points—one decides whether to be funny at all, the other screens content once humor is permitted—and, as Section 5.3 makes precise, both must be non-bypassable rather than advisory: a `humor_enabled = false` flag that the generation path can route around is no different from having no persona gate at all.+}

### 5.3 Integration

{+**The gate is an enforcement floor, not merely a pre-step (invariant).** Writing $h_{\text{safe}}$ as a piecewise function that "precedes" scoring is necessary but not sufficient. The substantive claim is an enforcement claim: a candidate that fails the gate must be *unable* to be embedded, scored, or emitted by any path in the generation pipeline—not merely placed earlier in a dataflow diagram. The distinction is load-bearing, and a deployment experience outside this framework makes the failure mode concrete. In a sibling agent-safety subsystem, a gate that was wired as *advisory*—it returned a block signal that the surrounding host did not actually honor under a permissive execution mode—silently never fired, even though it logically "ran before" the action it was meant to stop; it began enforcing only once it was relocated to a native deny floor that the host was obligated to obey. Abstracted away from that subsystem, the lesson is general: a humor-suppression gate is a safety mechanism only if it sits at a layer the generation path cannot bypass. "Logically precedes scoring" and "cannot be skipped at deployment" are different properties, and only the second one buys safety. We therefore state the gate's placement as an invariant of any conforming implementation: the sensitivity gate, together with the persona-layer `humor_enabled` check of Section 3.4, are the two non-bypassable enforcement points of the pipeline, and a candidate that fails either is never embedded, scored, ranked, or returned.+}

### 5.3 Integration

{+This enforcement guarantee is a separate property from the gate's *accuracy*, which Section 5.5 hedges and Section 7.5 measures (the SGA metric). A gate can be perfectly enforced and still wrong; what the invariant guarantees is only that when the gate decides to suppress, the suppression actually takes effect.+}

### 5.5 Limitations of the Sensitivity Gate

{+There is a further, substrate-level caution specific to running this gate on frozen contrastive embeddings. The gate asks cosine-to-prototype distance—a geometric channel—to stand in for a *semantic harm judgment*. The geometric channel itself is the kind that the same frozen substrate carries well: an external same-substrate study (Section 7.1.1) measured prototype-distance-style structural channels at AUROC $0.875$–$0.896$. But *harm* and *benignity* are precisely the higher-order semantic property that the same study found a frozen-encoder head unable to recover at all (AUROC $0.286$, below chance), and connotative/affective coverage is the exact weakness Section 9.2 already flags in this embedding class. The gate's expected operating point is therefore closer to that failed-property regime than to the reliable geometric regime, even though it is mechanically a distance computation. The honest consequence is that the gate's accuracy must not be assumed to inherit the framework's geometric reliability: it should be reported as a *separately measured* channel (the SGA metric, Section 7.5), held to its own empirical bar, and—per Section 5.3—treated as a conservative enforcement floor whose value comes from non-bypassability and conservative defaults rather than from precise harm discrimination.+}

### 7.1.1 Revised Formulation: Surprise-Weighted Humor Potential

{+**External same-substrate evidence for the structural channels.** The surprise term defined above is a *structural* channel: it reads off rank and distance geometry from the frozen `all-MiniLM-L6-v2` space without training any new parameters. There is now independent evidence, on this exact embedding model, that structural channels of this kind carry real discriminative signal rather than noise. A separate offline study—the validation phase of an agent-safety subsystem (Serra, 2026, J11/amygdala v3.1), run on the identical frozen 384-dimensional MiniLM encoder—measured three channels and found that they split cleanly by *type*. Two purely structural/geometric channels worked: a $k$-nearest-neighbor novelty channel reached AUROC $0.875$, and a clause-cosine incongruity channel—the cosine separation between two semantic units, which is the same geometric primitive that $d(A,B)$ and the midpoint-rank construction here are built from—reached AUROC $0.896$. A *supervised learned head* trained on the same frozen embeddings to predict a higher-order semantic property (harmfulness) failed at AUROC $0.286$, below chance, and was discontinued on the strength of that measurement. The decisive contrast is between *channel types on a shared substrate*: distance, rank, and incongruity geometry are discriminative on frozen MiniLM; a learned semantic-property head over the same frozen features is not.+}

### 7.1.1 Revised Formulation: Surprise-Weighted Humor Potential

{+This bears on the present framework in three concrete ways. First, it raises the surprise term's justification above from "motivated by an information-theoretic analogy" to "an instance of a channel class measured discriminative on the identical encoder." Second, the $0.896$ clause-cosine incongruity figure is the closest external hit, because cosine incongruity between two semantic units is precisely this paper's core primitive used generatively rather than as a classifier—a strong external signal that the geometry the pilot relied on is the right geometry, even though our pilot ($n=15$) was far too small to establish it. Third, it sharpens the dimensionality argument of Section 9.2: the $n \geq 384$ recommendation is now backstopped by the observation that this 384-dimensional space sustains $0.875$–$0.896$ structural AUROCs. We are careful about what this evidence does *not* do: it validates the substrate's structural channels, not our generative use of them, and not the funniness predictions of $h_{\text{v2}}$, which remain to be tested by the human protocol of Section 7.2. The study measured classification AUROC; this framework decomposes the same structural signal into validity $\times$ surprise and uses it to *generate* candidates—a use the external study never makes.+}

### 7.5 Proposed Metrics

{+SGA warrants separate emphasis. For the reasons given in Section 5.5, the sensitivity gate must be evaluated as its own measured channel and not assumed to inherit the predictive reliability of the geometric humor pipeline: harm/benignity is the dimension a frozen contrastive embedding space represents worst, so SGA should be reported with its own confidence interval and never folded into HPR or treated as validated by the framework's structural results. A high HPR does not license trust in the gate; SGA must clear its own bar independently.+}

### 8.7 Emergent Phenomena

- **Cold-to-warm start.** New agents begin with pattern-based generation (Section 4). As associations accumulate, the agent shifts toward memory-augmented generation with calibrated confidence. - **Callback automation.** Humor associations with timestamps make callbacks straightforward—query for bridges that landed, are not overused, and fall within the callback sweet spot (Section 3.5). - **Inside jokes emerge naturally.** Repeated successful bridges for the same audience become inside jokes without any special mechanism—just high humor confidence plus shared history. This formalizes Flamson and Barrett's (2008) encryption theory: inside jokes are bridges with high audience-specific confidence and low general-audience confidence. - **Transfer learning.** A bridge that succeeds with multiple audiences gains universal confidence; audience-specific bridges remain personalized. - **Cross-session persistence.** Because humor associations live in the persistent event store rather than in transient conversation state, they survive across sessions, enabling long-term humor [-memory.-] {+memory. This places the burden on the memory channel rather than the live context window, which is the same design pressure that motivates reversible context compression (Chopra, 2026): a humor association is worthless if it is silently dropped when the context is compacted, so the store should be one whose entries are recoverable under compression rather than merely summarized away.+}

### 9.2 Embedding Model Dependence

1. **Semantic compositionality.** The space must represent compositional relationships (analogy arithmetic works), not merely distributional co-occurrence. 2. **Connotative coverage.** Embeddings trained on encyclopedic text may poorly represent the connotative, cultural, and emotional dimensions humor exploits. A model trained primarily on Wikipedia may not distinguish "meeting" (neutral event) from "meeting" (dreaded workplace ritual). 3. **Sufficient dimensionality.** In low-dimensional spaces, concentration of measure compresses distances, reducing dynamic range. We recommend $n \geq 384$ based on our [-pilot.-] {+pilot. This floor is no longer supported by our pilot alone: an external same-substrate study (Section 7.1.1) found that this exact 384-dimensional MiniLM space sustains structural-channel AUROCs of $0.875$–$0.896$, which is direct evidence that 384 dimensions are *enough* for the distance/rank/incongruity geometry this framework depends on—while leaving open whether higher-dimensional models improve absolute humor prediction, which the ablation tests.+}

### 9.2 Embedding Model Dependence

{+A sharper version of requirement 2 also follows from that study. The connotative gap is not a uniform weakness of the space; it is specifically the *learned-semantic-property* dimension that fails. On the same frozen substrate, geometric channels score well above $0.85$ while a supervised head asked to recover a higher-order semantic property (harmfulness) fell below chance ($0.286$). The framework should therefore lean on the space for what it does well—distance, rank, incongruity geometry—and treat any component that asks the frozen space to judge a connotative or affective property (most acutely the sensitivity gate, Section 5.5; and any learned variant $h_{\text{learn}}$, Section 3.2) as operating in the regime where the substrate is least reliable.+}

### 9.6 Sensitivity Gate Limitations

[-Ethical filtering relies on category matching and audience modeling, both imperfect. The conservative default biases toward false positives (blocking benign content). See Section 5.5.-]

### 9.6 Sensitivity Gate Limitations

{+Ethical filtering relies on category matching and audience modeling, both imperfect. The conservative default biases toward false positives (blocking benign content). See Section 5.5. Two further qualifications follow from the discussion there. First, the gate's *enforcement* and its *accuracy* are independent properties: Section 5.3 states enforcement as a non-bypassability invariant, but a perfectly enforced gate can still be wrong, and on a frozen contrastive substrate the harm/benignity judgment is exactly the property class that space represents worst. Second, because the gate's accuracy is therefore expected to be its weakest dimension, it must be measured on its own (SGA, Section 7.5) rather than assumed to share the geometric reliability of the rest of the pipeline.+}

### References

- Aggarwal, C. C., Hinneburg, A. & Keim, D. A. (2001). On the surprising behavior of distance metrics in high dimensional space. _ICDT_. - Amin, M. & Burghardt, M. (2020). A survey on approaches to computational humor generation. _Proceedings of the International Conference on Computational Creativity (ICCC)_. - Attardo, S. & Raskin, V. (1991). Script theory revis(it)ed: Joke similarity and joke representation model. _Humor: International Journal of Humor Research_, 4(3–4), 293–347. - Baker, C. F., Fillmore, C. J. & Lowe, J. B. (1998). The Berkeley FrameNet project. _COLING-ACL_. - Bertero, D. & Fung, P. (2016). A long short-term memory framework for predicting humor in dialogues. _NAACL-HLT_. - Binsted, K. & Ritchie, G. (1994). An implemented model of punning riddles. _AAAI_. - Bowdle, B. F. & Gentner, D. (2005). The career of metaphor. _Psychological Review_, 112(1), 193–216. - Chen, P.-Y. & Soo, V.-W. (2018). Humor recognition using deep learning. _NAACL-HLT_. {+- Chopra, T. (2026). _Headroom: Reversible Context Compression for Agent Memory_ (chopratejas/headroom). Open-source software project.+} - Coulson, S. (2001). _Semantic Leaps: Frame-Shifting and Conceptual Blending in Meaning Construction_. Cambridge University Press. - Dubitzky, W., Kötter, T., Schmidt, O. & Berthold, M. R. (2012). Towards creative information exploration based on Koestler's concept of bisociation. _Bisociative Knowledge Discovery_. Springer. - Dynel, M. (2009). Beyond a joke: Types of conversational humour. _Language and Linguistics Compass_, 3(5), 1284–1299. - Flamson, T. & Barrett, H. C. (2008). The encryption theory of humor: A knowledge-based mechanism of honest signaling. _Journal of Evolutionary Psychology_, 6(4), 261–281. - Glucksberg, S. (2001). _Understanding Figurative Language: From Metaphors to Idioms_. Oxford University Press. - Gorwa, R., Binns, R. & Katzenbach, C. (2020). Algorithmic content moderation: Technical and political challenges in the automation of platform governance. _Big Data & Society_, 7(1). - He, H., Peng, N. & Liang, P. (2019). Pun generation with surprise. _NAACL-HLT_. - Hossain, N., Krumm, J. & Gamon, M. (2019). "President Vows to Cut \<Taxes\> Hair": Dataset and analysis of creative text editing for humorous headlines. _NAACL-HLT_. - Hossain, N., Krumm, J., Gamon, M. & Kautz, H. (2020). SemEval-2020 Task 7: Assessing humor in edited news headlines. _SemEval_. - Hurley, M. M., Dennett, D. C. & Adams, R. B. (2011). _Inside Jokes: Using Humor to Reverse-Engineer the Mind_. MIT Press. - Kao, J. T., Levy, R. & Goodman, N. D. (2016). A computational model of linguistic humor in puns. _Cognitive Science_, 40(5), 1270–1285. - Koestler, A. (1964). _The Act of Creation_. Hutchinson & Co. - Krippendorff, K. (2011). Computing Krippendorff's alpha-reliability. _Annenberg School for Communication Departmental Papers_. - Luo, F., et al. (2019). Pun-GAN: Generative adversarial network for pun generation. _EMNLP_. - Martin, R. A. (2007). _The Psychology of Humor: An Integrative Approach_. Elsevier Academic Press. - McGraw, A. P. & Warren, C. (2010). Benign violations: Making immoral behavior funny. _Psychological Science_, 21(8), 1141–1149. - Mihalcea, R. & Strapparava, C. (2005). Making computers laugh: Investigations in automatic humor recognition. _HLT/EMNLP_. - Mikolov, T., et al. (2013). Efficient estimation of word representations in vector space. _arXiv:1301.3781_. - Oring, E. (2003). _Engaging Humor_. University of Illinois Press. - Pereira, F. C., et al. (2019). Computational creativity and bisociative concept blending. _Cognitive Computation_. - Petrović, S. & Matthews, D. (2013). Unsupervised joke generation from big data. _ACL_. - Radford, A., et al. (2021). Learning transferable visual models from natural language supervision. _ICML_. - Raskin, V. (1985). _Semantic Mechanisms of Humor_. D. Reidel Publishing. - Reimers, N. & Gurevych, I. (2019). Sentence-BERT: Sentence embeddings using Siamese BERT-networks. _EMNLP_. - Ritchie, G. (2004). _The Linguistic Analysis of Jokes_. Routledge. - {+Serra, O. (2026). _A Validated Affective Gate for Agents: Structural Novelty and Incongruity Channels over Frozen Sentence Embeddings_ (J11 / amygdala v3.1 offline study). Internal J-series technical report. -+} Stock, O. & Strapparava, C. (2003). HAHAcronym: Humorous agents for humorous acronyms. _Humor_, 16(3), 297–314. - Suls, J. M. (1972). A two-stage model for the appreciation of jokes and cartoons: An information-processing analysis. In J. H. Goldstein & P. E. McGhee (Eds.), _The Psychology of Humor_. Academic Press. - Tian, Y., et al. (2022). A survey on humor recognition: Methods, challenges, and resources. _ACM Computing Surveys_. - Veale, T. (2016). _The Shape of Wit: Computational Models of Creative Metaphor_. Springer. - Vershynin, R. (2018). _High-Dimensional Probability_. Cambridge University Press. - Vrticka, P., Black, J. M. & Reiss, A. L. (2013). The neural basis of humour processing. _Nature Reviews Neuroscience_, 14(12), 860–868. - Warren, C. & McGraw, A. P. (2016). Differentiating what is humorous from what is not. _Journal of Personality and Social Psychology_, 110(3), 407–430. - Weller, O. & Seppi, K. (2019). Humor detection: A transformer gets the last laugh. _EMNLP_. - West, R. & Horvitz, E. (2019). Reverse-engineering satire, or "Paper on computational humor accepted despite making conditions for rejection". _AAAI_. - Winters, T., Nys, V. & De Schreye, D. (2021). Computers learning humor. _Proceedings of the International Conference on Computational Creativity (ICCC)_. - Yang, D., et al. (2015). Humor recognition and humor anchor extraction. _EMNLP_. - Yu, Z., et al. (2018). A neural approach to pun generation. _ACL_.
