GenZ Translator v2 β ONNX
ONNX exports of GenZ Translator v2, a compact 29.65-million-parameter model that translates Gen Z slang and informal internet language into clear, standard English.
This repository distributes two ONNX precision variants of the model. The original Transformers checkpoint, tokenizer, training information, evaluation results, and full model description are in the base model repository.
Task direction: Gen Z slang β standard English. This is a focused, single-turn translator, not a chatbot or a general-purpose language model.
Files in this repository
| File | Description |
|---|---|
model_int16.onnx |
16-bit ONNX variant. See the precision note below before assuming whether this means FP16 weights or integer-16 quantization. |
model_int8.onnx |
INT8 dynamically quantized ONNX variant. |
Precision and quantization notes
- The INT8 graph was created using ONNX Runtime dynamic quantization with
QInt8, per-channel quantization, and theMatMulandGemmoperators selected for quantization. - In the local export measured for this release, the FP32 ONNX graph was 113.30 MB and the INT8 graph was 39.10 MB, a 65.49% reduction in file size. These are local artifact measurements, not a benchmark of translation quality or runtime speed.
- The
model_int16.onnxfilename identifies it as the 16-bit variant, but the exact numerical representation and conversion settings are not documented here. Do not assume it is FP16 or signed INT16 until the conversion script or graph initializers have been checked. - No independent accuracy evaluation is currently reported for either quantized ONNX variant. The quality numbers below belong to the PyTorch v2 checkpoint and must not be presented as measured INT8/INT16 results.
Model overview
| Property | Value |
|---|---|
| Model | GenZ Translator v2 |
| Base checkpoint | Sankar-2910/genz-translator |
| Architecture | Llama-style decoder-only Transformer |
| Parameters | 29,653,568 |
| Layers | 7 |
| Hidden size | 448 |
| Attention heads | 7 |
| KV heads | 7 |
| Intermediate size | 1,792 |
| Context length | 384 tokens |
| Vocabulary | 8,000 |
| Tokenizer | Custom Byte-Level BPE (downloaded from the base model repository) |
| ONNX interface | input_ids, attention_mask, position_ids β logits |
| Intended use | Single-turn slang translation |
The source architecture has separate input embeddings and output-head weights (tie_word_embeddings=False).
Intended use
Suitable for
- Translating common internet abbreviations such as
WYD,tbh,omw,ty, andnp. - Rewriting informal messages into standard English.
- Interpreting common Gen Z expressions in context.
- Processing short social-media captions and messages.
- Experiments with compact language models and local ONNX inference.
Not designed for
- General-purpose conversation or chatbot use.
- Coding, mathematical reasoning, or knowledge retrieval.
- Long-context conversations.
- Reliable interpretation of every regional, multilingual, or rapidly evolving slang expression.
Input format β important
The model was trained to receive an instruction-style prompt. Do not pass only the raw sentence as the model input. Use this exact structure, replacing YOUR TEXT with the input to translate:
<s><|instruction|>Translate the following Gen Z slang sentence into clear, standard English.<|input|>YOUR TEXT<|response|>
The tokenizer is stored in the base model repository. The example below loads it from there and downloads the selected ONNX graph from this repository.
Quick start: ONNX Runtime (Python)
Install the dependencies:
pip install -U onnxruntime huggingface_hub transformers numpy
Run inference with the INT8 graph:
import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
from transformers import AutoTokenizer
ONNX_REPO = "Sankar-2910/genz-translator-onnx"
BASE_REPO = "Sankar-2910/genz-translator"
MODEL_FILE = "model_int8.onnx" # Change to "model_int16.onnx" for the 16-bit artifact.
# The tokenizer and its special tokens come from the original model repository.
tokenizer = AutoTokenizer.from_pretrained(BASE_REPO)
# Download the selected ONNX graph from this repository.
model_path = hf_hub_download(
repo_id=ONNX_REPO,
filename=MODEL_FILE,
)
session = ort.InferenceSession(
model_path,
providers=["CPUExecutionProvider"],
)
def translate(text: str, max_new_tokens: int = 96) -> str:
if not isinstance(text, str) or not text.strip():
raise ValueError("text must be a non-empty string")
if max_new_tokens < 1:
raise ValueError("max_new_tokens must be at least 1")
prompt = (
"<s><|instruction|>"
"Translate the following Gen Z slang sentence into clear, standard English."
"<|input|>" + text +
"<|response|>"
)
encoded = tokenizer(
prompt,
add_special_tokens=False,
return_tensors="np",
)
input_ids = encoded["input_ids"].astype(np.int64, copy=False)
prompt_length = input_ids.shape[1]
generated_ids = []
eos_id = tokenizer.eos_token_id
# The model context window is 384 tokens, including the prompt.
for _ in range(max_new_tokens):
sequence_length = input_ids.shape[1]
if sequence_length >= 384:
break
attention_mask = np.ones_like(input_ids, dtype=np.int64)
position_ids = np.arange(sequence_length, dtype=np.int64)[None, :]
logits = session.run(
["logits"],
{
"input_ids": input_ids,
"attention_mask": attention_mask,
"position_ids": position_ids,
},
)[0]
next_token_id = int(np.argmax(logits[0, -1, :]))
if eos_id is not None and next_token_id == eos_id:
break
generated_ids.append(next_token_id)
input_ids = np.concatenate(
[input_ids, np.array([[next_token_id]], dtype=np.int64)],
axis=1,
)
return tokenizer.decode(
generated_ids,
skip_special_tokens=True,
).strip()
print(translate("WYD"))
print(translate("tbh, that movie was mid"))
print(translate("omw, traffic is crazy"))
For the 16-bit artifact, change MODEL_FILE to "model_int16.onnx".
ONNX graph interface
The exported graph accepts the following inputs:
| Input | Shape | Purpose |
|---|---|---|
input_ids |
[batch_size, sequence_length] |
Token IDs from the base model tokenizer |
attention_mask |
[batch_size, sequence_length] |
Marks non-padding input tokens |
position_ids |
[batch_size, sequence_length] |
Position index for each token |
It returns:
| Output | Shape | Purpose |
|---|---|---|
logits |
[batch_size, sequence_length, 8000] |
Next-token scores for each sequence position |
The graph is an autoregressive language-model forward pass; it does not perform the complete text-generation loop by itself. The example above implements greedy decoding in Python.
KV cache: These exports do not include past_key_values inputs or outputs. Each decoding step feeds the full sequence back through the graph. This keeps the interface simple for short, single-turn translations, but repeats computation as the generated sequence grows.
Evaluation of the base v2 checkpoint
The following results are from the PyTorch v2 checkpoint, not from a separate evaluation of the INT8 or 16-bit ONNX files.
Handcrafted benchmark
| Category | Examples | v1 pass rate | v2 pass rate |
|---|---|---|---|
| Abbreviations | 39 | 82% | 100% |
| Contextual abbreviations | 16 | 88% | 94% |
| Meaning questions | 11 | 27% | 100% |
| Overflow | 1 | 100% | 100% |
| Paragraphs | 5 | 100% | 100% |
| Passthrough | 8 | 75% | 75% |
| Polarity | 10 | 90% | 90% |
| Meaning preservation | 7 | 57% | 71% |
| Robustness | 37 | 86% | 92% |
| Slang | 34 | 91% | 88% |
| Overall scored categories | β | 80.2% | 92.4% |
The handcrafted benchmark uses category-specific rules. Its overall score is not a universal translation-accuracy percentage.
Held-out dataset benchmark
| Metric | v1 | v2 |
|---|---|---|
| Exact match | 15.2% | 14.5% |
| Token F1 | 0.701 | 0.699 |
| EOS-terminated outputs | 100% | 100% |
| Slang remaining in output | 0.0% | 0.1% |
| Definition-style outputs | 0.1% | 0.0% |
| Latency, batch size 32 | 4.1 ms/prompt | 4.7 ms/prompt |
Exact match is strict: a valid translation can be counted as incorrect when its wording differs from the reference. Token F1 measures lexical overlap and does not fully measure semantic correctness.
Validation loss during v2 fine-tuning
| Validation metric | Before fine-tuning | Selected checkpoint |
|---|---|---|
| General validation loss | 0.5268 | 0.5241 |
| Curated validation loss | 1.3334 | 0.2168 |
| Combined validation loss | 0.9301 | 0.3704 |
The combined loss is the arithmetic mean of general and curated validation losses. The curated validation set contained 82 examples, so its result should be interpreted cautiously. These values should not be compared directly with losses from a different dataset split or evaluation pipeline.
Training summary
Original model
The original GenZ Translator was trained from scratch using a custom tokenizer and a specialized Gen Z-to-English dataset. It did not start from pretrained Meta Llama, Qwen, or Mistral weights.
Version 2
Version 2 continued training from the original Sankar-2910/genz-translator checkpoint.
| Setting | Value |
|---|---|
| Starting checkpoint | Sankar-2910/genz-translator |
| Prepared training examples | 333,993 tokenized examples |
| General validation examples | 1,995 tokenized examples |
| Curated training pairs | 437 before repetition |
| Curated validation pairs | 82 |
| Epochs | 1 |
| Batch size | 32 |
| Peak learning rate | 5 Γ 10β»β΅ |
| Optimizer | AdamW |
| Learning-rate schedule | Cosine decay with warmup |
| Gradient clipping | 1.0 |
| Maximum sequence length | 384 tokens |
| Hardware | Kaggle T4x2 GPU |
| Checkpoint selection | Combined general and curated validation loss |
The data pipeline began with a source dataset of approximately one million rows and filtered it before training. The prepared-data counts above are not the size of the original raw dataset. Curated training examples were repeated during training; held-out curated validation examples were kept separate. Loss was computed over response tokens rather than prompt tokens.
Limitations
GenZ Translator v2 is a compact, specialized model. It can still:
- Misinterpret ambiguous slang.
- Lose negation, names, or contextual details.
- Over-rewrite ordinary English that does not need translation.
- Produce malformed outputs for repetitive or adversarially malformed inputs.
- Struggle with regional slang, multilingual text, URLs, usernames, and recent expressions.
- Generate wording that differs from a reference even when some meaning is preserved.
Do not assume a translation is correct solely because it is fluent. Verify important translations. Further evaluation on an independently held-out test set is needed before making stronger claims about general translation quality.
Browser and mobile deployment
These files are ONNX graphs, not a complete browser or mobile application. A browser deployment would need an ONNX Runtime Web integration; a native mobile deployment would need a compatible ONNX Runtime mobile integration. Operator support, model loading, memory use, and output quality should be tested on each target runtime. This repository does not claim that the graphs have already been validated on WebGPU, WebAssembly, Android, or iOS.
Citation
If you use this model in research, please cite:
@misc{genztranslator2026v2,
title={GenZ Translator v2},
author={Sankar Narayanan},
year={2026},
note={A 29.65M-parameter decoder-only Transformer for Gen Z slang translation, continued from an earlier custom-trained checkpoint},
url={https://huggingface.co/Sankar-2910/genz-translator}
}
For the underlying Llama architecture, see:
@article{touvron2023llama,
title={LLaMA: Open and Efficient Foundation Language Models},
author={Touvron, Hugo and others},
journal={arXiv preprint arXiv:2302.13971},
year={2023}
}
Credits
Created by Sankara Narayanan.
- Original model: Sankar-2910/genz-translator
- ONNX exports: this repository
Licensed under Apache 2.0.
Model tree for Sankar-2910/Genz-Translator-ONNX
Base model
Sankar-2910/genz-translator