Instructions to use ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("ethicalabs/Echo-DSRN-114M-v0.1.2") model = PeftModel.from_pretrained(base_model, "ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT") - Transformers
How to use ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT
- SGLang
How to use ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT with Docker Model Runner:
docker model run hf.co/ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT
Model Card for ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT
The Echo-DSRN(N) (Dual State Recurrent Neural Network, short name: Echo-DSRN, also know as echo) is a novel architecture specifically designed to be a viable alternative for low-resource tasks ("smol" tasks) that are currently being inefficiently handled by the excessive scale of Large Language Models (LLMs) 🌱
This LoRA adapter has been fine-tuned by using the Flower Framework and TRL in a simulated federated learning scenario.
Model Usage
You can load the fine-tuned PEFT adapter over the base model and run sentiment analysis inference as follows:
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load the base model and tokenizer
base_model_name = "ethicalabs/Echo-DSRN-114M-v0.1.2"
base_model = AutoModelForCausalLM.from_pretrained(base_model_name, trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(base_model_name, trust_remote_code=True)
# Load the fine-tuned PEFT adapter
peft_model_name = "ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT"
model = PeftModel.from_pretrained(base_model, peft_model_name, trust_remote_code=True)
# Prepare the prompt for sentiment analysis
instruction = "What is the sentiment of this news? Please choose an answer from {negative/neutral/positive}."
news_text = "The company reported a 20% increase in revenue for the third quarter, driven by strong sales in the tech division."
messages = [
{"role": "system", "content": "You are a helpful financial assistant."},
{"role": "user", "content": f"{instruction} {news_text}"}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
# Tokenize and generate
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=10)
response = tokenizer.decode(outputs[0], skip_special_tokens=False)
print(response.split("<|assistant|>")[1].replace("<|end|>", "").strip() if "<|assistant|>" in response else response)
Training
Trained on a single AMD Radeon™ AI PRO R9700 (32 GB RAM).
You can download the source code and reproduce the training process by simply running the following commands:
# Downloads the flower app from Flower Hub
flwr new @mrs83/echo-dsrn-114m-finance
# Federation Local Setup
flwr federation simulation-config \
--num-supernodes=10 \
--client-resources-num-cpus=6 \
--client-resources-num-gpus=1.0
# Runs the federation and streams training log output.
flwr run --stream
Source code is available on the Flower Hub
🏗️ Architecture Details
| Property | Value |
|---|---|
| Model Type | echo_dsrn |
| Layers | 8 |
| Hidden Dim | 512 |
| Attention Heads | 4 |
| MLP Ratio | 8.0 |
| Vocab Size | 32011 |
| Hybrid Attention | True |
| RMSNorm | True |
📊 Parameter Breakdown
| Component | Parameters | % of Total |
|---|---|---|
| Total | 114.69M (114,687,488) | 100% |
| Embeddings | 16.39M | 14.29% |
| DSRN Blocks (Aggregate) | 81.91M | 71.42% |
| LM Head | 16.39M | 14.29% |
🧩 Internal Block Structure (Per Layer)
| Sub-Component | Parameters | Description |
|---|---|---|
| MLP (Feed-Forward) | 4.20M | Upscaled hidden layers |
| DSRN Slow State | 3.15M | Constant-time memory gates |
| GRU Fast State | 1.58M | Recurrent fast path |
| Surprise Gating | 264,192 | Dynamic focus mechanism |
| Normalization | 1,024 | LayerNorm / RMSNorm |
Evaluation
To evaluate the best federated checkpoint (e.g., round 38) across the financial benchmarks (FPB, FIQA, TFNS), use the integrated evaluation script:
python echo_finance/eval.py \
--base-model-name-path ethicalabs/Echo-DSRN-114M-v0.1.2 \
--peft-path ~/.ethicalabs/flwr/results/[RUN_TIMESTAMP]/peft_38 \
--datasets fpb,fiqa,tfns \
--apply-chat-template
Note: The
--apply-chat-templateflag ensures the model is evaluated accurately using the structural ChatML format it was aligned on.
Benchmarks
| Dataset | Sentiment Accuracy |
|---|---|
| FPB (Financial PhraseBank) | 71.45% |
| TFNS (Twitter Financial News Sentiment) | 70.14% |
| FIQA (Financial QA) | 63.82% |
Citations
@software{vonwerra2020trl,
title = {{TRL: Transformers Reinforcement Learning}},
author = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
license = {Apache-2.0},
url = {https://github.com/huggingface/trl},
year = {2020}
}
@misc{gao2025flowertune,
title = {FlowerTune: A Cross-Domain Benchmark for Federated Fine-Tuning of Large Language Models},
author = {Yan Gao and Massimo Roberto Scamarcia and Javier Fernandez-Marques and Mohammad Naseri and Chong Shen Ng and Dimitris Stripelis and Zexi Li and Tao Shen and Jiamu Bai and Daoyuan Chen and Zikai Zhang and Rui Hu and InSeo Song and Lee KangYoon and Hong Jia and Ting Dang and Junyan Wang and Zheyuan Liu and Daniel Janes Beutel and Lingjuan Lyu and Nicholas D. Lane},
year = {2025},
eprint = {2506.02961},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
url = {https://arxiv.org/abs/2506.02961}
}
@misc{Massimo Roberto Scamarcia, title={Echo-DSRN-114M: Surprise-Gated Dual-State Recurrent Architecture for Efficient Language Modeling and Classification}, DOI={10.5281/zenodo.19848279}, publisher={Zenodo}, author={Massimo Roberto Scamarcia} }
Framework versions
- TRL: 1.1.0
- Transformers: 5.2.0
- Pytorch: 2.10.0+rocm7.1
- Datasets: 4.8.4
- Tokenizers: 0.22.2
- Downloads last month
- 32
Model tree for ethicalabs/FlowerTune-Echo-DSRN-114M-Finance-PEFT
Base model
ethicalabs/Echo-DSRN-114M-v0.1.2-Base