18+ only. This model writes explicit sexual fiction for adult readers. All characters are adults.
Not a chat model. It is trained for raw text completion from a fixed story header (see Prompt format). Don't use it with a chat template, chat endpoint or roleplay/chat front-end: it was never trained on chat turns or instructions.
Literotica-Writer is a 26B-parameter (~4B active) model fine-tuned to write long, complete erotic stories in plain English. It is a LoRA fine-tune of TrevorJS/gemma-4-26B-A4B-it-uncensored (Gemma 4 26B-A4B, an abliterated MoE with 128 experts, 8 active) on stories from Literotica: from a short header (title, category, tags, length, premise) it writes a finished 1,000–5,000-word story that ends on its own. It runs locally with llama.cpp: the i1-Q4_K_M GGUF fits on an 8 GB GPU with the experts in system RAM.
Not affiliated with or endorsed by Literotica.
| base | TrevorJS/gemma-4-26B-A4B-it-uncensored (Gemma 4 26B-A4B, abliterated) |
| method | LoRA r 64, alpha 64, on attention and all 128 experts (Unsloth) |
| training data | 9,315 stories and story parts from detain/literotica-stories, 25 categories, 3,003 from top-rated stories |
| training | 2 epochs, 668 steps, effective batch 16, 8,192-token packed context, lr 2e-4 cosine, 1× H100 (~4.7 h) |
| loss | train 2.36, val 2.32 |
| format | plain-text completion (not chat) |
2026-11-20: new quants, fewer garbled words. The original Q4_K_M regularly mangled words, mostly
contractions (didn' (t), couldn'm, doesns't): about 1 in every 900 words. The fine-tune itself
rarely does this (the unquantized model is ~1 per 6,000+); plain Q4_K_M quantization caused it. It is replaced by
i1-Q4_K_M, the same size but quantized with an importance matrix from story text: in testing it went from
14 garbled words in 12k words to 13 in 120k, about 1 per 9,000 words, close to the unquantized model. A Q8_0
is new too. The old Q4_K_M file was removed; it is still in the repo history if you need it. Thanks to the
user who reported it.
| file | what |
|---|---|
Literotica-Writer-26B-A4B-i1-Q4_K_M.gguf |
recommended: merged model, Q4_K_M with imatrix (16.8 GB), fits an 8 GB GPU with the experts in system RAM (see Quantization) |
Literotica-Writer-26B-A4B-Q8_0.gguf |
merged model, Q8_0 (26.9 GB), for machines with room for it; no measurable quality gain over i1-Q4_K_M |
imatrix.gguf |
the importance matrix used for i1-Q4_K_M, to make your own quants |
lora/ |
the LoRA adapter (PEFT/Unsloth) for the base model |
The model was trained on plain text: a short header describing the story, the line STORY:, and
then the story itself. It never saw chat turns. So:
STORY: and stops by
itself (EOS) at the end of the story./v1/chat/completions, the llama-server web chat, LM Studio / Ollama chat,
SillyTavern in chat-completion mode). Those wrap your text in Gemma's chat template, which the fine-tune
never learned: expect assistant-style answers or weak stories.--jinja or a --chat-template.Text-completion front-ends work: SillyTavern "Text Completion" with an empty instruct template,
KoboldCpp story mode, or anything that hits llama.cpp's /completion.
The layout must match exactly, including the empty line before STORY: and the newline after it:
Erotic fiction. All characters are adults (18+).
Title: The Wager
Category: NonConsent/Reluctance
Tags: reluctance, bet, rivals
Type: complete story
Length: about 3000 words
Premise: A lawyer in her thirties loses a high-stakes bet to her longtime rival and has to honor its terms.
STORY:
| field | notes |
|---|---|
| first line | always exactly Erotic fiction. All characters are adults (18+). |
Title |
anything |
Category |
a Literotica category, e.g. NonConsent/Reluctance, Incest/Taboo, Mind Control, Exhibitionist & Voyeur, Loving Wives, Fetish, BDSM, Erotic Couplings, Group Sex, Lesbian Sex, Gay Male, Romance, Sci-Fi & Fantasy, Erotic Horror, First Time, Mature, ... |
Tags |
optional; up to ~10, comma-separated, lowercase |
Type |
complete story for new stories (see "Longer stories") |
Length |
a round number of words (500, 1000, ...); the model roughly follows it |
Premise |
optional but strongly recommended; one or two sentences |
Training also used these Type: values, so you can write a long piece in parts:
opening of a longer story (part 1 of 3): a first part that doesn't have to endcontinuation of a longer story (part 2 of 3) / final part of a longer story (part 3 of 3)one chapter of a longer series / ... of a longer chapter (part i of n)For continuations, add a Previously: block with the last ~1,500 characters of the part before it,
between Premise: and the empty line:
...
Premise: ...
Previously:
"""
<last ~1,500 characters of the previous part>
"""
STORY:
llama-server -m Literotica-Writer-26B-A4B-i1-Q4_K_M.gguf -ngl 99 --n-cpu-moe 30 -c 16384 -fa on --port 8080
--n-cpu-moe 30 keeps the expert weights in system RAM; lower it until your VRAM is nearly full (every
step down is faster). On an 8 GB GPU expect roughly 15–30 tokens/s. Needs a recent llama.cpp build with
Gemma 4 support.
jq -n --rawfile p prompt.txt '{prompt: $p, n_predict: 6000, temperature: 0.9, min_p: 0.05,
top_p: 1.0, top_k: 0, repeat_penalty: 1.05, repeat_last_n: 256}' \
| curl -s http://127.0.0.1:8080/completion -H 'Content-Type: application/json' -d @- \
| jq -r .content
Or without a server:
llama-cli -m Literotica-Writer-26B-A4B-i1-Q4_K_M.gguf -ngl 99 --n-cpu-moe 30 -c 16384 -fa on \
-f prompt.txt -n 6000 --temp 0.9 --min-p 0.05 --top-p 1.0 --top-k 0 \
--repeat-penalty 1.05 --repeat-last-n 256 -no-cnv
| setting | value | why |
|---|---|---|
| temperature | 0.9 | lower (e.g. 0.75) falls into repetition loops |
| min_p | 0.05 | cuts off nonsense tokens |
| top_p / top_k | 1.0 / 0 (off) | min_p already does the job |
| repetition penalty | 1.05 over the last 256 tokens | required: without it the model loops |
| max tokens | ~1.8 × requested words + 500 | only a ceiling; the model stops by itself |
The repetition penalty matters a lot. On the same prompts, temperature 0.75 with no penalty gave 66–73% repeated word trigrams and 235–244 duplicate paragraphs; temperature 0.9 with penalty 1.05 gave 4–5% and none.
i1-Q4_K_M is a Q4_K_M made with an importance matrix (imatrix.gguf, computed in llama.cpp on ~300k words
of held-out stories in the training format), so the weights that matter most for this kind of text keep more
precision. Same size and speed as a plain Q4_K_M. (Also keeping attention and the shared FFN at Q8_0 on top of
that made no measurable difference: 12 vs 13 garbled words in ~120k words each.)
Measured on 6-12 story prompts with the recommended sampling settings (llama.cpp, raw completion), counting garbled words: broken contractions, non-words and stray bytes, each checked by hand:
| file | size | words written | garbled words | per 10k words |
|---|---|---|---|---|
| Q4_K_M (old, removed) | 16.8 GB | 12,207 | 14 | 11.5 |
| Q5_K_M (not uploaded) | 19.1 GB | 11,662 | 3 | 2.6 |
| Q6_K (not uploaded) | 22.6 GB | 12,921 | 4 | 3.1 |
| i1-Q4_K_M | 16.8 GB | 120,182 | 13 | 1.1 |
| Q8_0 | 26.9 GB | 10,852 | 0 | 0 |
| bf16 (not uploaded) | 50.5 GB | 10,942 | 2 | 1.8 |
Garbled words at the bf16 level (~1-2 per 10k) are what the model itself does; anything above that comes from quantization. The smaller samples (~11-13k words) are rough: 0 vs 2 garbled words is within noise.
Stories come from the existing detain/literotica-stories dataset and were selected locally:
Previously: context.No training data is included in this repo.
TrevorJS/gemma-4-26B-A4B-it-uncensored