telugu-poem-model
Developed by AGK FIRE INC.
A small Telugu poetry model: Udgam Labs Vemana-Base (278M parameters) fine-tuned on 15,361 Telugu poems, so it writes in the form of Telugu verse — most notably the Vemana satakam style.
What it does
Given the first line of a poem, it continues in Telugu verse: four-line poems, the traditional closing refrain (makutam), and a meaning section when asked. It learned the form of Telugu poetry well. What it does not do is quote unseen poems verbatim — see Evaluation below.
Evaluation (honest result)
Verbatim exact-match test on 40 held-out Vemana poems (first line given as the cue, greedy decoding, exact match after Unicode + whitespace normalisation):
| Model | Verbatim exact match |
|---|---|
| Vemana-Base (base) | 0 / 40 |
| telugu-poem-model (fine-tuned) | 0 / 40 |
The fine-tune did not achieve verbatim recall. That is expected on
reflection: the 40 test poems were excluded from training, so the model never
saw them — fine-tuning on other poems teaches the form, not the content of
poems it has never seen. What changed is visible in the outputs: the fine-tuned
model keeps the cue line, keeps the makutam (విశ్వదాభిరామ వినురవేమ!), and
produces plausible Vemana-style lines and meanings, where the base model
wandered off-form. For accurate verbatim quotes, use retrieval instead —
e.g. the Vemana RAG, which cites poem numbers
from the corpus.
Training data
- Corpus: 15,361 Telugu poems (v3), blank-line separated — Vemana (572), Bhagavatam, Sumati, Dasu, and others.
- Training documents: 16,385 — raw poems (15,321), first-line → poem cues (532), and poem → meaning pairs (532). The 40 evaluation poems were excluded from every document type.
- Dataset: agk4444/telugu-poems-finetune (private).
Training procedure
- Base:
udgamlabs/Vemana-Base(278,214,144 params, Gemma-4 text layout, own 32,000-token SentencePiece tokenizer, Apache-2.0). - 3 epochs, learning rate 5e-5 with cosine decay, 3% warmup.
- Effective batch 32 (micro-batch 2 × 2 GPUs × 8 accumulation steps).
- fp32 weights with fp16 autocast (T4 has no bf16), activation checkpointing.
- Hardware: Kaggle 2× NVIDIA T4, ~1h 56m. Final training loss 2.58 (epoch averages ≈ 2.94 / 2.51 / 2.15).
- Software: transformers 5.23.0, torch, datasets, accelerate.
How to use
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
tok = AutoTokenizer.from_pretrained("agk4444/telugu-poem-model")
model = AutoModelForCausalLM.from_pretrained(
"agk4444/telugu-poem-model", dtype=torch.float32
)
model.eval()
cue = "మొదటి పాదం: అన్న మిడుట కన్న నధిక దానంబుల\nపూర్తి పద్యం:\n"
ids = tok(cue, return_tensors="pt")
out = model.generate(**ids, max_new_tokens=200, do_sample=False)
print(tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True))
The model runs on CPU — see the GGUF section below. Greedy decoding is recommended — sampling drifts off-form quickly at this size.
GGUF (CPU, llama.cpp)
telugu-poem-model-q8_0.gguf (~285 MB, Q8_0) — the same fine-tuned weights,
quantized for CPU inference with llama.cpp.
Verified on CPU at ~22 tokens/sec on 4 threads.
# use llama-completion, not llama-cli: llama-cli wraps the prompt in a chat
# template, which this base-style model does not want
llama-completion -m telugu-poem-model-q8_0.gguf \
-f prompt.txt -n 200 --temp 0 -t 4 -c 1024
with prompt.txt containing:
మొదటి పాదం: అన్న మిడుట కన్న నధిక దానంబుల
పూర్తి పద్యం:
Same model, same 0/40 verbatim result as the transformers weights — the GGUF is a faithful port, not a different model.
Limitations
- No verbatim recall of unseen poems (0/40, see above). Do not use it as a source of quotations.
- Small (278M) base model: it invents lines, sometimes mixes in lines from other poems, and its "meanings" can be plausible but wrong.
- Telugu only. Context 1,024 tokens (~570 Telugu words).
License
Apache-2.0, same as the base model.