Papers
Topics
Authors
Recent
Search
2000 character limit reached

HumorPlanSearch: Context-Aware Joke Generation

Updated 8 July 2026
  • HumorPlanSearch is a modular pipeline that treats joke generation as a structured planning and search process focused on audience, cultural context, and novelty.
  • It integrates strategy planning, historical strategy retrieval using a knowledge graph, semantic novelty filtering, and iterative judge-led revisions to enhance humor quality.
  • The system achieves a 15.4% increase in Humor Generation Score over baselines, demonstrating improved contextualization, cultural tuning, and originality in joke creation.

HumorPlanSearch is a modular pipeline for automated humor generation with LLMs that treats joke writing as a structured problem of planning, contextual reasoning, retrieval, filtering, and revision rather than a single “prompt and sample” step. It is designed to generate jokes that are context-aware, culturally tuned, and non-repetitive by explicitly modeling topic, audience style, historical strategy reuse, and iterative evaluation. In the reported formulation, the pipeline combines Plan-Search for strategy generation, Humor Chain-of-Thought (HuCoT) templates, a knowledge graph of historical strategies, semantic novelty filtering, and a judge-driven revision loop, with quality assessed through the Humor Generation Score (HGS) (Dubey, 15 Aug 2025).

1. Problem setting and conceptual basis

HumorPlanSearch is motivated by the observation that standard LLM humor generation often produces jokes that feel generic, repetitive, or tone-deaf because humor is deeply situated and depends on the listener’s cultural background, mindset, and immediate context. The system therefore reframes humor generation as a structured planning and search problem in which multiple candidate strategies are explored, compared, and revised before final jokes are selected (Dubey, 15 Aug 2025).

In this formulation, “context” is multi-dimensional. It includes topic, cultural style, audience persona, emotional tone, and local discourse setting. A single prompt such as “Write a funny joke about startups for Indian Gen Z” does not force a model to reason systematically about audience, cultural references, style, and novelty. HumorPlanSearch addresses that limitation by separating strategy formation from wording, and by introducing explicit intermediate structures for cultural and stylistic reasoning (Dubey, 15 Aug 2025).

A closely related comprehension-side perspective appears in HumorBench, which defines “getting the joke” as requiring hypothesis formation and testing, backtracking, and multi-step reasoning over associations, constraints, and background knowledge. That work treats humor understanding as a planning/search process over interpretations rather than as a purely intuitive reaction. This suggests that HumorPlanSearch extends a broader research trend in which humor is modeled as structured reasoning rather than as unstructured text generation (Narad et al., 29 Jul 2025).

2. Pipeline architecture

HumorPlanSearch begins with a topic prompt and ends with a set of jokes plus their reasoning traces, ranked by HGS. The reported pipeline contains five stages: Plan-Search, HuCoT generation, novelty filtering, hybrid scoring, and judge-guided plan revision (Dubey, 15 Aug 2025).

Component Function Reported detail
Plan-Search Generate and combine humor strategies gemma2-9b-it; N=12N = 12 first-order strategies
Hybridization Build second-order strategies up to k×3k \times 3 hybrids, with k=3k = 3
Knowledge Graph Retrieve historical strategies persistent NetworkX graph
Novelty filtering Remove near-duplicate jokes all-MiniLM-L6-v2, cosine threshold $0.75$
Revision loop Improve weak strategies llama3-70b-8192, up to 2 iterations

A humor strategy is a semi-structured description of how to approach a topic comedically. It specifies style, humor mechanism, narrative elements, cultural references, and tone. The Strategy LLM produces N=12N = 12 distinct first-order strategies for each topic, then combines them in pairs to form second-order hybrids, up to a maximum of k×3k \times 3 hybrids with k=3k = 3. High-performing historical strategies are also retrieved from a persistent NetworkX knowledge graph and adapted to the current topic, then added to the active pool (Dubey, 15 Aug 2025).

The knowledge graph is represented conceptually as G=(V,E)G = (V, E), where nodes represent strategies or contexts and edges represent relations such as strategy–topic, strategy–style, and strategy–performance. Retrieved strategies are adapted by preserving their underlying humor structure while replacing topic-specific surface content. This provides a form of persistent memory rather than generating each joke from scratch (Dubey, 15 Aug 2025).

