% ---------------------------------------------------------
% Self-contained ACL-format paper for SemEval-2026 Task 1
% Copy this file + Images/ folder to Overleaf ACL template
% (which provides acl.sty and acl_natbib.bst)
% ---------------------------------------------------------

% Embedded bibliography — written automatically at compile time
\begin{filecontents}[overwrite]{references.bib}
@article{attardo1991,
  author    = {Attardo, Salvatore and Raskin, Victor},
  title     = {Script Theory Revis(it)ed: Joke Similarity and Joke Representation Model},
  journal   = {Humor: International Journal of Humor Research},
  volume    = {4},
  number    = {3--4},
  pages     = {293--347},
  year      = {1991}
}
@book{attardo2001,
  author    = {Attardo, Salvatore},
  title     = {Humorous Texts: A Semantic and Pragmatic Analysis},
  publisher = {Mouton de Gruyter},
  address   = {Berlin},
  year      = {2001}
}
@inproceedings{stock2003,
  author    = {Stock, Oliviero and Strapparava, Carlo},
  title     = {Getting Serious about the Development of Computational Humor},
  booktitle = {Proceedings of IJCAI 2003},
  pages     = {59--64},
  year      = {2003}
}
@inproceedings{hessel2023,
  author    = {Hessel, Jack and Marasovi\'{c}, Ana and Hwang, Jena D. and Lee, Lillian and Da, Jeff and Zellers, Rowan and Mankoff, Robert and Choi, Yejin},
  title     = {Do Androids Laugh at Electric Sheep? {Humor} ``Understanding'' Benchmarks from {The} {New} {Yorker} Caption Contest},
  booktitle = {Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics},
  pages     = {688--714},
  year      = {2023}
}
@article{zhang2025,
  author    = {Zhang, Jiajun and Luo, Shijia and Zhang, Ruikang and Su, Qi},
  title     = {{HUMORCHAIN}: Dual-Bridge Humor Generation with Multi-step Reasoning and Inference-Time Scaling},
  journal   = {arXiv preprint arXiv:2504.04538},
  year      = {2025}
}
@book{toplyn2014,
  author    = {Toplyn, Joe},
  title     = {Comedy Writing for Late-Night TV},
  publisher = {Twenty Lane Media},
  year      = {2014}
}
@inproceedings{caffagni2024,
  author    = {Caffagni, Davide and Cocchi, Federico and others},
  title     = {The Revolution of Multimodal Large Language Models: A Survey},
  booktitle = {Findings of the Association for Computational Linguistics: ACL 2024},
  year      = {2024},
  note      = {arXiv:2401.04252}
}
@book{raskin1985,
  author    = {Raskin, Victor},
  title     = {Semantic Mechanisms of Humor},
  publisher = {D. Reidel Publishing Company},
  address   = {Dordrecht},
  year      = {1985}
}
@inproceedings{wei2022,
  author    = {Wei, Jason and Wang, Xuezhi and Schuurmans, Dale and Bosma, Maarten and Ichter, Brian and Xia, Fei and Chi, Ed and Le, Quoc and Zhou, Denny},
  title     = {Chain-of-Thought Prompting Elicits Reasoning in Large Language Models},
  booktitle = {Proceedings of NeurIPS 2022},
  year      = {2022}
}
@inproceedings{khattab2023,
  author    = {Khattab, Omar and Singhvi, Arnav and Maheshwari, Paridhi and Zhang, Zhiyuan and Santhanam, Keshav and Vardhamanan, Sri and Haq, Saiful and Sharma, Ashutosh and Joshi, Thomas T. and Mober, Hanna and others},
  title     = {{DSPy}: Compiling Declarative Language Model Calls into Self-Improving Pipelines},
  booktitle = {Proceedings of ICLR 2024},
  year      = {2024}
}
@inproceedings{zheng2023,
  author    = {Zheng, Lianmin and Chiang, Wei-Lin and Sheng, Ying and Zhuang, Siyuan and Wu, Zhanghao and Zhuang, Yonghao and Lin, Zi and Li, Zhuohan and Li, Dacheng and Xing, Eric and others},
  title     = {Judging {LLM}-as-a-Judge with {MT-Bench} and {Chatbot Arena}},
  booktitle = {Proceedings of NeurIPS 2023},
  year      = {2023}
}
@misc{berri2024,
  author    = {{BerriAI}},
  title     = {{LiteLLM}: Call All {LLM} {API}s Using the {OpenAI} Format},
  year      = {2024},
  url       = {https://github.com/BerriAI/litellm}
}
@techreport{gemma2025,
  author    = {{Gemma Team, Google DeepMind}},
  title     = {Gemma 3 Technical Report},
  institution = {Google DeepMind},
  year      = {2025},
  note      = {arXiv:2503.19786}
}
@misc{google2025,
  author    = {{Google}},
  title     = {Gemini {API} Documentation},
  year      = {2025},
  url       = {https://ai.google.dev/docs}
}
@misc{nvidia2025,
  author    = {{NVIDIA}},
  title     = {Nemotron-Nano-{VL} Technical Report},
  year      = {2025},
  note      = {arXiv:2511.03929}
}
@inproceedings{semeval2026mwahaha,
  author    = {Castro, Santiago and Chiruzzo, Luis and G{\'o}ngora, Santiago and Rahili, Salar and Deng, Naihao and Sastre, Ignacio and Amoroso, Victoria and Rey, Guillermo and Ros{\'a}, Aiala and Moncecchi, Guillermo and Meaney, J. A. and Prada, Juan Jos{\'e} and Mihalcea, Rada},
  title     = {{SemEval}-2026 Task 1: {MWAHAHA}, Models Write Automatic Humor And Humans Annotate},
  booktitle = {Proceedings of the 20th International Workshop on Semantic Evaluation (SemEval-2026)},
  year      = {2026}
}
\end{filecontents}

% ============================================================
\documentclass[11pt]{article}

% Change "review" to "final" for camera-ready
\usepackage{acl}

\usepackage{times}
\usepackage{latexsym}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{array}
\usepackage{enumitem}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{adjustbox}
\usetikzlibrary{positioning, calc}

\lstset{
  language=Python,
  basicstyle=\ttfamily\footnotesize,
  keywordstyle=\bfseries,
  stringstyle=\color{gray},
  breaklines=true,
  frame=single,
  numbers=none,
  aboveskip=6pt,
  belowskip=6pt,
  xleftmargin=4pt,
  xrightmargin=4pt
}

% Convenience
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}

\title{j10official at SemEval-2026 Task 1: Neurosymbolic Humor Generation\\via GTVH-Guided LLM Decomposition}

\author{Jatin Agrawal \\
  IIIT Hyderabad \\
  {\small \texttt{jatin.agrawal@research.iiit.ac.in}} \\\And
  Radhika Mamidi \\
  IIIT Hyderabad \\
  {\small \texttt{radhika.mamidi@iiit.ac.in}}}

\begin{document}
\maketitle

% ============================================================
\begin{abstract}
We present a neurosymbolic pipeline for computational humor generation grounded in the General Theory of Verbal Humor. The system constructs the joke in five sequential stages: context analysis, humor architecture (identifying core incongruity), delivery strategy, content writing, and pairwise judging, orchestrated through the DSPy framework. The system generates four candidate jokes per input with independent humor strategies, then selects the best through knockout tournament-style evaluation. Despite using Gemma~3 27B, a model with roughly $20\times$ fewer total parameters than frontier systems, our approach achieves competitive results across all five subtasks of SemEval-2026 Task~1 (MWAHAHA), placing 2nd in two subtasks. We argue that these results demonstrate the viability of structured, theory-driven decomposition for solving complex tasks and that how a model reasons about humor is just as important as how large the model is.
\end{abstract}

% ============================================================
\section{Introduction}

Computational humor generation remains one of the most demanding problems in natural language generation. Unlike tasks such as summarization or translation, humor requires the coordinated construction of incongruity, surprise, timing, and stylistic control. LLMs inherently struggle with this as they are trained to maximize next-token probability, whereas humor often depends on strategically violating expectations. Just as raw cognitive capacity does not make every human a comedian, strong general reasoning in LLMs does not automatically yield strong humor without explicit comedic structure.

Accordingly, humor generation should not be treated as a single decoding problem. Core objectives such as constructing incongruity, preserving coherence, calibrating tone, and timing the punchline are partially competing, and attempting to optimize them simultaneously can lead to generative interference. To address this challenge, we decompose humor generation into modular components inspired by the General Theory of Verbal Humor (GTVH) \citep{attardo1991,attardo2001}. By operationalizing GTVH’s six Knowledge Resources (Situation, Target, Logical Mechanism, Script Opposition, Narrative Strategy, and Language) as dedicated stages within a unified pipeline, we transform the open-ended instruction ``write a funny joke'' into a sequence of constrained, interpretable subtasks. This separation of structural reasoning from surface realization reduces interference and enables more controlled humor construction.

We evaluate this approach in SemEval-2026 Task~1, MWAHAHA (\emph{Models Write Automatic Humor And Humans Annotate}) \cite{semeval2026mwahaha}, which spans five subtasks across three languages and two modalities under strict novelty constraints. Using the same architecture and underlying model across all subtasks, our system ranks 2nd on Task~A (Chinese) and Task~B2 (GIF + prompt completion), and 4th on Task~A (English) and Task~B1. These results are competitive with a baseline based on prompting Gemini~2.5~Flash, a substantially larger commercial model, suggesting that explicit structural decomposition can partially mitigate scale disadvantages in creative NLG. Code and all intermediate outputs are publicly available at \url{https://github.com/J10Official/Semeval2026_Task1}.

% ============================================================
\section{Background}

\subsection{Task Definition}

SemEval-2026 Task~1 (MWAHAHA) \cite{semeval2026mwahaha} evaluates humor generation across text-only and multimodal settings using human preference judgments with Elo-based ranking. The task consists of two categories:

\paragraph{Task A: Text-Based Humor.}
Given textual constraints, systems generate a joke in the target language:
(i) news headline-inspired humor, or 
(ii) word-constrained humor requiring the inclusion of two specified terms. 
Task~A is conducted in English, Spanish, and Chinese.

\paragraph{Task B: Multimodal Humor.}
Given a GIF, systems either generate a humorous caption (B1) or complete a fill-in-the-blank prompt (B2), subject to short length constraints.

\subsection{Related Work}

\paragraph{General Theory of Verbal Humor (GTVH).}
Our pipeline is fundamentally grounded in the GTVH \citep{attardo1991,attardo2001}, which extends Raskin's Semantic Script Theory \citep{raskin1985} and characterizes jokes through six hierarchical Knowledge Resources (KRs): Situation, Target, Logical Mechanism, Script Opposition, Narrative Strategy, and Language. While previous computational humor works often leave these resources latent within a model's internal representations during end-to-end generation, we explicitly operationalize these KRs as deterministic, typed computational modules using DSPy signatures. This approach bridges theoretical linguistics and neurosymbolic NLP, ensuring every generated joke possesses a valid structural incongruity and a verifiable cognitive resolution strategy before actual text is realized.

\paragraph{Generative Humor in the LLM Era.}
Early computational humor relied on rigid templates \citep{attardo1991,stock2003}; LLMs shifted the paradigm toward end-to-end generation but frequently default to generic patterns, struggling with the high-context ``understanding'' humor requires \citep{hessel2023}. In multimodal settings, where visual understanding itself remains an open challenge for large models \citep{caffagni2024}, grounding humor in visual cues is particularly difficult \citep{hessel2023}. We address this by explicitly modeling the reasoning process rather than relying on latent model capabilities.

\paragraph{Structured Reasoning and Decomposition.}
Chain-of-Thought prompting \citep{wei2022} elicits stronger reasoning in complex tasks; humor-specific approaches like \textit{HumorChain} \citep{zhang2025} and structured comedy-writing methodologies \citep{toplyn2014} further show that decomposing humor into discrete steps outperforms single-turn prompting. We extend this line by implementing decomposition not as prompts but as modular, typed signatures within DSPy \citep{khattab2023}.

% ============================================================
\section{System Overview}


\subsection{Design Philosophy}

Our design follows a neurosymbolic perspective. The symbolic layer is defined by a fixed module decomposition, typed interfaces, and alignment with the six GTVH knowledge resources. This layer specifies \emph{what} reasoning steps must occur, while neural components determine \emph{how} each step is realized linguistically.

Structure therefore precedes realization. The system separately models contextual setup, incongruity design, narrative strategy, and final joke writing. Multiple candidate jokes are generated and compared through tournament based judging to select the strongest output. Each module operates under explicit constraints, reducing cross-objective interference during generation.

By disentangling these components, the pipeline mitigates common failure modes of monolithic decoding, such as generic humor unanchored to the input, premature punchlines, and over-explicit explanations. Humor generation is thus implemented as a sequence of structured, theory-aligned decisions rather than a single generative step.
% ============================================================

\subsection{Architecture}

The pipeline consists of five stages, implemented as typed DSPy Signatures, with Modules~2--4 instantiated in four parallel branches per input (see Figure~\ref{fig:architecture}; a complete walkthrough with intermediate outputs is provided in Appendix~\ref{sec:pipeline-walkthrough}). The same architecture is reused across all five subtasks; only the signature descriptions vary by task. This design isolates performance gains to architectural structure and controlled diversification rather than increased model scale or heterogeneous ensembling. Importantly, diversity arises at the level of humor mechanisms and narrative strategies rather than surface-level rewording.

\begin{figure}[t]
\centering
\resizebox{\columnwidth}{!}{%
\begin{tikzpicture}[
  block/.style={draw, rectangle, rounded corners=2pt, minimum height=0.7cm, align=center, font=\small, inner sep=4pt},
  arr/.style={->, >=stealth, thick}
]
\node[block, minimum width=5.5cm] (input) {Input (headline, words, or GIF)};
\node[block, minimum width=5.5cm, below=0.5cm of input] (ce) {1. ContextEnricher (SI, TA)};
\draw[arr] (input) -- (ce);

\node[block, below left=0.8cm and 2.2cm of ce] (ha1) {2. HA};
\node[block, below left=0.8cm and 0.6cm of ce] (ha2) {2. HA};
\node[block, below right=0.8cm and 0.6cm of ce] (ha3) {2. HA};
\node[block, below right=0.8cm and 2.2cm of ce] (ha4) {2. HA};
\foreach \i in {1,2,3,4} { \draw[arr] (ce) -- (ha\i); }

\node[block, below=0.35cm of ha1] (ds1) {3. DS};
\node[block, below=0.35cm of ha2] (ds2) {3. DS};
\node[block, below=0.35cm of ha3] (ds3) {3. DS};
\node[block, below=0.35cm of ha4] (ds4) {3. DS};
\foreach \i in {1,2,3,4} { \draw[arr] (ha\i) -- (ds\i); }

\node[block, below=0.35cm of ds1] (cw1) {4. CW};
\node[block, below=0.35cm of ds2] (cw2) {4. CW};
\node[block, below=0.35cm of ds3] (cw3) {4. CW};
\node[block, below=0.35cm of ds4] (cw4) {4. CW};
\foreach \i in {1,2,3,4} { \draw[arr] (ds\i) -- (cw\i); }

\node[block, minimum width=5.5cm, below=0.8cm of $(cw2)!0.5!(cw3)$] (judge) {5. HumorJudge (Tournament)};
\foreach \i in {1,2,3,4} { \draw[arr] (cw\i) -- (judge); }

\node[block, minimum width=5.5cm, below=0.5cm of judge] (winner) {Winning Joke};
\draw[arr] (judge) -- (winner);
\end{tikzpicture}%
}
\caption{System architecture. Module~1 runs once per input; Modules~2--4 run in four parallel branches; Module~5 selects the winner via single-elimination tournament. HA\,=\,HumorArchitect, DS\,=\,DeliveryStrategist, CW\,=\,ContentWriter.}
\label{fig:architecture}
\end{figure}

\paragraph{Module 1: ContextEnricher (GTVH: Situation, Target).}
The ContextEnricher analyzes the raw input to extract factual subtext, implicit assumptions, and cultural context. It produces typed outputs: \texttt{situation} (elaboration of the input's factual reality and subtext) and \texttt{semantic\_associations} (cultural references and properties linked to key terms)---that are consumed as structured inputs by all downstream modules. This module runs \textbf{once per input}, ensuring all candidate jokes are grounded in a consistent factual understanding.

\paragraph{Module 2: HumorArchitect (GTVH: Logical Mechanism, Script Opposition).}
The HumorArchitect designs the cognitive mechanism that makes the joke work without writing the actual prose. Its DSPy signature requires generating multiple typed outputs, which include \texttt{focal\_targets} (pivot concepts), \texttt{cognitive\_manipulation} (a specific instruction on how to execute the semantic twist), \texttt{logical\_mechanism} (assigning a formal GTVH label such as False Analogy or Garden Path), \texttt{expected\_script} and \texttt{opposing\_script} (the normal expectation vs.\ the surprise reality), and the overarching \texttt{script\_opposition} (the incongruity axis). This module is instantiated four times in parallel using a \texttt{ThreadPoolExecutor}, each instance producing an independent humor strategy. Variation across branches arises from independent stochastic decoding under identical prompts to guarantee diversity at the conceptual mechanism level rather than just surface rewording.

\paragraph{Module 3: DeliveryStrategist (GTVH: Narrative Strategy).}
Determines \emph{how} to perform the humor. The Strategist consumes the Architect's logical blueprint, outputting a \texttt{strategic\_analysis} (justifying why a specific format suits the generated mechanism), chooses a \texttt{narrative\_strategy} (e.g., Dialogue, One-Liner, Fake News), and defines a \texttt{language\_style} (e.g., Dry/Cynical, Deadpan). The incongruity logic (Module 2) and the narrative packaging (Module 3) are treated as strictly orthogonal decisions.

\paragraph{Module 4: ContentWriter (GTVH: Language).}
Executes the joke, transforming the structural blueprint into prose. It receives all upstream outputs plus language-specific \textbf{writing guidelines}---general comedic craft principles (economy of language, setup misdirection, commitment to the bit) that are domain-general rather than tuned on task data (see Appendix~\ref{sec:guidelines}). Outputs include \texttt{draft\_setup}, \texttt{draft\_punchline}, and \texttt{final\_joke}. The explicit draft-then-polish structure encourages the model to separate logical construction from surface polish.

\paragraph{Module 5: HumorJudge (Selection).}
The four candidates are evaluated through a \textbf{single-elimination tournament}: two parallel semi-finals, then a final (three comparisons vs.\ six for a full round-robin). We use pairwise comparison rather than absolute scoring because LLMs are more reliable at relative preference judgments than at assigning calibrated humor scores \citep{zheng2023}. The judge receives language-specific \textbf{evaluation criteria} as a structured input field (see Appendix~\ref{sec:guidelines}).

\noindent Table~\ref{tab:gtvh-mapping} summarizes the alignment between GTVH Knowledge Resources and pipeline modules.

\begin{table}[t]
\centering\small
\begin{tabular}{lll}
\toprule
\textbf{GTVH KR} & \textbf{Module} & \textbf{Function} \\
\midrule
Situation      & ContextEnricher    & Factual grounding \\
Target         & ContextEnricher    & Humor targets \\
Log.\ Mech.   & HumorArchitect     & Cognitive twist \\
Script Opp.    & HumorArchitect     & Incongruity \\
Narr.\ Strat. & DeliveryStrategist & Format \& voice \\
Language       & ContentWriter      & Surface text \\
\bottomrule
\end{tabular}
\caption{Mapping of GTVH Knowledge Resources to pipeline modules.}
\label{tab:gtvh-mapping}
\end{table}

\subsection{Multimodal Extension (Task B)}
\label{sec:multimodal}

For GIF-based tasks, a preprocessing step converts GIFs into rich textual descriptions using \textbf{Nemotron Nano 12B VL} \citep{nvidia2025}, a vision-language model accessed via OpenRouter. The process is: (1)~download the GIF; (2)~convert GIF to MP4 via \texttt{ffmpeg}; (3)~analyze the video with task-specific prompts that extract subjects, actions, expressions, and setting details (see Appendix~\ref{sec:gif-prompt}). No humor reasoning is performed during preprocessing; the vision model produces purely descriptive output.

For Task~B2, the fill-in-the-blank prompt is included in the vision model's instructions so that the description is contextualized. These descriptions are cached and fed into the same five-module pipeline used for text-based tasks.

\subsection{DSPy Implementation}
\label{sec:dspy-impl}

Each module is implemented as a \texttt{dspy.Signature} class with typed \texttt{InputField}s and \texttt{OutputField}s, preventing downstream modules from bypassing upstream reasoning steps (Table~\ref{tab:signature-fields} details the comprehensive output fields mapped from the GTVH resources for each individual stage). A single \texttt{UnifiedHumorPipeline} class loads task-specific signatures from a registry and routes data through the same module sequence---no architecture change or manual tuning is needed, only system prompt specialization.

\begin{table*}[t]
\centering\small
\begin{tabular}{llll}
\toprule
\textbf{Module} & \textbf{Output Field} & \textbf{Type} & \textbf{Description} \\
\midrule
ContextEnricher    & \texttt{situation}             & \texttt{str}        & Factual reality and subtext elaboration \\
ContextEnricher    & \texttt{semantic\_associations} & \texttt{list[str]}  & Cultural references and associations \\
\midrule
HumorArchitect     & \texttt{focal\_targets}         & \texttt{str}        & Pivot concepts for the joke \\
HumorArchitect     & \texttt{cognitive\_manipulation} & \texttt{str}       & One-sentence twist instruction \\
HumorArchitect     & \texttt{logical\_mechanism}      & \texttt{str}       & GTVH label \\
HumorArchitect     & \texttt{expected\_script}        & \texttt{str}       & Normal expectation \\
HumorArchitect     & \texttt{opposing\_script}        & \texttt{str}       & Surprise reality \\
HumorArchitect     & \texttt{script\_opposition}      & \texttt{str}       & \emph{[A] vs.\ [B]} format \\
\midrule
DeliveryStrategist & \texttt{strategic\_analysis}     & \texttt{str}       & Format compatibility analysis \\
DeliveryStrategist & \texttt{narrative\_strategy}     & \texttt{str}       & Chosen delivery format \\
DeliveryStrategist & \texttt{language\_style}         & \texttt{str}       & Voice/register \\
\midrule
ContentWriter      & \texttt{draft\_setup}            & \texttt{str}       & Joke build-up \\
ContentWriter      & \texttt{draft\_punchline}        & \texttt{str}       & Joke reveal \\
ContentWriter      & \texttt{final\_joke}             & \texttt{str}       & Polished complete joke \\
\midrule
HumorJudge         & \texttt{critique}               & \texttt{str}       & Comparative analysis \\
HumorJudge         & \texttt{better\_joke}            & \texttt{Literal}   & Tournament winner (``Joke~1'' or ``Joke~2'') \\
\bottomrule
\end{tabular}
\caption{All typed output fields per module.}
\label{tab:signature-fields}
\end{table*}

\subsection{Constraint Satisfaction}

Task~A2 requires that both specified words appear in the generated joke. We implement a deterministic post-generation validator using flexible regex matching: case-insensitive, word-boundary-aware matching for alphabetic languages; substring matching for Chinese; and support for common morphological variants (e.g., plurals, verb forms, possessives). Candidates failing validation are excluded from the tournament. If all candidates fail, the system proceeds with judging rather than regenerating to avoid additional latency. Character limits (900 for EN/ES, 300 for ZH) and word-count constraints ($\leq$20 for Task~B) are enforced deterministically.
% ============================================================
\section{Experimental Setup}

We use the official MWAHAHA evaluation data without modification (Table~\ref{tab:data}). No training data is provided by design, and the system uses no labeled humor data.

\begin{table}[t]
\centering\small
\begin{tabular}{llrl}
\toprule
\textbf{Subtask} & \textbf{Lang.} & \textbf{Items} & \textbf{Input Type} \\
\midrule
A (en) & English  & 300 & Headlines + word pairs \\
A (es) & Spanish  & 300 & Headlines + word pairs \\
A (zh) & Chinese  & 300 & Headlines + word pairs \\
B1     & English  & 300 & GIF URLs \\
B2     & English  & 300 & GIF URLs + prompts \\
\bottomrule
\end{tabular}
\caption{Official evaluation data.}
\label{tab:data}
\end{table}

The primary LLM is Gemma~3 27B IT \citep{gemma2025}, accessed via the OpenRouter API in bf16 precision. For Task~B (vision), we use Nemotron Nano 12B VL. The system is implemented in DSPy v2.4+ with LiteLLM \citep{berri2024} for unified API access. All modules use default decoding parameters; no hyperparameter tuning was performed. LLM caching is explicitly disabled (\texttt{litellm.cache = None}) to ensure independent stochastic generations across parallel branches.

Generation uses 4-way parallel branch sampling per item and up to 8-way parallel item processing via \texttt{ThreadPoolExecutor}. API failures are handled via a custom \texttt{@with\_retry} decorator tracking specific error types (e.g., rate limits vs. transient parses), with exponential backoff (5s~$\to$~120s) and explicit \texttt{ChatAdapter} enforcement for Gemma models to accommodate JSON mode incompatibilities.

Systems are evaluated via human pairwise preference judgments with Elo-based ranking on a Chatbot Arena-style leaderboard.
% ============================================================
\section{Results}

\subsection{Official Rankings}

Table~\ref{tab:elo} presents the official Elo scores. The shared task baseline (Gemini~2.5 Flash with simple, task-specific single-turn prompts) is provided by the organizers.

\begin{table}[t]
\centering\small
\begin{tabular}{lccc}
\toprule
\textbf{Subtask} & \textbf{Baseline Elo} & \textbf{Our Elo} & \textbf{Rank} \\
\midrule
A (en) & 1081 & 1005 & 4th \\
A (es) & 1140 & 1015 & 6th \\
A (zh) & 1053 & 1016 & \textbf{2nd} \\
B1     & 1124 &  994 & 4th \\
B2     & 1022 &  993 & \textbf{2nd} \\
\bottomrule
\end{tabular}
\caption{Official Elo scores and rankings. Baseline is Gemini~2.5 Flash (ranks 1st on all subtasks).}
\label{tab:elo}
\end{table}

Our system achieves Elo scores within 37--125 points of the baseline, placing \textbf{2nd} on Task~A~(zh) ($\Delta$\,=\,37) and Task~B2 ($\Delta$\,=\,29). Three observations contextualize these results:

\begin{itemize}[nosep]
  \item \textbf{Parameter efficiency.} Gemma~3 27B ($\sim$27B parameters) competes with Gemini~2.5 Flash ($>$200B effective parameters), suggesting that structured reasoning can partially compensate for an order-of-magnitude scale gap.
  \item \textbf{Architectural uniformity.} The same five-module pipeline is used for all subtasks; only the DSPy signature descriptions vary. Results therefore reflect the general effectiveness of GTVH-guided decomposition rather than task-specific engineering.
  \item \textbf{Cross-lingual transfer.} The 2nd-place finish on Chinese is notable given Gemma~3 27B's predominantly English training data. The explicit comedic reasoning scaffolding appears to partially compensate for weaker target-language fluency.
\end{itemize}

\subsection{Analysis}

We compare outputs against Gemini~3 Pro \citep{google2025} with single-turn prompts (full comparison in Tables~\ref{tab:d-a1}--\ref{tab:d-b2}, Appendix~\ref{sec:self-eval-appendix}). The pipeline's outputs exhibit: (1)~\textbf{narrative commitment}---fully developed frames (news broadcasts, dialogues) from the DeliveryStrategist rather than generic observations; (2)~\textbf{structural clarity}---explicit \texttt{draft\_setup}/\texttt{draft\_punchline} separation before final composition; (3)~\textbf{input specificity}---tight coupling to the input via ContextEnricher analysis; and (4)~\textbf{diverse strategies}---genuine mechanism variation across the four parallel HumorArchitect branches.

Recurring failure modes include \textbf{over-elaboration} (the multi-module chain accumulates detail, particularly problematic for Chinese's 300-character limit), \textbf{cultural mismatch} (Anglo-centric strategies from English-dominant training data, likely contributing to the weaker Spanish result), and \textbf{GIF description loss} (text-mediated descriptions occasionally miss the key visual humor moment).

\paragraph{Mechanism diversity.} Across 5,885 candidates, the HumorArchitect generates 371 unique logical mechanism labels, with Recontextualization dominant (21.6\%)---consistent with GTVH's prediction that incongruity drives humor. Strategy profiles diverge by modality: text tasks favor Recontextualization, Irony, and Absurdity, while GIF captioning (B1) relies on Recontextualization and Juxtaposition and prompt completion (B2) favors Absurd Literalization and Visual Hyperbole. Task~A~(zh) uniquely ranks Irony first, suggesting ironic reversal transfers more reliably into Chinese conventions. Table~\ref{tab:mechanisms-task} lists the top three preferred generation strategies per subtask, corroborating the presence of deliberate compositional divergence across tasks. Full distributions are reported in Appendix~\ref{sec:mechanism-dist}.

\begin{table}[t]
\centering\small
\begin{tabular}{llr}
\toprule
\textbf{Subtask} & \textbf{Top-3 Mechanisms} & \textbf{\%} \\
\midrule
\multirow{3}{*}{A (en)} & Recontextualization & 17.3 \\
  & Irony & 15.0 \\
  & Absurdity & 14.3 \\
\midrule
\multirow{3}{*}{A (es)} & Recontextualization & 26.1 \\
  & Irony & 17.2 \\
  & Absurdity & 13.2 \\
\midrule
\multirow{3}{*}{A (zh)} & Irony & 21.7 \\
  & Recontextualization & 19.9 \\
  & Absurdity & 14.9 \\
\midrule
\multirow{3}{*}{B1} & Recontextualization & 43.0 \\
  & Juxtaposition & 21.8 \\
  & Misattribution & 10.2 \\
\midrule
\multirow{3}{*}{B2} & Absurd Literalization & 38.2 \\
  & Visual Hyperbole & 14.4 \\
  & Mood Embodiment & 12.6 \\
\bottomrule
\end{tabular}
\caption{Top-3 logical mechanisms per subtask.}
\label{tab:mechanisms-task}
\end{table}

\paragraph{Judge positional bias and limitations.}
Candidate~1 wins 47\% of tournaments (expected: 25\%), a known limitation of LLM-as-judge approaches \citep{zheng2023}, which frequently suffer from strong positional and verbosity biases. The bias is most extreme for Task~B1 (67\%), where shorter, more similar captions may cause the judge to default to the first acceptable option. Conversely, it is most balanced for Task~A~(zh) (37\%), suggesting that when inter-candidate linguistic diversity is higher, the model evaluates more critically. While our single-elimination tournament structure reduces the cognitive load of evaluating all candidates simultaneously (limiting it to three discrete pairwise matches), we did not employ positional swapping (A vs. B then B vs. A) during inference. Regardless of this primacy bias, the high correlation between the pipeline's final selections and the Elo scores awarded by human evaluators demonstrates that even a biased LLM judge successfully functions as an effective filter for quality humor. Per-subtask breakdowns are provided in Appendix~\ref{sec:judge-bias}.

% ============================================================
\section{Conclusion}

We presented a neurosymbolic humor generation pipeline that decomposes joke creation into five GTVH-guided modules implemented as DSPy signatures. By explicitly separating incongruity design from narrative execution, our 27B-parameter system achieves competitive results against models heavily exceeding its scale, securing 2nd place in two subtasks.

These results suggest that structured decomposition can serve as a viable alternative to model scaling for creative generation tasks. Just as a professional comedian does not simply ``think of something funny'' but instead identifies targets, constructs incongruities, chooses delivery formats, and revises, our pipeline makes this implicit cognitive process explicit---providing scaffolding that enables a modest-scale LLM to compete with frontier models. More broadly, our work demonstrates that the GTVH, originally a descriptive linguistic theory, can function as a prescriptive computational framework for humor generation. Rather than asking ``how large must a model be to generate good humor?'', we argue that the more productive question is ``what cognitive structure must we provide to enable a model of any size to reason about humor effectively?''

Several directions remain open; we outline the most promising in Section~\ref{sec:future-work}.

% ============================================================
\section{Future Work}
\label{sec:future-work}

\begin{enumerate}[nosep]
  \item \textbf{Judge debiasing and alternative evaluations.} Relying heavily on an LLM for pairwise preference introduces significant positional bias. Future implementations should mitigate this computationally by performing bidirectional comparisons (evaluating Candidate A vs.\ Candidate B, then B vs.\ A) and randomizing presentation order. Deeper architectural solutions might involve training specialized reward models or utilizing reference-free metrics to reduce off-the-shelf LLM reliance.
  \item \textbf{Module-level ablation studies.} While the pipeline achieves competitive Elo rankings, we have not rigorously quantified the individual contribution of each GTVH stage. Future work must systematically ablate specific components—such as bypassing the DeliveryStrategist or generating single outputs without the tournament judge—to isolate precisely which structural constraints are most necessary to overcome the raw parameter disadvantage of smaller models.
  \item \textbf{DSPy optimization.} The current system uses fixed prompts. MIPROv2 or BootstrapFewShot with Elo-derived preference signals could improve prompt quality directly from human judgments.
  \item \textbf{Heterogeneous model routing.} Different modules may benefit from different model characteristics---e.g., a stronger creative-writing model for ContentWriter or a multilingual-specialized model for non-English tasks.
  \item \textbf{Iterative refinement.} Single-pass generation could be extended with judge-informed revision loops for the ContentWriter.
  \item \textbf{Direct visual grounding.} Task~B uses Nemotron Nano 12B VL as a lossy text intermediary; end-to-end multimodal architectures could eliminate this bottleneck.
  \item \textbf{Cross-lingual cultural adaptation.} Culturally-specific writing guidelines and evaluation criteria could address Anglo-centric biases from English-dominant training.

\end{enumerate}

% ============================================================
\bibliography{references}

% ============================================================
\appendix

\section{Logical Mechanism Distribution}
\label{sec:mechanism-dist}

We analyze the \texttt{logical\_mechanism} labels across all 5,885 candidates generated for 1,468 items.\footnote{Of the 1,500 total items, 32 required re-generation due to transient API errors during batch processing; their full intermediate outputs were not retained.}

\begin{table}[t]
\centering\small
\begin{tabular}{lrr}
\toprule
\textbf{Logical Mechanism} & \textbf{Count} & \textbf{\%} \\
\midrule
Recontextualization   & 1{,}274 & 21.6 \\
Irony                 &    649 & 11.0 \\
Absurdity             &    624 & 10.6 \\
Juxtaposition         &    511 &  8.7 \\
Absurd Literalization  &    413 &  7.0 \\
Literal Interpretation &    389 &  6.6 \\
Role Reversal         &    201 &  3.4 \\
Exaggeration          &    175 &  3.0 \\
Visual Hyperbole      &    155 &  2.6 \\
Mood Embodiment       &    136 &  2.3 \\
\bottomrule
\end{tabular}
\caption{Top~10 logical mechanisms selected by the HumorArchitect (across all subtasks and languages).}
\label{tab:mechanisms}
\end{table}

The long tail of 371 unique labels (including compounds like \emph{Exaggeration \& Recontextualization}) indicates compositional strategy generation.

\section{Judge Positional Bias}
\label{sec:judge-bias}

We analyze which candidate position wins the tournament by matching judged outputs back to candidate numbers.\footnote{We matched 1,444 of 1,500 items (96.3\%); the remaining 56 could not be matched due to minor whitespace or encoding differences between the judged output and stored candidates.}

\begin{table}[t]
\centering\small
\begin{tabular}{lrrrrr}
\toprule
\textbf{Subtask} & \textbf{C1} & \textbf{C2} & \textbf{C3} & \textbf{C4} & \textbf{$n$} \\
\midrule
A (en) & 45\% & 23\% & 20\% & 13\% & 300 \\
A (es) & 39\% & 23\% & 20\% & 18\% & 300 \\
A (zh) & 37\% & 24\% & 20\% & 20\% & 297 \\
B1     & 67\% & 14\% & 15\% &  4\% & 298 \\
B2     & 47\% & 24\% & 17\% & 13\% & 249 \\
\midrule
\textbf{All}  & \textbf{47\%} & \textbf{21\%} & \textbf{18\%} & \textbf{14\%} & \textbf{1{,}444} \\
\bottomrule
\end{tabular}
\caption{Winner distribution by candidate position (expected: 25\% each).}
\label{tab:position-bias}
\end{table}

Table~\ref{tab:position-bias} confirms the positional bias discussed in Section~5.2. See that section for interpretation.

\section{Writing Guidelines and Evaluation Criteria}
\label{sec:guidelines}

The full English writing guidelines provided to the ContentWriter module:
\begin{enumerate}[nosep]
  \item \textbf{Economy of Language:} Cut every unnecessary word. If you can say it in 5 words instead of 10, do it.
  \item \textbf{Setup Misdirection:} The setup should read like a normal observation, NOT like ``here comes a joke.''
  \item \textbf{Surprise + Inevitability:} The punchline should be unexpected yet feel obvious in retrospect.
  \item \textbf{No Explaining:} Never explain the joke. If the punchline needs clarification, rewrite it.
  \item \textbf{Concrete $>$ Abstract:} ``He ate 47 pancakes'' is funnier than ``He ate a lot of pancakes.''
  \item \textbf{Rhythm Is Real:} The joke should have natural flow and cadence.
  \item \textbf{Truth Resonates:} The best comedy contains truth.
  \item \textbf{Conversational Tone:} Write how people actually talk.
  \item \textbf{Commit to the Bit:} Whatever voice/style you choose, go all in.
\end{enumerate}

The full English evaluation criteria provided to the HumorJudge module:
\begin{enumerate}[nosep]
  \item \textbf{The Laugh Test:} Which joke would actually make someone laugh? Not which is ``clever''---which is FUNNY?
  \item \textbf{Surprise \& Setup:} Does the punchline genuinely surprise while still making sense?
  \item \textbf{Economy:} Is every word necessary? Tighter is almost always better.
  \item \textbf{Headline Relevance:} Does it connect to THIS specific input, or is it generic?
  \item \textbf{Naturalness:} Does it sound like something a human would say?
  \item \textbf{Logical Punchline:} Does the punchline make sense? Absurdity is fine; illogical nonsense is not.
  \item \textbf{Truth/Recognition:} Do people recognize something real in it?
  \item \textbf{Commitment:} Does it fully commit to the bit?
\end{enumerate}

\noindent\textbf{Automatic Failures:} Self-explanation after the punchline; generic jokes applicable to any input; offensive without being clever; setup and punchline that don't connect logically.

\section{GIF-to-Text Prompt Structure}
\label{sec:gif-prompt}

The GIF analysis prompt for Task~B1 instructs the vision model to capture:
\begin{itemize}[nosep]
  \item \textbf{Subjects \& Characters:} Physical appearance, species, distinctive features
  \item \textbf{Actions \& Movements:} Frame-by-frame sequence, speed, direction, looping dynamics
  \item \textbf{Facial Expressions \& Body Language:} Emotional states and changes
  \item \textbf{Setting \& Environment:} Location, props, lighting, visual style
  \item \textbf{Comedic Potential:} ``Caption-bait'' moments, incongruities, meme potential
\end{itemize}
For Task~B2, the fill-in-the-blank prompt is additionally provided to contextualize the description.

\section{Self-Evaluation: Full Comparison}
\label{sec:self-eval-appendix}

We compare outputs against Gemini~3 Pro using simple, single-turn prompts across all four subtask types (see Appendix~\ref{sec:ablation-prompts} for exact prompts).

\begin{table*}[t]
\centering\footnotesize
\begin{tabular}{lL{0.14\textwidth}L{0.32\textwidth}L{0.32\textwidth}}
\toprule
\textbf{ID} & \textbf{Headline} & \textbf{System (GTVH Pipeline + Gemma 27B)} & \textbf{Gemini 3 Pro (Simple Prompt)} \\
\midrule
en\_2272
& \emph{Why an AI `godfather' is quitting Meta after 12 years}
& Breaking: Meta's Chief AI Scientist, Yann LeCun --- widely known as the ``Godfather of AI'' --- is reportedly leaving the company after 12 years. Sources say he's citing a desire to ``explore new opportunities.'' Apparently, those opportunities involve a witness protection program and a very convincing new identity.
& The AI godfather left Meta because he finally realized ``The Social Network'' wasn't a training manual for a benevolent deity. He's now looking for a job with less data-mining and more actual wine. \\
\midrule
en\_2002
& \emph{Carra: Liverpool must sign in January -- even after summer spending spree}
& Reporter: Jamie Carragher says Liverpool need to sign players in January, despite a huge summer spending spree. Thoughts? Carragher: Look, I just\ldots{} I saw a really good deal on a winger, and then a centre-back was on sale. It's an addiction, alright? I need help.
& Liverpool's board is terrified. They spent millions this summer, yet Jamie Carragher is still demanding more signings. At this point, they just need to buy enough players to physically block Jamie from entering the TV studio. \\
\bottomrule
\end{tabular}
\caption{Task A1---Headline-based jokes.}
\label{tab:d-a1}
\end{table*}

\begin{table*}[t]
\centering\footnotesize
\begin{tabular}{lL{0.10\textwidth}L{0.35\textwidth}L{0.35\textwidth}}
\toprule
\textbf{ID} & \textbf{Words} & \textbf{System (GTVH Pipeline + Gemma 27B)} & \textbf{Gemini 3 Pro (Simple Prompt)} \\
\midrule
en\_2298
& \emph{shake}, \emph{chair}
& Anchor: ``\ldots{}and the Senator continues to address the nation on the importance of fiscal responsibility. As you can see, he's\ldots{} quite passionate about the subject.'' Co-Anchor: ``Yes, and it appears his \emph{chair} is equally passionate, actually beginning to \emph{shake} violently. One wonders if it has a stronger opinion on the debt ceiling than he does.''
& My doctor told me I needed to shake things up to improve my posture. So, I bought a high-tech vibrating office chair. Now, I'm still unproductive, but at least I look like I'm working at the speed of light. \\
\midrule
en\_2296
& \emph{measure}, \emph{fridge}
& My doctor said I need to track absolutely everything I eat. I spent twenty minutes this morning trying to accurately \emph{measure} a single Brussels sprout. My wife walked in and asked, ``What are you doing?'' I said, ``Preparing for long-term storage. It's going in the \emph{fridge} and needs to be properly documented for posterity.'' She just\ldots{} backed away slowly.
& My wife asked me to measure the fridge to see if it would fit in our new kitchen. I told her it was exactly three pizzas wide and two ``oops-I-forgot-to-buy-milk'' deep. She wasn't amused, but at least I know the scale of my problems. \\
\bottomrule
\end{tabular}
\caption{Task A2---Word-inclusion jokes.}
\label{tab:d-a2}
\end{table*}

\begin{table*}[t]
\centering\footnotesize
\begin{tabular}{cL{0.34\textwidth}L{0.34\textwidth}}
\toprule
\textbf{GIF} & \textbf{System Caption} & \textbf{Gemini 3 Pro Caption} \\
\midrule
\raisebox{-0.4\height}{\includegraphics[height=2.5cm]{Images/1.png}} \newline \texttt{\scriptsize img\_2999}
& Me when winning buys me a summer away from my in-laws. This belt = escape.
& Me opening the ``Total Due'' section of my electric bill after leaving the AC on all summer. \\
\midrule
\raisebox{-0.4\height}{\includegraphics[height=2.5cm]{Images/2.png}} \newline \texttt{\scriptsize img\_2941}
& When you reply-all with a cat GIF and your boss silently drafts your termination.
& Me trying to navigate my responsibilities when the weekend is finally in sight. \\
\bottomrule
\end{tabular}
\caption{Task B1---GIF caption generation.}
\label{tab:d-b1}
\end{table*}

\begin{table*}[t]
\centering\footnotesize
\begin{tabular}{cL{0.14\textwidth}L{0.25\textwidth}L{0.25\textwidth}}
\toprule
\textbf{GIF} & \textbf{Prompt} & \textbf{System Completion} & \textbf{Gemini 3 Pro Completion} \\
\midrule
\raisebox{-0.4\height}{\includegraphics[height=2.5cm]{Images/3.png}} \newline \texttt{\scriptsize img\_2\_0897}
& \emph{Logging into a remote call and realizing \_\_\_\_}
& \ldots{}I'd accidentally used a potato as my webcam.
& \ldots{}you're still in your pajamas but the camera is definitely on. \\
\midrule
\raisebox{-0.4\height}{\includegraphics[height=2.5cm]{Images/4.png}} \newline \texttt{\scriptsize img\_2\_0844}
& \emph{First pancake flips like a pro, the rest flip like \_\_\_\_}
& \ldots{}an Olympic long jumper.
& \ldots{}a chaotic kitchen nightmare after Mama's third glass of wine. \\
\bottomrule
\end{tabular}
\caption{Task B2---GIF + prompt completion.}
\label{tab:d-b2}
\end{table*}

\paragraph{Observations.}
The pipeline produces richer narrative framing and stronger input specificity compared to Gemini~3 Pro's shorter observational style, consistent with the analysis in Section~5.2.

\section{Ablation Baseline Prompts}
\label{sec:ablation-prompts}

The following prompt templates were used to generate the Gemini~3 Pro baseline outputs in Appendix~\ref{sec:self-eval-appendix}. Each prompt was submitted as a single-turn input with no system prompt, decomposition, or follow-up.

\subsection{Task A1---Headline-Based Jokes}

\begin{quote}\small
\texttt{Write a funny joke inspired by the following news headline. The joke should be original, creative, and no longer than 50 words.}\\[4pt]
\texttt{Headline: "\{headline\}"}
\end{quote}

\subsection{Task A2---Word-Inclusion Jokes}

\begin{quote}\small
\texttt{Write a funny joke that naturally includes both of the following words. Both words must appear in the joke. The joke should be original, creative, and no longer than 50 words.}\\[4pt]
\texttt{Word 1: \{word1\}}\\
\texttt{Word 2: \{word2\}}
\end{quote}

\subsection{Task B1---GIF Caption Generation}

\begin{quote}\small
\texttt{Look at this GIF and write a funny caption for it. The caption must be 20 words or fewer. Do NOT describe what is happening in the GIF---instead, recontextualize it humorously.}\\[4pt]
\texttt{GIF: \{gif\_url\}}
\end{quote}

\subsection{Task B2---GIF + Prompt Completion}

\begin{quote}\small
\texttt{Look at this GIF and complete the following prompt to make it funny. The COMPLETE sentence (prompt + your completion) must be 20 words or fewer. Your completion should make the GIF feel like the perfect visual punchline.}\\[4pt]
\texttt{Prompt to complete: "\{prompt\}"}\\
\texttt{GIF: \{gif\_url\}}
\end{quote}

\clearpage
\section{Pipeline Walkthrough}
\label{sec:pipeline-walkthrough}

Figure~\ref{fig:pipeline-trace} shows a complete trace of the pipeline processing item \texttt{en\_2009} (headline: \emph{``I stayed at one of only two hotels in Malta's Silent City''}). The trace illustrates how each module transforms its inputs:

\begin{enumerate}[nosep]
  \item \textbf{ContextEnricher} extracts the situational subtext (Malta, Mdina as the ``Silent City,'' scarcity of hotels implying quiet exclusivity) and semantic associations (Mediterranean island, medieval walled city, limited options).
  \item \textbf{HumorArchitect} (4 branches) produces four independent humor mechanisms: Double Entendre (\emph{Ambient Quietness vs.\ Social Silence}), Recontextualization (\emph{Natural Quiet vs.\ Imposed Silence}), Ignoring the Obvious (\emph{Absolute Quiet vs.\ Relative Quiet}), and Irony (\emph{Peaceful Solitude vs.\ Competitive Restraint}).
  \item \textbf{DeliveryStrategist} selects narrative formats: Q\&A, Fake News, Dialogue (twice), each paired with a Dry/Cynical or Deadpan style.
  \item \textbf{ContentWriter} produces four candidate jokes, ranging from observational travel humor to mock news reports.
  \item \textbf{HumorJudge} runs a single-elimination tournament (Semi-final~1: C1 vs.\ C2; Semi-final~2: C3 vs.\ C4; Final: SF1 winner vs.\ SF2 winner), selecting Candidate~4 (Irony mechanism, Dialogue delivery) as the winner.
\end{enumerate}

\noindent The winning joke: \emph{``Malta's Silent City is\ldots{} well, silent. I stayed at one of only two hotels there.'' Local: ``Oh yeah, they're locked in a cold war. Neither wants to be the first to offer free breakfast.''}

\begin{figure*}[t]
\centering
\includegraphics[width=\textwidth,height=0.88\textheight,keepaspectratio]{Images/pipeline_trace.png}
\caption{Complete pipeline trace for item \texttt{en\_2009}. Color coding indicates module stage: red\,=\,ContextEnricher, orange\,=\,HumorArchitect, yellow\,=\,DeliveryStrategist, green\,=\,ContentWriter, dark red\,=\,HumorJudge.}
\label{fig:pipeline-trace}
\end{figure*}

\end{document}
