Instructions to use Mostafa190/twina-o1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mostafa190/twina-o1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Mostafa190/twina-o1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Mostafa190/twina-o1") model = AutoModelForCausalLM.from_pretrained("Mostafa190/twina-o1", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Mostafa190/twina-o1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Mostafa190/twina-o1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mostafa190/twina-o1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Mostafa190/twina-o1
- SGLang
How to use Mostafa190/twina-o1 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 "Mostafa190/twina-o1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mostafa190/twina-o1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "Mostafa190/twina-o1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mostafa190/twina-o1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Mostafa190/twina-o1 with Docker Model Runner:
docker model run hf.co/Mostafa190/twina-o1
TWINA-O1 - Twinny.AI Intelligence Architecture v1
TWINA-O1 is a Persona-Aware Language Model (PALM) developed by the Twinny.AI team. It is built on top of Meta's LLaMA 3.1 8B Instruct and fine-tuned using Low-Rank Adaptation (LoRA) on a proprietary behavioral dataset of 40,062 training examples spanning 407 distinct professional persona archetypes.
Unlike general-purpose language models that generate contextually plausible but behaviorally generic text, TWINA-O1 is specifically optimized to replicate how a particular type of person, defined by their age, seniority, personality, risk tolerance, formality level, and decision-making style - communicates and decides in real professional scenarios.
TWINA-O1 is the core AI engine of the Twinny.AI Digital Twin Platform, which enables users to create a persistent AI persona that drafts responses, manages workflows, and prepares recommendations on their behalf, while keeping all consequential actions under human approval and control.
TWINNY.AI: twinny-ai.rf.gd
Dataset: Mostafa190/TwinnyAI-Personas-Dataset
Model Details
| Field | Value |
|---|---|
| Developed by | TWINNY.AI AI Team - Mostafa Abdelhamed, Marina Hany, Mariam Hossameldin, Aya Gamal |
| Institution | SU Tech Elsewedy University - Data Science & AI |
| Model type | Causal Language Model (Decoder-only) |
| Base model | meta-llama/Meta-Llama-3.1-8B-Instruct |
| Fine-tuning method | LoRA (Low-Rank Adaptation) via Unsloth |
| Language | English |
| License | LLaMA 3.1 Community License |
| Release date | April 2026 |
| Model size | ~9.1 GB (merged, safetensors) |
What Makes TWINA-O1 Different
Standard LLMs are trained to serve everyone, which means they serve no specific person well. TWINA-O1 was designed around a fundamentally different objective: behavioral fidelity to a defined persona.
The model encodes the following behavioral dimensions as first-class training signals:
- Communication style : formality level, vocabulary range, sentence rhythm, and structural conventions
- Decision-making patterns : autonomy level, risk orientation, approval-seeking behavior, and commitment thresholds
- Persona differentiation : the ability to produce responses that are genuinely distinct across different professional archetypes, not just stylistically varied
- Decision clarity : replicating whether a persona characteristically hedges, escalates, approves, or defers in professional scenarios
Training Details
Dataset
TWINA-O1 was fine-tuned on the Twinny.AI Personas Dataset - a proprietary behavioral dataset developed by the AI team at TWINNY.AI using a structured survey methodology.
| Attribute | Value |
|---|---|
| Dataset | Mostafa190/TwinnyAI-Personas-Dataset |
| Total examples | 40,062 |
| Persona archetypes | 407 |
| Format | JSONL (instruction-response pairs) |
| Coverage | Communication preferences, decision patterns, approval behavior, professional interaction style |
Each persona archetype is characterized by a combination of: age range, seniority level, industry domain, personality dimensions (risk tolerance, autonomy, empathy), formality preference, and decision-making style.
Training Configuration
| Hyperparameter | Value |
|---|---|
| Base model | meta-llama/Meta-Llama-3.1-8B-Instruct |
| Fine-tuning method | LoRA (Low-Rank Adaptation) |
| LoRA rank (r) | 16 |
| LoRA alpha | 32 |
| LoRA dropout | 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj |
| Training steps | 1,192 |
| Learning rate | 2e-4 (cosine annealing) |
| Max sequence length | 2,048 tokens |
| Precision | bf16 mixed precision |
| Optimization library | Unsloth |
| Training infrastructure | Kaggle GPU (NVIDIA T4) |
| Training loss (final) | 0.4602 |
| Validation loss (final) | 0.4164 lower than training loss, confirming generalization |
The fact that validation loss is lower than training loss is the key technical quality signal: it confirms that the model learned transferable behavioral patterns rather than memorizing training examples.
Evaluation
TWINA-O1 was evaluated against the unmodified LLaMA 3.1 8B Instruct base model across six behavioral dimensions using three representative test personas: a cautious legal executive (age 51–58), a bold tech startup founder (age 29–35), and an empathetic healthcare manager (age 43–50).
Results
| Dimension | Base Model | TWINA-O1 | Change | Notes |
|---|---|---|---|---|
| Persona Differentiation | 66.0% | 88.7% | +22.7pp | Primary capability (strong) |
| Response Coherence | 65.0% | 89.3% | +24.3pp | On-topic generation (strong) |
| Decision Clarity | 72.0% | 82.0% | +10.0pp | Autonomy contrast (good) |
| Structural Quality | 78.0% | 83.3% | +5.3pp | Format adaptation (moderate) |
| Naturalness | 100.0% | 93.3% | −6.7pp | Intentional trade-off (see note) |
| Formality Alignment | 74.0% | 70.0% | −4.0pp | (Next Phase) calibration target |
| Overall Average | 72.0% | 81.0% | +9.0pp | Strong first-run result |
Note on Naturalness: The base model scored 100% by consistently producing smooth, generic text. TWINA-O1's lower score reflects the intentional introduction of persona-specific quirks and behavioral markers, the exact feature the model is designed to produce. A slight reduction in generic polish in exchange for authentic behavioral distinctiveness is the intended trade-off.
How to Get Started
Basic Inference
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "Mostafa190/twina-o1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
persona = """
You are generating a professional response on behalf of a specific person.
PERSONA:
- Role: Senior Legal Executive
- Age range: 51–58
- Seniority: C-Suite / Director level
- Communication style: Formal, precise, measured
- Risk tolerance: Low — prefers caution and process compliance
- Decision autonomy: Low — seeks approval before committing
- Tone: Professional, deflective under pressure, uses passive constructions
"""
scenario = "A client has emailed asking why their contract deliverable is two weeks late. Write a reply."
messages = [
{"role": "system", "content": persona},
{"role": "user", "content": scenario}
]
input_ids = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
with torch.no_grad():
output = model.generate(
input_ids,
max_new_tokens=512,
temperature=0.7,
do_sample=True,
repetition_penalty=1.1
)
response = tokenizer.decode(output[0][input_ids.shape[-1]:], skip_special_tokens=True)
print(response)
With Writing Samples (RAG-Augmented - Recommended)
For best results, inject samples of the specific user's actual writing into the system prompt before the scenario. This is the approach used in the full Twinny.AI platform:
writing_samples = """
WRITING STYLE EXAMPLES (from this person's actual correspondence):
Example 1:
"Please be advised that the matter is currently under internal review.
We will revert once the relevant approvals have been obtained."
Example 2:
"I would recommend deferring any further action until we have had the
opportunity to consult with the wider team on the implications."
"""
persona_with_samples = persona + "\n\n" + writing_samples
Intended Uses
Direct Use
TWINA-O1 is designed for deployment within the Twinny.AI platform to generate persona-accurate professional communication drafts across email, messaging, and workplace scenarios.
Downstream Use
The model can be fine-tuned further on individual user writing samples for one-of-one personalization, or integrated into RAG pipelines where retrieved writing samples augment the system prompt at inference time.
Out-of-Scope Use
TWINA-O1 is not designed for:
- General-purpose question answering or knowledge retrieval
- Code generation
- Impersonating real, named individuals without their explicit consent
- Any deceptive, manipulative, or unauthorized communication on behalf of others
Bias, Risks, and Limitations
- Persona coverage: The 407 archetypes in the training dataset represent structured professional personas. The model may perform less accurately on personas that fall outside the distribution of the training data (e.g., highly niche industries or unusual communication styles).
- Language: The current model is trained exclusively on English-language data. Arabic-language support is planned via the forthcoming ZAT-A1 model.
- Impersonation risk: The model's ability to replicate communication style creates potential for misuse in impersonation scenarios. Deployment within the Twinny.AI platform includes explicit consent flows and human-in-the-loop approval to mitigate this risk.
- Naturalness trade-off: As documented in the evaluation, TWINA-O1 sacrifices some generic fluency in favor of behavioral authenticity. This is intentional for the platform's use case but may not be appropriate for applications requiring maximally smooth, generic text.
Environmental Impact
| Parameter | Value |
|---|---|
| Hardware | NVIDIA T4 GPU (Kaggle) |
| Training duration | ~7-10 hours |
| Cloud provider | Google (Kaggle) |
| Estimated CO₂ emissions | Low (single GPU, short training run) |
Carbon emissions can be estimated using the Machine Learning Impact calculator.
Citation
If you use TWINA-O1 or the Twinny.AI Personas Dataset in your research or projects, please cite:
@misc{twina-o1-2026,
title = {TWINA-O1: A Persona-Aware Language Model for Behavioral Personalization and Digital Twin Applications},
author = {Abdelhamed, Mostafa and Hany, Marina and Hossameldin, Mariam and Gamal, Aya and Hashem, Shahd and Hossam, Hoda and Nashaat, Arsanious},
institution = {SU Tech Elsewedy University},
year = {2026},
url = {https://huggingface.co/Mostafa190/twina-o1}
}
Related work:
Hany M., Gamal A., Elgezawy A., Hashem S., Abdelhamed M., Hossam H., Nashaat A., Hossameldin M. (2026). SLR on Large Language Models and AI Chatbots: Architectures, Taxonomies, and Comparative Analysis. Elsewedy University of Technology.
Model Card Authors
| Name | Role | Institution |
|---|---|---|
| Mostafa Abdelhamed | Founder & AI Lead | SU Tech Elsewedy University |
Contact: twinny-ai.rf.gd · Twinny.AI Personas Dataset
- Downloads last month
- 4
Model tree for Mostafa190/twina-o1
Base model
meta-llama/Llama-3.1-8B