⟁ Artha-1.1B v2

Artha (Sanskrit: अर्थ) — "essence", "purpose", "meaning"

A LoRA fine-tune of TinyLlama 1.1B that translates English instructions into Artha, a compact, math-style notation for prompts, with a tokenizer that knows Artha's symbols.

"Please summarise this article in 3 bullet points, focus on key facts"
→ sum[article](#3, fmt:bullets) +facts

"Fix the bug in this Python code and explain what was wrong"
→ fix[code](code:py) -> {diff+explain}

What changed from v1

v1 (siddsukh/artha-1.1b) used TinyLlama's stock tokenizer, so fmt:bullets split into 4 pieces and Artha was about 8% longer than English in tokens. v2 adds 67 Artha symbols (sum[, fmt:bullets, tone:formal, +facts, {diff+explain}, -> …) to the vocabulary as whole tokens, keeping TinyLlama's original 32k vocabulary.

Results

Measured on 1,000 held-out pairs not seen in training, counting tokens of the model's actual output:

Metric Result
Exact match with reference Artha 100%
Token saving vs English, v2 tokenizer 35.4%
Same outputs, stock TinyLlama tokenizer −2.5%

Limitations

  • Training and test data come from the same templates (9 action types), so the 100% exact match shows template mastery, not robustness to free-form English.
  • The token saving applies only to models that use this tokenizer. Hosted LLMs (GPT, Claude, …) tokenize Artha with their own vocabularies.
  • The saving is on the instruction only. With a document attached, the share of total tokens saved is small.

Training

  • Base model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
  • Tokenizer: TinyLlama vocab + 3 special tokens + 67 Artha atoms (with leading-space variants), non-legacy spacing
  • New embeddings initialised from the mean of their original sub-pieces
  • LoRA r=16, alpha=32, dropout 0.05 on q/k/v/o projections; embed_tokens and lm_head fully trained
  • Loss on Artha output only; 2 epochs, learning rate 2e-4, cosine schedule
  • Data: deduplicated synthetic English↔Artha pairs, 1,000 held out for test

Usage

from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch

REPO = "siddsukh/artha-1.1b-v2"
tok = AutoTokenizer.from_pretrained(REPO)
base = AutoModelForCausalLM.from_pretrained(
    "TinyLlama/TinyLlama-1.1B-Chat-v1.0", dtype=torch.bfloat16, device_map="auto"
)
base.resize_token_embeddings(len(tok), mean_resizing=False)
model = PeftModel.from_pretrained(base, REPO).eval()
END_ID = tok.convert_tokens_to_ids("<|end|>")

def compress(prompt):
    enc = tok(f"<|artha|>\n{prompt}\n<|compress|>\n", return_tensors="pt").to(model.device)
    with torch.no_grad():
        out = model.generate(**enc, max_new_tokens=48, do_sample=False,
                             eos_token_id=END_ID, pad_token_id=tok.eos_token_id)
    return tok.decode(out[0, enc["input_ids"].shape[1]:], skip_special_tokens=True).strip()

print(compress("Please summarise this in 3 bullet points, focus on facts"))

Links

Downloads last month
28
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for siddsukh/artha-1.1b-v2

Adapter
(1,626)
this model