Novelty filtering is applied after joke generation. Each joke is embedded with all-MiniLM-L6-v2, and cosine similarity is used to detect semantic overlap. If the maximum similarity between a new joke and already retained jokes is at least $0.75$, the joke is discarded as insufficiently novel. With this threshold, about 18% of generated jokes are removed as being too similar (Dubey, 15 Aug 2025).

The revision stage operates at the strategy level. For each iteration, jokes are generated from the current strategy set, filtered for novelty, scored with HGS, aggregated back to per-strategy performance, and then revised if needed. Strategies are partitioned into

Slow={sPs<6.0}S_{\text{low}} = \{ s \mid P_s < 6.0 \}

and

k×3k \times 30

where k×3k \times 31 is the average HGS of jokes generated from strategy k×3k \times 32. Low-performing strategies are revised using judge suggestions, and revisions are applied only if projected improvement is at least k×3k \times 33. The default maximum number of iterations is 2 (Dubey, 15 Aug 2025).

3. Humor Chain-of-Thought and scoring

HuCoT, or Humor Chain-of-Thought, is the pipeline’s explicit reasoning format for joke construction. It is analogous to chain-of-thought prompting, but its steps are tailored to humor: audience modeling, cultural micro-context, narrative setup, humor device selection, and punchline construction. HuCoT is therefore not a generic logical scaffold; it is a domain-specific reasoning template for contextual comedy (Dubey, 15 Aug 2025).

Three HuCoT templates are defined. The Generic template has 8 steps and emphasizes universal comedic structures, timing, and punchline design. The Indian template has 6 steps and emphasizes cultural micro-context, shared experiences, and delivery. The Gen Z-Indian template has 7 steps and emphasizes dark reality, meme culture, and cultural code-switching (Dubey, 15 Aug 2025).

The evaluation metric is the Humor Generation Score, defined as

k×3k \times 34

The four signals are: direct vote scoring k×3k \times 35, multi-persona scoring k×3k \times 36, pairwise win-rate k×3k \times 37, and topic relevance k×3k \times 38. The paper does not provide the exact numerical values of the weights k×3k \times 39, but it does specify the structure of the weighted sum (Dubey, 15 Aug 2025).

Topic relevance is defined through cosine similarity between the joke embedding k=3k = 30 and the topic embedding k=3k = 31: k=3k = 32 The multi-persona component uses three evaluator personas—Enthusiastic Fan, Critical Critic, and Academic Analyst—to reduce single-perspective bias. Pairwise win-rate compares jokes head-to-head, and direct vote scoring uses a 1–5 judge rating. Together these signals define a hybrid metric intended to capture funniness, comparative strength, and topical fit (Dubey, 15 Aug 2025).

4. Experimental results and empirical behavior

The reported experiments cover 9 topics with feedback from 13 human judges of mixed cultural backgrounds, ages 20–45. Four system configurations are compared: Baseline, KG Only, Revision Only, and KG + Revision. The full configuration, combining knowledge graph retrieval and iterative revision, achieves the highest mean HGS across styles and topics (Dubey, 15 Aug 2025).

The headline result is a 15.4% increase in mean HGS over a strong baseline, with k=3k = 33, and the results are reported with 95% confidence intervals. The configuration study functions as an ablation: KG alone helps, Revision alone helps, and combining both yields the strongest overall result (Dubey, 15 Aug 2025).

The paper illustrates the contextual role of style with the topic “Startup Culture.” The Generic style produces jokes about “move fast and break things” in relationships and A/B testing dating life. The Indian style uses observational humor about office kitchen pizza battles, “ninja battle, yaar,” and developers optimizing pizza-snatching. The Gen Z-Indian style uses economic anxiety, “be a unicorn beta” versus “be a sloth, please,” and Indo-English code-switching. These examples are presented as evidence that the system changes not only wording but also underlying comedic framing across style templates (Dubey, 15 Aug 2025).

The reported failures are also informative. Some outputs remain generic, especially in the Generic HuCoT style. The system can still misread subtle cultural cues, and multi-step reasoning can produce overly elaborate jokes that lose punchiness. Smaller LLMs, such as models in the Llama3-8B class, perform notably worse for nuanced, context-rich humor. These results indicate that the pipeline improves contextualization without eliminating the underlying difficulty of humor generation (Dubey, 15 Aug 2025).

