How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="Vi-LAB/KenT-300M-Base", trust_remote_code=True)
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("Vi-LAB/KenT-300M-Base", trust_remote_code=True, device_map="auto")
Quick Links

KenT-300M-Base

~299.7M tham số, mô hình ngôn ngữ hồi quy một token mỗi bước. Không attention theo thời gian: lịch sử nằm trong bộ nhớ EMA học được ở mọi độ sâu; attention chỉ chạy theo trục độ sâu (N tap) của chính token hiện tại.

h_0 = x[t]                                    # embedding, (1, D)
h_i = h_{i-1} + SwiGLU(RMSNorm(h_{i-1}))      # i = 1..n   khối xanh

u_i      = RMSNorm(h_i) · D^T · W_i           # i = 0..n   khối cam "~DCT-II Proj (D^T)W"
H_i[t+1] = (1 - A_i) ⊙ H_i[t] + A_i ⊙ u_i     # Learnable EMA Vector, A = sigmoid(logits), shape (N, D), N = n+1

Hcat = Concat_i H_i[t+1]                      # (N, D)
p    = Q + Wo · Attn(Q, K, V)                 # Attn Pooling -> Query Residual
       K, V = RMSNorm(Hcat) ;  Q = learner query (1, D) học được, pooling hết N vector
g    = p + SwiGLU(RMSNorm(p))                 # khối xanh cuối
y    = g · D                                  # "DCT-II Proj" (DCT ngược)
out  = x[t] + y                               # Add với đầu vào gốc x[t]
logits = LM_head(RMSNorm_f(out))              # tied với embedding

D là ma trận DCT-II trực chuẩn cố định (hàng = tần số, vector hàng nên DCT là x·D^T); W học được, khởi tạo ≈ I. RMSNorm_f không có trong sơ đồ, thêm để logits ổn định.

Tiêu chí siêu tham số: D là độ phân giải (D cao => chênh lệch góc giữa các tần số DCT nhỏ), N = n+1 là khả năng tư duy (N sâu => học quan hệ tốt hơn). SwiGLU hidden giữ ở ~2D để dồn ngân sách tham số cho D và N.

vocab 50257 (GPT-2), tied embedding / LM head
D (hidden_size) 1152
n khối xanh (num_hidden_layers) 24 (→ N = 25 tap EMA)
SwiGLU hidden (intermediate_size) 2352 (~2D)
Attn Pooling heads (pool_num_heads) 9 (head_dim 128)
tham số ≈ 299.68M (embedding 57.89M)
trạng thái giải mã H shape (25, 1152), O(1) theo độ dài

KenT diagram

EMA khởi tạo theo cấp số nhân từ 0.5 (tap đầu, feature đầu) đến 0.01 (tap cuối, feature cuối); vẫn học được. EMA chạy FP32 bằng affine-scan log-depth, kết quả bằng đúng hồi quy tuần tự.

from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("Vi-LAB/KenT-300M-Base", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("Vi-LAB/KenT-300M-Base", trust_remote_code=True)

Hoặc python infer.py --model Vi-LAB/KenT-300M-Base --prompt "Today the weather is".

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

Datasets used to train Vi-LAB/KenT-300M-Base