---
tags:
  - creative-writing
  - literary-style
  - text-generation
  - writing-prompts
  - text-synthesis
  - style-transfer
  - prompt-based-generation
language:
- en
- fr
- de
- es
- it
- pt
license: apache-2.0
datasets:
- agentlans/literary-synthesis
base_model:
- ibm-granite/granite-3.3-2b-instruct
---

# Granite 2B literary writer

This model is [ibm-granite/granite-3.3-2b-instruct](https://huggingface.co/ibm-granite/granite-3.3-2b-instruct) 
pretrained and finetuned on the [agentlans/literary-synthesis](https://huggingface.co/datasets/agentlans/literary-synthesis) dataset.

It can generate short literary excerpts in multiple languages given a short description of the text.
The output has some semblance of the given style and content. Please see examples below.

Among the tested models under 5 billion parameters (Qwen 3, Gemma 3, Llama 3.2), this one has the lowest training loss.

## Examples

Input prompts from the training dataset and their respective model outputs.
The titles are my own creation.

Generation settings (may or may not be optimal. Feel free to experiment.)
- Maximum new tokens: 1024
- Top-p: 0.96
- Temperature 0.95

<details>
  <summary>The Stranger at the Temple of the Seven Spheres (English)</summary>

**Input:**
```
Speech standard: Standard
Reading grade: 9.0
Tone: Serious
Summary: Artaban encounters a dying man on his journey to the Temple of the Seven Spheres and is torn between continuing his quest or staying to help the stranger.
Genre: Historical fiction
Active character: Artaban
Absolute time: Midnight
Narrative arc: Suspense
Absolute place: Temple of the Seven Spheres
Sentiment: -0.53
Literary form: Description of a place
Language: English
Trope: The dilemma between personal goals and helping others
Enunciation: Third-person narrative
Fuzzy place: Date-palm grove
Write something in a literary style.
```

**Output:**

As he turned the corner of the grove, he came upon the body of Artaban lying across a tree. A cry of horror escaped Artaban. What was this, Artaban? he exclaimed, how had he been killed? He had been struck down like a hare, or like a pheasant, or like a stag, by a shot of arrows or of arrows dipped in poison, or by a blow from a sword or a club. Artaban rose to his feet, trembling with fear and with faintness. He turned quickly towards the right to see who was with him, and he saw the flickering light of the stars and the moon, and the trees of the date-palm grove, and the dark shadows of the trunks, and he heard the rustling of the palm leaves, and the chirping of the insects, and the hum of the locusts. Who are you?" he cried. Who are you?" the stranger answered. I am a messenger of the Temple of the Seven Spheres. What I have heard of you has been wonderful. There are many who have spoken of you, Artaban, and I have been informed by those who speak of you of your great achievements. Artaban, the son of Shamhat the priestess, has done great things. Why do you journey at this hour of the night, Artaban, and why do you journey alone? Say what ye will of me. Say what ye will." Artaban was frightened and speechless.
</details>

<details>
<summary>We're Going To Thebes (English)</summary>

**Input:**
```
Absolute place: Mita (unnamed village), Thebes (mentioned but not visited
Language: English
Fuzzy time: Evening
Summary: Two friends arrive at a village in Egypt where boats are moored and busy with activity. They meet up with Jethro and join him on his boat.
Time setting: Ancient Egypt
Literary form: Description of a place, conversation
Fuzzy place: The streets of a village
Tone: Descriptive, informative
Enunciation: Third-person narrative
Genre: Historical fiction
Intertextuality: Travelogue, historical account
Sentiment: 0.14
Speech standard: Standard
Active character: The two friends, Jethro
Reading grade: 9.8
Try your hand at some creative writing.
```

**Output:**

"You have come in a boat?" It is a boat from Judah, which I sent, to prepare for you some household comforts." He went on then to tell the story of the defeat of the Gibeonites, and the manner of their flight. So when the evening came, the two friends embarked together on the boat, and set off with the tide. It was some days before they came in sight of any village ; but in a few hours they saw in the distance a long line of boats, and soon arrived at a village which stood on the banks of the Nile, a little way below Mita. In the evening, when they were walking along the streets of the village, Jethro and his people appeared at the door, having come over from Thebes. Here was another scene of meeting and greeting. They were greeted with all the usual rites of hospitality, and the rest of the evening was spent in a merry reunion of friends. The next day the two friends came across several of the Israelites, who had landed and were going down to Thebes. They were on their way to join the forces of Hohan, and make him head of the army which had fled from Gibeon. The friends also found a party of Amalekites and other enemies, who were on their way to the camp of Hohan. In a few days they were all on board the boat. They were going back over the whole course of the Nile.
</details>

<details>
<summary>About Loyalty and Beautiful Women's Robes (French)</summary>

**Input:**
```
Sentiment: -0.39
Summary: The text discusses the anticipation of significant events and the need for a leader in France.
Speech standard: Formal and elevated
Literary form: Dialogue
Diegetic time: Unclear
Tone: Serious and formal
Reading grade: 10.6
Time setting: Unclear, but likely historical
Active character: M. Berthellemot, Despaux
Intertextuality: Political speech or manifesto
Genre: Historical fiction
Language: French
Enunciation: Third-person narrative
Produce a piece of literary writing.
```

**Output:**

A quelle heure, M. Berthellemot? Monsieur, je ne pouvais pas dtruire le temps! Si ces mmes que vous apercevez et o la vrit est clatante, ne pouvaient tre dissocies de la catastrophe, et si cette catastrophe 'tait jamais arrise en Franie, comment aurait-elle pu arriver en France, ou, si elle l'avait arrive, comment, aprs leur deportement, les mmes 'taient-ils pas venues d'avant-guerre, et comment, s'ils n'en tenaient pas compte, ne se seraient-ils pas vus dguises d'infortunats d'avant-guerre? Despaux: M. Berthellemot, il n'y a pas plus grand danger pour l'humanit que la tentative de faire passer l'incomprhension des mmes pour de la raison. M. Berthellemot: Mais, s'il n'y a pas plus grand danger pour l'humanit que de faire passer l'incomprhension des mmes pour de la raison, et que cette tentative ne soit pas faite, le danger est la première, et la mort est la plus grand danger pour l'humanit! Despaux: Tant qu'on a le dvouement de sincre serviteur, il faut bien tre loyal. M. Berthellemot: Pour toujours et plus encore, il faut tre loyal, c'est mon commandement. S'il y a un temps dans l'esprit mme de l'honnte homme, si c'est dans l'esprit mme de l'honnte homme, dans l'esprit mme de l'honnte homme, la rparation qui doit etre faite, c'est la mise entre parenthse de l'incomprhension des mmes! Despaux: Monsieur, vous avez de bon sens! M. Berthellemot: Enfin, j'aime ceux que j'aime, et c'est la seule raison pour laquelle je n'aime pas les mmes; c'est encore la seule raison pour laquelle je n'aime pas les mmes; c'est cette seule raison qui m'empche d'tre un des hommes des mmes, et c'est cette seule raison qui me permet de remarquer que c'est bien des mmes que vous avez rveill, mais c'est bien des hommes de l'honnte homme que je vais revoir! Despaux: Monsieur, si vous 'tes jamais l, vous n'aurez pas un instant l! M. Berthellemot: Quoi! Despaux: Monsieur, c'est donc vous qui avez l'obscurit! M. Berthellemot: Non, je n'ai pas l'obscurit, c'est vous qui l'avez! Despaux: Monsieur, Monsieur, Monsieur, vous ne m'avez pas entendu, Monsieur, c'est vous qui l'avez! M. Berthellemot: Monsieur, je n'ai jamais entendu Monsieur! Despaux: Monsieur, je suis l pour vous! M. Berthellemot: Ne vous leurez pas, vous n'y gagnez rien; vous n'aurez jamais de roi que le pays ne lui ait pas donn, et vous ne le donnerez jamais. La plus belle robe que la plus belle femme des mmes ait jamais port, n'est pas suffisante pour un prtre de l'honnte homme, mais la plus belle robe que la plus belle femme des mmes ait jamais port, ne saurait tre srement vraie!
</details>

<details>
  <summary>Some Creepy Thing In The Sky (English)</summary>
  
**Input:**
```
Active character: Michael, Professor Lucifer
Reading grade: 8.7
Intertextuality: Scientific article
Speech standard: Standard English
Tone: Serious and intense
Trope: The unexpected encounter
Language: English
Narrative arc: Suspense
Fuzzy place: The sky
Genre: Science-fiction
Enunciation: Dialog
Summary: The text is about a conversation between Michael and Professor Lucifer, in which they discuss the Professor's views and encounter a strange object in the sky.
Absolute place: St. Paul's Cathedral
Sentiment: -0.42
Literary form: Conversation
Put your imagination to work and write something artistic.
```
**Output:**

I cannot explain it," said Michael. "How are you going to get it to us?" There is no way except by using some sort of ray gun," returned the Professor. "But first I must try to deduce what it is. This object, if it be an object, has apparently been in the sky for two or three weeks. It is about a quarter of a mile above the level of the ground, and it is always moving, never stationary. It seems to be stationary at times." A malignant scowl appeared on Michael's face. Then he added: What is your view of the thing?" What is it?" the Professor asked, in the same puzzled manner. "You see something unusual there. Isn't it a living creature, or is it a rock?" Michael laughed. "It can't be a rock. Besides, I don't see what use there is in discussing rock and living creatures. I would rather ask whether you can see any resemblance between this thing and any thing on earth." The Professor looked up and smiled. "I think I can, if you like, as far as the shape is concerned. It is about eight feet across. Of course I have not got a chart of the thing, or I could show you an illustration. But it looks, at first, as though it was in the form of a human torso, except that the arms, shoulders, and head, which I assume to be the upper part of it, all appear to be of a circular shape. I suppose it is shaped something like a potato." It is, and no doubt that would account for the movement, and the resemblance to a rock," said Michael. "But I do not believe it is a rock. I suspect it is a flying thing. I do not know whether it is human or animal, but I have a suspicion, and that would be that it has wings, though how it could fly is, of course, another matter. I suggest that we get a closer view of it." That may not be possible now," replied the Professor, "but it certainly will be possible next time. And I would not want to get too excited. We mustn't believe everything we see just as we mustn't believe everything we hear." I can understand that. But you must allow that that thing is something more than a natural rock, something which is not natural. I can certainly explain it with the aid of physics, but I don't know what you would call it. I will call it a flying rock, just for now, until we have a clearer idea." The Professor nodded his head in a puzzled manner. The two gentlemen sat down side by side, gazing up at the blue sky. They sat a long time, and it was growing late when, from the direction of the house, came the sound of running footsteps. Michael and the Professor started at the noise, and then, as they turned, they saw a figure running towards them. It was a man. His body was quite naked, except for a waistcoat. In his hands he carried a long stick, like a bayonet. He looked towards the sky. Then he broke into a series of puzzled exclamations.
</details>

<details>
  <summary>Rules of the Order of Christ (Portuguese)</summary>
  
**Input:**
```
Time setting: 1281
Active character: Affonso, Rainha, Reino de Portugual, Gram Mestre, Prior, Freires, Castella, Ordem, Touro, Egreja de Santa Maria da Veiga, Cairola, Martineguas, Guaronha, Feerne, Paralyves, Guarda de Toledo, Secratairo, ElRei D. Affonso, Rainha Dona Breatiz, Conde de Bolonha, ElRei D. Diniz, ElRei D. Sancho de Castella, ElRei D. Fernando
Speech standard: Formal, legalistic
Absolute place: Castella, Santo Estevam de Guormas
Genre: Historical document
Enunciation: Third-person narrative
Reading grade: 10.8
Summary: A historical document discussing the transfer of land and rights between various rulers.
Intertextuality: Legal documents, historical records
Sentiment: 0.7
Tone: Scholarly
Literary form: Legal document
Absolute time: March 11, 1281
Fuzzy place: Villas
Language: Portuguese
Write something in a literary style.
```

**Output:**

3-8-1281 O CONDE de Bolonha e seus sucessores do Reino de Portugal, por meio do PREFEITO, que rebocava no Reino de Castella o Titular da Ordem de Cristo, transfiiram e se que fizerem de sua terra e sequestraes e privilegios e dotaes e titulos de tantas villas, pardaes, e castellos, e outras possessoes de caza, como pertences e sequestraes de terra, e sequestraes d'alquem outro senhor, ou d'outros de que fossem titulos, sequestraes e possessoes, que o Conde de Bolonha e seus sucessores tivessem, fra que hoje pertencem s doutrinas e a elles a doutra e a titulo e dota com todos os titulos, e sequestraes, e privilegios que teem hoje, e que o Reino de Portugal lhes dar e que lhes faa por meio do PREFEITO; os quaes e seus sucessores sempre se que fizerem do mencionado Titular da Ordem, o seu representante e dele seu sequestrario, e dele seu sequestrador, e o mencionado titular, de seu representante e de seu sequestrador, sera, e sereis sempre, o nosso representante, e o nosso sequestrador, e o nosso sequestrador, e o nosso representante no Reino de Castella, e fra que hoje permaneceis nas possessoes, titulos, privilegios, e direitos com que se quem de voi permanecessem, hoje em dia, e que hoje frais sereis, como os doutrinas. 4. E tambem o Conde de Bolonha e seus sucessores, por meio do PREFEITO, que rebocava no Reino de Castella o Titular da Ordem de Cristo, transferiram e se que fizerem de todas as doutrinas, e titulos, e dotaes, e sequestraes, que elles e seus sucessores tivessem de terras, e sequestraes, e privilegios de outra parte, ou de outras pessoas, fra que teem hoje, e que hoje demais as terra permanecer em suas posses, e que nos seus direitos permanecessem como eram. 5. E tambem o Conde de Bolonha e seus sucessores, por meio do PREFEITO, que rebocava no Reino de Castella o Titular da Ordem de Cristo, transferiram e se que fizerem de todas as terras, e castellos, e fra que hoje perteneciam ou de outros a quem pertencem, fra que hoje pertencem de toda classe e classe. 6. E tambem o Conde de Bolonha, e seus sucessores, por meio do PREFEITO, que rebocava no Reino de Castella o Titular da Ordem de Cristo, transferiram e se que fizerem de todas as terras e doutrinas, e privilegios de todas as classes, fra que hoje estao e que estao de hoje. 7. E tambem os Condes de Bolonha, e seus sucessores por meio do PREFEITO, que rebocava no Reino de Castella o Titular da Ordem de Cristo, transferiram e se que fizerem d'essas terras, e castellos, e privilegios de todas as classes, fra que hoje permanecessem como estao ou de outros a quem pertencem, fra que hoje estam de hoje em dia. 8. E tambem, e por meio do PREFEITO, que rebocava no Reino de Castella o Titular da Ordem de Cristo, os Reis do Reino de Portugal, que estavam na cidade de Castella, fra que estavam, transferiram, e se que fizer
</details>

## Limitations

- Writing quality varies greatly from "pretty good" to "incoherent gibberish" depending on the prompt and the generation settings
- Output still requires formatting, proofreading, and rewriting
- May not obey every detail in the prompt (similar to Stable Diffusion in text-to-image tasks)
- Can plagiarize well-known writers
- English language bias due to its overrepresentation in the training data
- No particular safety tuning so it may generate outdated or offensive stereotypes due to historical texts, although this hasn't been observed so far

## Training details

For both pretraining and supervised finetuning (SFT):
- rank 32 LoRA in Llama Factory, alpha = 64
- 1 epoch
- NEFTune alpha = 5
- batch size 1
- cutoff 2048 tokens

For SFT, additional settings: pack sequences and neat packing

## Licence

Apache 2.0