Subject: Artificial Intelligence and Neural Networks
Group: AAI-2502M
Authors: Darhan Omirbay, Alisher Khairullin
Fine-tuned RuGPT-3 Large (760M parameters) on a synthetic corpus of 5,500 Russian business letter pairs using LoRA via transformers + peft. The model generates formal business letter replies from an incoming letter + instruction prompt.
variant12/
├── ainn_final_project (1).ipynb # Full pipeline: data gen → training → eval
├── app.py # Streamlit demo app
├── data/
│ ├── train.json # 5,000 training pairs
│ ├── val.json # 250 validation pairs
│ └── test.json # 250 test pairs
├── lora_adapter/ # Trained LoRA adapter (5k dataset)
├── lora_adapter_500/ # Experimental adapter (500 samples)
└── pyproject.toml
5,500 synthetic Alpaca-style pairs generated with Python templates.
| Split | Size |
|---|---|
| Train | 5,000 |
| Val | 250 |
| Test | 250 |
5 letter categories (equal distribution):
запрос_информации — information requestsжалоба — complaintsкоммерческое_предложение — commercial proposalsуведомление — notificationsсогласование — approvals3 response styles per category: вежливое · краткое · настойчивое
Format (Alpaca-style):
{
"instruction": "Составьте вежливый профессиональный ответ...",
"input": "Уважаемые коллеги,\nПрошу предоставить...",
"output": "Уважаемый(-ая) А.В. Петрова,\n\nБлагодарим...",
"category": "запрос_информации",
"style": "вежливое"
}
Base model: ai-forever/rugpt3large_based_on_gpt2 (760M params)
Method: LoRA (FP16) via peft + transformers
Training time: 71.7 minutes (Apple MPS)
| Parameter | Value |
|---|---|
lora_r | 8 |
lora_alpha | 16 |
lora_dropout | 0.05 |
| Target modules | c_attn |
| Trainable params | 1,179,648 (0.15%) of 761M |
| Parameter | Value |
|---|---|
| Epochs | 3 |
| Learning rate | 2×10⁻⁴ |
| Batch size (effective) | 16 (4 × grad_accum=4) |
| Max sequence length | 256 |
| LR scheduler | cosine |
| Precision | FP16 |
pip install transformers peft datasets accelerate torch streamlit
# or with uv:
uv sync
streamlit run app.py
The app loads the LoRA adapter from ./lora_adapter/ and provides an interactive UI to generate business letter replies.
Open ainn_final_project (1).ipynb and run all cells sequentially.
Evaluated on 30 samples from data/test.json covering all category × style combinations. Scoring is automated via a formal-marker rubric (see notebook).
| Criterion | Mean | Scale |
|---|---|---|
| Style (деловой стиль) | 4.50 | 1–5 |
| Relevance (релевантность) | 4.57 | 1–5 |
| No hallucinations (отсутствие галлюцинаций) | 4.77 | 1–5 |
| Overall | 4.61 | 1–5 |
Complaints (жалоба) scored slightly lower (assertive emotional tone is harder to model with a 760M parameter base).
Measured with 10 greedy-decoding runs on a fixed benchmark letter.
| Metric | Value |
|---|---|
| Avg latency | ~5–15 sec (CPU/MPS) |
| Tokens/sec | measured in notebook |
Run the benchmark cell in the notebook to get exact numbers for your hardware.
2 commits
Jupyter Notebook
77.9%
Python
11.3%
TeX
10.8%
Subject: Artificial Intelligence and Neural Networks
Group: AAI-2502M
Authors: Darhan Omirbay, Alisher Khairullin
Fine-tuned RuGPT-3 Large (760M parameters) on a synthetic corpus of 5,500 Russian business letter pairs using LoRA via transformers + peft. The model generates formal business letter replies from an incoming letter + instruction prompt.
variant12/
├── ainn_final_project (1).ipynb # Full pipeline: data gen → training → eval
├── app.py # Streamlit demo app
├── data/
│ ├── train.json # 5,000 training pairs
│ ├── val.json # 250 validation pairs
│ └── test.json # 250 test pairs
├── lora_adapter/ # Trained LoRA adapter (5k dataset)
├── lora_adapter_500/ # Experimental adapter (500 samples)
└── pyproject.toml
5,500 synthetic Alpaca-style pairs generated with Python templates.
| Split | Size |
|---|---|
| Train | 5,000 |
| Val | 250 |
| Test | 250 |
5 letter categories (equal distribution):
запрос_информации — information requestsжалоба — complaintsкоммерческое_предложение — commercial proposalsуведомление — notificationsсогласование — approvals3 response styles per category: вежливое · краткое · настойчивое
Format (Alpaca-style):
{
"instruction": "Составьте вежливый профессиональный ответ...",
"input": "Уважаемые коллеги,\nПрошу предоставить...",
"output": "Уважаемый(-ая) А.В. Петрова,\n\nБлагодарим...",
"category": "запрос_информации",
"style": "вежливое"
}
Base model: ai-forever/rugpt3large_based_on_gpt2 (760M params)
Method: LoRA (FP16) via peft + transformers
Training time: 71.7 minutes (Apple MPS)
| Parameter | Value |
|---|---|
lora_r | 8 |
lora_alpha | 16 |
lora_dropout | 0.05 |
| Target modules | c_attn |
| Trainable params | 1,179,648 (0.15%) of 761M |
| Parameter | Value |
|---|---|
| Epochs | 3 |
| Learning rate | 2×10⁻⁴ |
| Batch size (effective) | 16 (4 × grad_accum=4) |
| Max sequence length | 256 |
| LR scheduler | cosine |
| Precision | FP16 |
pip install transformers peft datasets accelerate torch streamlit
# or with uv:
uv sync
streamlit run app.py
The app loads the LoRA adapter from ./lora_adapter/ and provides an interactive UI to generate business letter replies.
Open ainn_final_project (1).ipynb and run all cells sequentially.
Evaluated on 30 samples from data/test.json covering all category × style combinations. Scoring is automated via a formal-marker rubric (see notebook).
| Criterion | Mean | Scale |
|---|---|---|
| Style (деловой стиль) | 4.50 | 1–5 |
| Relevance (релевантность) | 4.57 | 1–5 |
| No hallucinations (отсутствие галлюцинаций) | 4.77 | 1–5 |
| Overall | 4.61 | 1–5 |
Complaints (жалоба) scored slightly lower (assertive emotional tone is harder to model with a 760M parameter base).
Measured with 10 greedy-decoding runs on a fixed benchmark letter.
| Metric | Value |
|---|---|
| Avg latency | ~5–15 sec (CPU/MPS) |
| Tokens/sec | measured in notebook |
Run the benchmark cell in the notebook to get exact numbers for your hardware.
2 commits
Jupyter Notebook
77.9%
Python
11.3%
TeX
10.8%