5. Relation to neighboring humor-reasoning frameworks

HumorPlanSearch belongs to a broader research program that treats humor as structured reasoning, explanation, and social interaction. HumorBench models humor comprehension as hypothesis formation, ambiguity detection, world-knowledge integration, and backtracking, using rubric-based evaluation over approximately 300 cartoon-caption pairs. Its central claim is that “getting the joke” requires planning/search over interpretations, constraints, and background knowledge. This suggests a comprehension-side analogue to HumorPlanSearch’s generation-side planning (Narad et al., 29 Jul 2025).

BottleHumor provides a multimodal explanation framework that is explicitly described as a planning-and-search procedure over implicit knowledge and candidate interpretations, guided by an information bottleneck objective. Its pipeline iteratively generates implications and candidate explanations, then selects non-redundant, explanation-supporting knowledge over multiple hops. This offers a different but compatible view of humor reasoning as search over knowledge snippets and explanation hypotheses (Hwang et al., 22 Feb 2025).

A separate line of work defines the Humor Reasoning Data Object as the quintuple

k=3k = 34

where k=3k = 35 is social dialogue or context, k=3k = 36 is the teller’s humorous attempt, k=3k = 37 is the receiver’s reaction, k=3k = 38 is the receiver’s explanation, and k=3k = 39 is the teller’s recovery response after humor failure. That formulation models humor as social interaction rather than as isolated joke text. This suggests that HumorPlanSearch could be extended from strategy planning for single jokes to planning over broader interactional structures, including reactions, appropriateness, and repair (Arnett et al., 24 May 2026).

Large-scale caption-preference work on New Yorker contests provides a complementary empirical substrate: over 250 million human ratings on more than 2.2 million captions, together with ranking-based evaluation protocols. That literature reports that RLHF and DPO expose important limitations on creative tasks, and that even strong models such as GPT4 and Claude underperform top human contestants. This supports the view that humor generation remains a difficult ranking-and-search problem even when very large preference datasets are available (Zhang et al., 2024).

6. Limitations, misconceptions, and future directions

HumorPlanSearch does not claim that humor can be reduced to a single scalar or a universally valid style template. Its central design assumption is narrower: that context can be foregrounded at each stage from strategy planning to evaluation, and that this improves coherence, topicality, and cultural fit relative to undifferentiated prompting (Dubey, 15 Aug 2025).

A common misconception is that the system is primarily a joke-sampling pipeline with minor reranking. The reported design is more structured than that. Strategy generation, hybridization, knowledge-graph retrieval, HuCoT prompting, novelty filtering, and revision all operate as distinct modules. The system therefore treats humor generation as a staged search process rather than as one-pass decoding (Dubey, 15 Aug 2025).

Its limitations are explicit. The human evaluation involves only 13 judges, which constrains generalizability. HGS is an automated metric and has not yet been correlated with live audience reactions. The experiments are computationally expensive because they require multiple large-model calls, embedding computation, and knowledge-graph operations. The paper also notes that it does not specify a formal toxicity filter, although HuCoT includes appropriateness reasoning and judge personas can be prompted to penalize culturally insensitive jokes (Dubey, 15 Aug 2025).

The stated future directions include pilot deployments in open-mic or stand-up comedy clubs, a simulated comedy room based on live performance data, domain-specific humor engines for games and therapeutic chatbots, meta-learning HuCoT so that a smaller model can generate reasoning steps dynamically, reinforcement learning using judge signals as rewards, more direct human-in-the-loop revision, study of decoding effects such as temperature and sampling, and extension of PlanSearch ideas to stories and poetry (Dubey, 15 Aug 2025).

Taken together, HumorPlanSearch defines a research agenda in which humor generation is organized around explicit strategy search, culturally conditioned reasoning templates, persistent memory of prior successes, semantic novelty control, and iterative judgment. In that respect it is both a concrete system architecture and a specific formulation of contextual humor generation as a planning problem (Dubey, 15 Aug 2025).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to HumorPlanSearch.