Downloads · 30 days
6
7% of all-time downloads
VNAI-VAI/Vaan3-270M
Vaan3-270M is a text generation model from VNAI-VAI. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
Downloads · 30 days
6
7% of all-time downloads
All-time downloads
81
Public
Parameters
268M
570 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors536 MB · 94%
From the Hugging Face model README
A compact, instruction-following language model built for speed and accessibility.
</div>Vaan3-270M is a 270 million parameter causal language model trained to follow natural language instructions. Despite its compact size, it demonstrates strong instruction-following ability across a wide range of tasks — from summarization and Q&A to creative writing and code explanation.
Vaan3-270M is part of the Vaan AI model family, designed with a focus on:
| Property | Value |
|---|---|
| Model name | Vaan3-270M |
| Model family | Vaan AI |
| Parameters | ~270 million |
| Architecture | Transformer, Causal LM |
| Context length | 512 tokens |
| Training data | Instruction-following dataset (English) |
| Precision | float32 (CPU) / bfloat16 (GPU) |
| License | Apache 2.0 |
Vaan3-270M is designed for:
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "VNAI-VAI/vaan3-270m"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
device_map="auto",
)
model.eval()
Vaan3-270M uses the Alpaca instruction format. Always wrap your prompt using the template below for best results.
Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
{your instruction here}
### Response:
With optional input context:
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
{your instruction here}
### Input:
{your context here}
### Response:
def build_prompt(instruction, inp=""):
if inp.strip():
return (
"Below is an instruction that describes a task, paired with an input "
"that provides further context. Write a response that appropriately "
"completes the request.\n\n"
f"### Instruction:\n{instruction}\n\n"
f"### Input:\n{inp}\n\n"
"### Response:\n"
)
return (
"Below is an instruction that describes a task. Write a response "
"that appropriately completes the request.\n\n"
f"### Instruction:\n{instruction}\n\n"
"### Response:\n"
)
@torch.inference_mode()
def ask(instruction, inp="", max_new_tokens=200):
prompt = build_prompt(instruction, inp)
inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=512).to(model.device)
output_ids = model.generate(
**inputs,
max_new_tokens=max_new_tokens,
do_sample=True,
temperature=0.7,
top_p=0.9,
top_k=50,
repetition_penalty=1.3,
pad_token_id=tokenizer.eos_token_id,
eos_token_id=tokenizer.eos_token_id,
)
new_tokens = output_ids[0][inputs["input_ids"].shape[1]:]
return tokenizer.decode(new_tokens, skip_special_tokens=True).strip()
# Examples
print(ask("Explain what a neural network is in simple terms."))
print(ask("Summarize the following paragraph.", "The Amazon rainforest covers over 5.5 million square kilometres..."))
print(ask("Give three tips for writing clean Python code."))
from transformers import TextIteratorStreamer
from threading import Thread
streamer = TextIteratorStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
prompt = build_prompt("Write a short poem about the ocean.")
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
thread = Thread(target=model.generate, kwargs=dict(
**inputs,
streamer=streamer,
max_new_tokens=200,
do_sample=True,
temperature=0.7,
top_p=0.9,
pad_token_id=tokenizer.eos_token_id,
), daemon=True)
thread.start()
for chunk in streamer:
print(chunk, end="", flush=True)
thread.join()
Instruction: What is photosynthesis?
Photosynthesis is the process by which plants use sunlight, water, and carbon dioxide to produce oxygen and energy in the form of glucose. It occurs in the chloroplasts of plant cells, where chlorophyll absorbs light energy to drive the chemical reactions.
Instruction: Give three tips for staying productive while working from home.
- Set a dedicated workspace — having a specific area for work helps your brain switch into focus mode and reduces distractions from your home environment.
- Stick to a schedule — start and finish at consistent times each day to maintain structure and prevent work from bleeding into personal time.
- Take regular breaks — short breaks every 60–90 minutes help maintain concentration and prevent burnout over long working sessions.
Instruction: Classify the sentiment of the following text.
Input: I absolutely loved the new update — the interface is so much cleaner!
Sentiment: Positive. The text expresses enthusiasm and satisfaction with the update, using strong positive language such as "absolutely loved" and describing the interface improvement favorably.
| Setup | RAM needed | Speed |
|---|---|---|
| CPU (float32) | ~1.1 GB free | ~2–5 tokens/sec |
| GPU (bfloat16) | ~600 MB VRAM | ~30–80 tokens/sec |
| GPU 4-bit | ~300 MB VRAM | ~20–50 tokens/sec |
Vaan3-270M is designed to run on modest hardware. It has been tested on:
If you use Vaan3-270M in your research or project, please cite:
@misc{vaan3-270m,
author = {Vaan AI},
title = {Vaan3-270M: A Compact Instruction-Following Language Model},
year = {2025},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/VaanAI/vaan3-270m}},
}
This model is released under the Apache 2.0 License. You are free to use, modify, and distribute it for both personal and commercial purposes with attribution.