CoolFace
Modelpublic

tantra-ai-labs/AstraGPT-7B

sourceHugging Faceapache-2.0updated 4d agoView on Hugging Face
1likes144downloads
Model Card

AstraGPT-7B πŸš€

<div align="center">

A 7-Billion Parameter Decoder-Only Language Model

Custom BPE Tokenizer Training Β· Reasoning Fine-Tuned with LoRA on Dual RTX 4090

![License](https://opensource.org/licenses/Apache-2.0) ![Params]() ![Context]() ![GPU](https://www.nvidia.com) ![By](https://github.com/codewith-aditya)

Built by Aditya Wakharkar | Tantra AI Labs | Portfolio

</div>


🧠 What is AstraGPT-7B?

AstraGPT-7B is a 7-billion parameter decoder-only language model built and trained by Tantra AI Labs β€” including a custom BPE tokenizer trained from scratch (64k vocabulary, later mapped to the 152k runtime vocab) and a full supervised fine-tuning pipeline written in PyTorch.

The model was reasoning fine-tuned via LoRA on a private VPS with 2Γ— NVIDIA RTX 4090 GPUs (48GB VRAM), on a self-generated dataset of 193,841 instruction–reasoning–answer triples (astragpt-reasoning-dataset), giving it native <think>...</think> chain-of-thought support.

"Most people fine-tune models. We built the whole pipeline β€” tokenizer, training loop, and all."

For the coding-specialized sibling, see [AstraGPTCoder-7B](https://huggingface.co/tantra-ai-labs/AstraGPTCoder-7B).


πŸ—οΈ Architecture

Decoder-only transformer, LLaMA-family design (Qwen2-compatible layout):

ComponentSpec
Parameters7B (fp16, 15.2 GB)
Layers28 transformer blocks (pre-norm RMSNorm)
Hidden size3,584
AttentionGrouped Query Attention β€” 28 query / 4 KV heads (7Γ— KV memory savings)
Positional encodingRoPE (ΞΈ = 1,000,000)
FFNSwiGLU (gate/up/down projections, intermediate 18,944)
Context window32,768 tokens
Vocabulary152,064 (custom BPE lineage)
KV cacheβœ… inference-ready

πŸ”¬ Training & Fine-Tuning

ParameterValue
MethodLoRA (PEFT) via Unsloth
Dataset193,841 reasoning triples (self-generated)
LoRA Rank / Alpha16 / 32
Target modulesqproj, kproj, vproj, oproj, gateproj, upproj, down_proj
Learning rate2e-4 (cosine, 5% warmup)
Batcheffective 16 (grad accumulation 8)
PrecisionBF16 mixed
OptimizerAdamW 8-bit
Hardware2Γ— RTX 4090 (48GB), Ubuntu 22.04, CUDA 12.x
Duration~3–4 hours
Post-trainingLoRA adapter merged into base weights

πŸ€” Reasoning Support

Native <think> chain-of-thought:

Input:  What is 15 * 47?

Output:
<think>
15 Γ— 47 = 15 Γ— 40 + 15 Γ— 7 = 600 + 105 = 705
</think>
705

Trigger explicitly by appending "<think>\n" after the chat template.


⚑ Quick Start

python
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "tantra-ai-labs/AstraGPT-7B"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id, torch_dtype=torch.float16, device_map="auto"
)

messages = [
    {"role": "system", "content": "You are AstraGPT, a helpful AI by Tantra AI Labs. Think with <think>...</think> before answering."},
    {"role": "user", "content": "Explain quantum tunneling simply."},
]

prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) + "<think>\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)

with torch.no_grad():
    out = model.generate(**inputs, max_new_tokens=1024, temperature=0.3,
                         do_sample=True, repetition_penalty=1.1,
                         pad_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))

4-bit quantized (~6GB VRAM):

python
from transformers import BitsAndBytesConfig
bnb = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4",
                         bnb_4bit_compute_dtype=torch.float16, bnb_4bit_use_double_quant=True)
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb, device_map="auto")

⚠️ Limitations

  • β€”7B scale β€” complex multi-step math and long-horizon reasoning may fail
  • β€”Can produce confident but incorrect answers β€” verify critical outputs
  • β€”English-primary performance
  • β€”<think> reasoning works best with an explicit <think>\n prompt prefix

🌱 Environmental Impact

  • β€”Hardware: 2Γ— RTX 4090 (48GB), private bare-metal VPS
  • β€”Training duration: ~3–4 hours
  • β€”Estimated emissions: ~2–3 kgCOβ‚‚eq

πŸ“š Related Resources


πŸ“– Citation

bibtex
@misc{astragpt7b2026,
  author       = {Aditya Wakharkar},
  title        = {AstraGPT-7B: A 7B LLM with Custom Tokenizer and Chain-of-Thought Reasoning},
  year         = {2026},
  publisher    = {HuggingFace},
  organization = {Tantra AI Labs},
  url          = {https://huggingface.co/tantra-ai-labs/AstraGPT-7B},
  note         = {Custom BPE tokenizer, GQA 28Q/4KV, RoPE, SwiGLU, LoRA reasoning fine-tune on 2Γ— RTX 4090}
}

<div align="center"> <em>Built with ❀️ by <strong>Tantra AI Labs</strong></em><br/> <em>Every layer. Every weight. Every token.</em> </div>