Views
No views yet
Kantharuban et al., IDIOLEX: Unified and Continuous Representations for Idiolectal and Stylistic Variation (preprint, under review). Code: github.com/AnjaliRuban/IdioleX
L = L_CE + α · (1 − cosine_sim(proj(h̄), e_idiolex))AnjaliRuban/idiolex-arabertv2-ar)
is kept frozen throughout training. A two-layer projection head maps from the
LLM's hidden dimension (4096) to the IdioleX embedding dimension (768) and is also
frozen after the first epoch.| Parameter | Value |
|---|---|
| Base model | humain-ai/ALLaM-7B-Instruct-preview |
| IdioleX encoder | AraBERT v2 trained under IDIOLEX framework |
| LoRA rank | 32 |
| LoRA alpha | 32 |
| LoRA target modules | all-linear |
| IdioleX alignment weight (α) | 10.0 |
| Batch size (per device) | 32 |
| Gradient accumulation steps | 1 |
| Learning rate | 2 × 10⁻⁴ |
| LR schedule | Cosine annealing |
| Max sequence length | 512 |
| Epochs | 20 |
| Optimizer | AdamW (weight decay 0.01) |
| Precision | bfloat16 |
| Distributed training | DeepSpeed ZeRO-2, 8 GPUs |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model = AutoModelForCausalLM.from_pretrained(
5 "your-username/idiolex-allam-7b-ar",
6 torch_dtype=torch.bfloat16,
7 device_map="auto",
8)
9tokenizer = AutoTokenizer.from_pretrained("your-username/idiolex-allam-7b-ar")
10
11messages = [{"role": "user", "content": "ترجم للعربية المصرية: How are you doing today?"}]
12inputs = tokenizer.apply_chat_template(
13 messages, return_tensors="pt", add_generation_prompt=True
14).to(model.device)
15
16with torch.no_grad():
17 output = model.generate(inputs, max_new_tokens=256, temperature=0.7, top_p=0.95, do_sample=True)
18
19print(tokenizer.decode(output[0][inputs.shape[1]:], skip_special_tokens=True))1@article{kantharuban2025idiolex,
2 title = {IDIOLEX: Unified and Continuous Representations for Idiolectal and Stylistic Variation},
3 author = {Kantharuban, Anjali and Srivastava, Aarohi and Faisal, Fahim and Ahia, Orevaoghene
4 and Anastasopoulos, Antonios and Chiang, David and Tsvetkov, Yulia and Neubig, Graham},
5 year = {2025},
6 note = {Preprint, under review}
7}