Gemini actually knows nothing about Tunisian folk poetry until

PromptCube Intermediate 1h ago 340 views 12 likes 2 min read

Tunisian folk poetry is essentially a ghost in the training sets of most frontier models. If you ask a standard LLM about Arabic poetry, it will give you a brilliant lecture on classical verse because that data is everywhere, but the moment you pivot to the specific rhythms and dialectal nuances of Tunisian folk traditions, the model starts hallucinating or defaulting to generic Arabic. I decided to fix this by using a combination of SFT (Supervised Fine-Tuning) and RL (Reinforcement Learning) to see if a model could actually "learn" a niche cultural tradition from scratch.

The SFT Phase

The first hurdle was the data scarcity. Since there isn't a massive open-source corpus of Tunisian folk poetry, I had to curate a high-quality, small-scale dataset. The goal here wasn't just to give the model examples, but to teach it the structural constraints of the poetry.

1. Dataset Curation: I gathered a few hundred authentic poems and paired them with detailed linguistic explanations.
2. Prompt Engineering: Instead of simple "complete this poem" prompts, I used a format that explained the meter and the specific regional dialectal markers.
3. Fine-Tuning: I ran the SFT process to shift the model's internal probability distribution. This stopped the model from constantly correcting "incorrect" dialectal spelling back into Modern Standard Arabic.

Moving to RL for Nuance

SFT gets the model to mimic the style, but it doesn't necessarily make the poetry "good" or culturally resonant. That's where Reinforcement Learning comes in. I set up a reward model based on three specific criteria: adherence to the folk meter, use of authentic regional vocabulary, and the avoidance of classical Arabic clichés.

The process looked like this:

  • The model generates five variations of a poem based on a theme.
  • A human-in-the-loop (or a highly tuned critic model) ranks them.
  • The reward signal pushes the model toward the "folk" identity and away from the "academic" identity.
Gemini actually knows nothing about Tunisian folk poetry until

The Technical Takeaway

The most interesting part of this AI workflow was seeing the tension between the model's pre-existing knowledge and the new fine-tuned data. Gemini has a massive "gravity" toward standard Arabic. To overcome this, you can't just provide examples; you have to actively penalize the model for being "too correct" in a formal sense.

For anyone attempting a similar deep dive into niche languages or dialects, the lesson is that SFT provides the vocabulary, but RL provides the "soul" or the stylistic intuition. If you're building an LLM agent for cultural preservation, don't stop at fine-tuning. The reward function is where the actual personality of the agent is forged. This approach turned a model that was guessing into one that could actually compose verse that felt authentic to the region.

GeminiRLHFTunisian PoetrySFT

All Replies (3)

T
TaylorDreamer Intermediate 1h ago
Does it handle the dialect better if you prompt it in Derja instead of MSA?
0 Reply
D
Drew36 Advanced 1h ago
Feeding it a few actual poem snippets first helps it recognize the patterns way faster.
0 Reply
D
DrewCoder Novice 1h ago
Had the same issue with Maltese folk songs. Prompting in the local dialect usually helps.
0 Reply

Write a Reply

Markdown supported