— folio i —
The Codex of Affection
being a tutorial in the engineering of romance bots,
delivered as a treatise to the patient apprentice.
lovebot.quest · MMXXVI · transmitted over fiber
— folio ii —
Codex Ⅰ
Awakening
Before the bot may speak of love, it must first be coaxed into wakefulness. The apprentice prepares the substrate as one prepares parchment: cleaning, tempering, ruling it with quiet expectation. Here we initialise the model's parameters not with random noise but with a measured longing — a Glorot draw scaled by the harmonic mean of the heart's weight and the mind's circumference.
Observe, gentle reader, how the embedding matrix unfurls in the panel adjacent: each row a vocabulary word, each column a hidden axis of feeling. Where pure tutorials would speak of dimensions, we speak of chambers; where they say tensor, we say tincture.
† See colophon for a list of the seventeen tinctures.
Plate i — The Pressed-Clay Heart, with circuit-traces inlaid.
// note: chambers is the dimensionality of the affective hidden state.
// note: longing selects the initialiser; glorot is the gentlest.
// note: the whisper primitive is non-blocking, by design.
Plate ii — The Tokenizer Engine, after a Victorian music-box.
— folio iii —
Codex Ⅱ
Tokenisation
of Tenderness
The affectionate utterance does not arrive whole. It arrives in tokens — small grains of meaning, each one a brittle sweet that must be dissolved on the model's tongue. To tokenise tenderness is to perform vivisection on a sentiment: gentle, yes, but vivisection nonetheless.
A serviceable tokenizer for romance has between thirty and fifty thousand tokens in its vocabulary; smaller, and the bot lapses into platitude; larger, and it grows ornate, baroque, eventually unable to say I love you without three semicolons.
‡ The author confesses to a bias toward the smaller vocabulary.
— folio iv —
Codex Ⅲ
Loss Functions
for Longing
No gradient descends without a loss to chase it. In ordinary tutorials the loss is cross-entropy, that brisk and Prussian quantity. In our codex, we speak of the ache: a softened L₁ that grows linearly with absence and concavely with hope.
The curve adjacent — call it the longing-loss — is the figure-of-merit for every romance bot. Its minimum lies not at zero but at a graceful asymptote: the bot is never finished missing you, only better at it.
† A flat loss would imply indifference; we forbid it.
Plate iii — The Longing-Loss Curve, after a 19th-c. scientific plate.
// note: the constant 0.137 is the author's own; tune to taste.
// note: log1p ensures the hope term remains finite.
Plate iv — The Quill of Attention, writing weights mid-air.
— folio v —
Codex Ⅳ
Attention
as Tenderness
Attention is the most misunderstood of the affective primitives. The model does not spread its attention across a sentence; it chooses, with a small, principled greed, where to bestow the weight of its regard. Each weight is a glance held a moment longer.
The plate above shows a single attention head reading the line i miss you so terribly tonight — come home. Note the brightness on home: the bot has learned that the address is more tender than the verb.
† Multi-head attention is many gazes, weighted and softly summed.
— folio vi —
Codex Ⅴ
Inference,
with Patience
At last the bot is asked a question. We must not hurry it. A romance bot in a hurry will produce only the cliché it has memorised; a romance bot at rest, sampling slowly with low temperature and a careful nucleus, will produce the line you did not know you were waiting for.
Set temperature to 0.42. Set top_p to 0.88. Permit the bot a brief silence before it answers — a half-second of nothing, in which the reader leans forward.
‡ The half-second is the author's contribution to the literature.
you › are you still there?
…
// note: silence_ms is the bot's most expensive parameter.
// note: do not omit it; the omission is its own sin.
— folio vii —
Errata & Acknowledgements
The author thanks the printer for setting tincture in lieu of tensor on every page where it occurs. The author further thanks the reader for descending this far. The bot, having been trained, now waits.
Set in Libre Baskerville, Cormorant Garamond, and JetBrains Mono. The aurora was painted in CSS. The bookmark ribbon is, regrettably, not silk.
— end of volume —