sarv-reasoning / README.md
artindnr's picture
Update README.md
36a8e84 verified
|
Raw
History Blame Contribute Delete
4.01 kB
---
license: apache-2.0
language:
- fa
base_model: artindnr/strawberry-1
base_model_relation: finetune
tags:
- persian
- farsi
- poetry
- poem-generation
- reasoning
- chain-of-thought
- gpt-oss
- lora
- sarv
- mixture-of-experts
- mxfp4
- text-generation
- pytorch
- jax
- tf
pipeline_tag: text-generation
---
# 🌲 Sarv-Reasoning
![https://img.magnific.com/free-vector/seamless-hilly-forest-landscape-vector-background-illustration-horizontally-repeatable_8130-3130.jpg?semt=ais_test_b&w=740&q=80](https://img.magnific.com/free-vector/seamless-hilly-forest-landscape-vector-background-illustration-horizontally-repeatable_8130-3130.jpg?semt=ais_test_b&w=740&q=80)
The always-reasoning member of the Sarv family, built on [Strawberry-1](https://huggingface.co/artindnr/strawberry-1) and specialized entirely around visible chain-of-thought for Persian poem generation.
## Model Description
Sarv-Reasoning always populates the Harmony `analysis` channel before producing a poem in `final`. Unlike `sarv-hybrid`/`sarv-hybrid-pro`, reasoning is not learned as an optional behavior — every generation is expected to reason first, making this the model to use when you specifically want to inspect, log, or steer the model's thought process about meter (vazn), rhyme (qafiyeh), refrain (radif), imagery, and emotional arc before the poem itself is written.
- **Base model:** [artindnr/strawberry-1](https://huggingface.co/artindnr/strawberry-1) (`gpt_oss` 21B, MXFP4)
- **Fine-tuning method:** LoRA, merged into base weights for release
- **Reasoning behavior:** always-on — `analysis` channel is populated on every generation
- **Specialization:** reasoning-driven Persian poem generation and poem analysis
- **Language:** Persian (fa)
All training examples retain the `analysis` channel; no non-reasoning examples were included, in contrast to `sarv-hybrid`/`sarv-hybrid-pro`.
## Training Procedure
Single-stage SFT of Strawberry-1 exclusively on reasoning-annotated data, reinforcing consistent `analysis`-then-`final` output structure. Adapters were merged into base weights and exported in BF16 and MXFP4.
## Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "artindnr/sarv-reasoning"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
messages = [
{"role": "user", "content": "غزلی حافظانه درباره‌ی امید بنویس و دلیل انتخاب وزن و قافیه را هم بگو"}
]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt"
).to(model.device)
outputs = model.generate(inputs, max_new_tokens=1536)
full = tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=False)
# Split Harmony channels
analysis, final = full.split("<|channel|>final<|message|>", 1) if "<|channel|>final<|message|>" in full else (None, full)
```
Because reasoning is always present, expect longer generations and higher latency than `sarv-non-reasoning`; budget `max_new_tokens` accordingly.
## Intended Use
- Poem generation where the reasoning behind structural/stylistic choices should be inspectable or logged
- Poem *analysis* and critique tasks (explaining meter, rhyme scheme, imagery of a given poem), leveraging the same reasoning capability
- Research/interpretability work on Persian reasoning traces
- Not recommended where latency is critical — use `sarv-non-reasoning` or let `sarv-hybrid`/`sarv-hybrid-pro` decide
## Limitations
- Always reasons, even for trivial requests, increasing latency and token cost
- Reasoning trace reflects the model's learned justification pattern, not a guaranteed accurate account of its internal computation
- Inherits Strawberry-1/`gpt_oss` base limitations
## License
Apache 2.0, consistent with the base `gpt_oss` license chain.
## Citation
If you use this model, please cite the Sarv and Strawberry-1 model cards on Hugging Face (`artindnr`).