You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

Gemma 3 270M IT Fine-tuned for Sinhala Spell Correction

A Gemma 3 270M IT model fine-tuned for Sinhala spell correction as part of the LMSpell project.

Model Details

  • Base model: unsloth/gemma-3-270m-it
  • Model type: Fine-tuned model
  • Language: Sinhala (si)
  • Task: Sinhala Spell Correction (SSC)
  • Training method: Supervised Fine-Tuning (SFT)
  • Dataset: Sinhala Spell Correction Dataset
  • License: CC BY 4.0
  • Project: LMSpell

Uses

Direct Use

The model can be used to correct spelling errors in Sinhala text.

Out-of-Scope Use

The model is not intended for languages other than Sinhala or for tasks unrelated to spell correction.

Limitations

  • Performance may vary across different domains and text styles.
  • The model may occasionally modify text that is already correctly spelled.
  • Performance may be lower on informal, code-mixed, or domain-specific text.

How to Get Started

1. Model Loading

from transformers import AutoTokenizer, AutoModelForCausalLM

model_name = "lm-spell/gemma3-270m-it-ft-ssc"

tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)

tokenizer.pad_token = tokenizer.eos_token

2. Inference

import re

def clean_text(text):
    match = re.search(r'### Output:\n(.*)', text, re.DOTALL)
    if match:
        return match.group(1).replace("Text:\n", "").replace("Output:\n", "").replace("###", "").strip()
    return text.strip()

alpaca_prompt = f"""You are an Expert Sinhala Spell Corrector. Below is a sentence in Sinhala Language. It may or may not have a spelling mistake. Give the corrected output in Sinhala.

### Text:
{{}}

### Output:
{{}}"""

text = "เถบเท’เถฑเทŠ เท„เทเถŸเท™เถฑเทŠเถฑเทš เถดเท€เถญเทŠเถฑเท เถ…เถฐเทŠโ€เถบเทเถดเถฑ เถšเทŠโ€เถปเถธเถบเทš เถดเท€เถญเท’เถฑ เถ‹เทƒเทƒ เถธเถงเทŠเถงเถธเถบ ."

inputs = tokenizer(
    [alpaca_prompt.format(text, "")],
    return_tensors="pt"
)

outputs = model.generate(**inputs)

pred_text = tokenizer.decode(
    outputs[0],
    skip_special_tokens=True
)

print(clean_text(pred_text))

Training Details

Training Data

The model was fine-tuned using the Sinhala Spell Correction Dataset.

Training Procedure

The model was fine-tuned using Supervised Fine-Tuning (SFT) with Unsloth.

Evaluation

The model was evaluated for Sinhala spell correction using the evaluation datasets and metrics described in the LMSpell paper.

For detailed training methodology, dataset preparation, evaluation results, and comparisons with other models, please refer to the paper.

Research

LMSpell: Spell Correction with Pre-Trained Language Models

A. Gunathilake, N. Karunarathna, T. Bandaranayake, S. Ranathunga, N. de Silva and N. Jayatilleke, "LMSpell: Spell Correction with Pre-Trained Language Models," 2026 Moratuwa Engineering Research Conference (MERCon), Moratuwa, Sri Lanka, 2026, pp. 503-508.

Citation

@INPROCEEDINGS{11691371,
  author={Gunathilake, Akesh and Karunarathna, Nadil and Bandaranayake, Tharusha and Ranathunga, Surangika and de Silva, Nisansa and Jayatilleke, Nevidu},
  booktitle={2026 Moratuwa Engineering Research Conference (MERCon)},
  title={LMSpell: Spell Correction with Pre-Trained Language Models},
  year={2026},
  pages={503-508},
  doi={10.1109/MERCon71835.2026.11691371}
}
Downloads last month
-
Safetensors
Model size
0.3B params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for lm-spell/gemma3-270m-it-ft-ssc

Finetuned
(420)
this model

Dataset used to train lm-spell/gemma3-270m-it-ft-ssc