Skip to page content
SAVRN
Search Plan a project

Open-weight model · Text generation

uLM-28M

by Wen Cheng Sensente/uLM-28M

uLM-28M is an open-weight model for text generation from Wen Cheng, released under MIT License. It has 29M parameters and a 32,768-token context. At 16-bit it needs about 0.1 GB of GPU memory, which fits on 1x MI300X from $1.85 an hour, at the lowest prices in the SAVRN Index. It draws 57 downloads a month.

uLM-28M is a 28.8M-parameter decoder-only causal language model released with the paper Micro Language Models Enable Instant Responses.

Parameters29M
Context32,768
Weights115.4 MB
Licensemit
AccessOpen weights
Monthly Downloads57

Runs On

What it takes to serve uLM-28M (29M parameters): the memory its weights need at each precision, and the cheapest way to rent enough data-center GPUs to hold them.

PrecisionWeightsMemory neededCheapest setupPer hourAlso fits
16-bit 0.1 GB 0.1 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
8-bit 0.0 GB 0.0 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
4-bit 0.0 GB 0.0 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00

Memory is the weights at that precision plus 20% for the runtime and a short context; a long context needs more. Prices are the lowest on-demand hourly rates in the SAVRN Index, read Oct 24, 2026.

uLM-28M on every accelerator the SAVRN Index prices, at every precision

Model Card

By Wen Cheng, published under mit, revision d115b55583a0.

uLM-28M is a 28.8M-parameter decoder-only causal language model released with the paper Micro Language Models Enable Instant Responses. It is designed for instant local response initiation: the model generates a short, contextually grounded opening of approximately 4–8 words on a resource-constrained device, and a larger cloud model continues the response. For representative behavior, use the tokenizer's chat template, sampling, and short-prefix generation as shown below. The model was trained from scratch on chat-style data. Further training and evaluation details are provided in the accompanying paper. uLM-28M is intended to generate only the first few words of a response: The exact…

Read Wen Cheng's full model card

uLM-28M is a 28.8M-parameter decoder-only causal language model released with the paper Micro Language Models Enable Instant Responses.

It is designed for instant local response initiation: the model generates a short, contextually grounded opening of approximately 4–8 words on a resource-constrained device, and a larger cloud model continues the response.

For representative behavior, use the tokenizer's chat template, sampling, and short-prefix generation as shown below.

Model Details

Property Value
Parameters 28,844,544
Vocabulary size 12,288
Hidden size 512
Intermediate size 1,408
Transformer layers 8
Attention heads 8
Key-value heads 2
License MIT

The model was trained from scratch on chat-style data. Further training and evaluation details are provided in the accompanying paper.

Intended Generation Pattern

uLM-28M is intended to generate only the first few words of a response:

User request
    ↓
uLM-28M generates a 4–8 word local prefix
    ↓
A larger model continues from that committed prefix

For example:

Question: What is the capital of France?
Local prefix: The capital of France is Paris.

The exact output may vary because the recommended decoding configuration uses sampling.

Compatibility

This release is validated with Transformers 4.x.

Transformers 5.x is not currently supported because of changes to custom-model weight tying and cache interfaces.

Install a supported version with:

pip install "transformers>=4.45,<5" torch safetensors sentencepiece

Usage

This repository contains a custom Transformers architecture, so loading it requires trust_remote_code=True.

from __future__ import annotations

import torch
from transformers import (
    AutoModelForCausalLM,
    AutoTokenizer,
    StoppingCriteria,
    StoppingCriteriaList,
)

REPO_ID = "Sensente/uLM-28M"
MAX_PREFIX_WORDS = 8


class PrefixWordStoppingCriteria(StoppingCriteria):
    """Stop once the generated continuation contains enough words."""

    def __init__(
        self,
        tokenizer,
        prompt_length: int,
        max_words: int,
    ):
        self.tokenizer = tokenizer
        self.prompt_length = prompt_length
        self.max_words = max_words

    def __call__(
        self,
        input_ids: torch.LongTensor,
        scores: torch.FloatTensor,
        **kwargs,
    ) -> bool:
        generated_ids = input_ids[0, self.prompt_length:]
        generated_text = self.tokenizer.decode(
            generated_ids,
            skip_special_tokens=True,
        )
        return len(generated_text.strip().split()) >= self.max_words


def choose_device() -> torch.device:
    if torch.cuda.is_available():
        return torch.device("cuda")
    if torch.backends.mps.is_available():
        return torch.device("mps")
    return torch.device("cpu")


device = choose_device()

tokenizer = AutoTokenizer.from_pretrained(
    REPO_ID,
    trust_remote_code=True,
    use_fast=False,
)

model = AutoModelForCausalLM.from_pretrained(
    REPO_ID,
    trust_remote_code=True,
    dtype="auto",
).to(device).eval()

conversation = [
    {
        "role": "user",
        "content": "What is the capital of France?",
    }
]

rendered_prompt = tokenizer.apply_chat_template(
    conversation,
    tokenize=False,
    add_generation_prompt=True,
)

inputs = tokenizer(
    rendered_prompt,
    return_tensors="pt",
    add_special_tokens=False,
    return_token_type_ids=False,
)
inputs.pop("token_type_ids", None)

inputs = {
    name: tensor.to(device)
    for name, tensor in inputs.items()
}

prompt_length = inputs["input_ids"].shape[1]

stopping_criteria = StoppingCriteriaList(
    [
        PrefixWordStoppingCriteria(
            tokenizer=tokenizer,
            prompt_length=prompt_length,
            max_words=MAX_PREFIX_WORDS,
        )
    ]
)

torch.manual_seed(0)

with torch.no_grad():
    output_ids = model.generate(
        **inputs,
        max_new_tokens=32,
        do_sample=True,
        temperature=0.5,
        top_p=0.9,
        use_cache=True,
        stopping_criteria=stopping_criteria,
        pad_token_id=tokenizer.eos_token_id,
    )

generated_ids = output_ids[0, prompt_length:]

prefix = tokenizer.decode(
    generated_ids,
    skip_special_tokens=True,
).strip()

prefix = " ".join(prefix.split()[:MAX_PREFIX_WORDS])

print(prefix)

Prompting and Decoding Notes

For representative behavior:

  1. Use tokenizer.apply_chat_template(...).
  2. Set add_generation_prompt=True.
  3. Tokenize the rendered prompt with add_special_tokens=False.
  4. Do not pass token_type_ids.
  5. Use sampling with temperature=0.5 and top_p=0.9.
  6. Stop after approximately 4–8 generated words.

The following is useful for structural testing but is not representative of the intended application:

model.generate(
    **inputs,
    do_sample=False,
    max_new_tokens=32,
)

Long greedy continuations may become repetitive because uLM-28M was optimized for short response initiation rather than standalone long-form generation.

Custom Transformers Code

The repository includes:

configuration_swen.py
modeling_swen.py

The model is registered through the auto_map field in config.json:

{
  "AutoConfig": "configuration_swen.SwenConfig",
  "AutoModelForCausalLM": "modeling_swen.SwenForCausalLM"
}

Because trust_remote_code=True executes Python code from the model repository, users should review the implementation and pin a specific revision in production:

REVISION = "<commit-sha>"

model = AutoModelForCausalLM.from_pretrained(
    REPO_ID,
    trust_remote_code=True,
    revision=REVISION,
    dtype="auto",
)

Conversion and Release Validation

The Hugging Face release was converted from the original uLM checkpoint and validated both locally and after upload to the Hugging Face Hub.

The validation included:

  • comparison of 75 source and converted state tensors;
  • maximum absolute weight difference of 0.0;
  • comparison of incremental KV-cache logits with full recomputation;
  • identical generation with use_cache=True and use_cache=False;
  • token-identical demo-style generation between the original implementation and the Hugging Face implementation;
  • clean remote loading through AutoConfig, AutoTokenizer, and AutoModelForCausalLM.

For the test question:

What is the capital of France?

the original implementation and the Hugging Face release both generated:

The capital of France is Paris.

with identical token IDs:

[1168, 5118, 297, 6850, 327, 4462, 16, 2]

These checks establish conversion and packaging fidelity. They are not a substitute for task-level quality evaluation.

Intended Uses

uLM-28M is intended for research and experimentation involving:

  • low-latency local response initiation;
  • hybrid local-cloud language generation;
  • resource-constrained edge deployment;
  • committed-prefix generation;
  • semantic handoff from a micro model to a larger model;
  • studies of perceived response latency.

Out-of-Scope Uses

uLM-28M is not intended to:

  • independently produce long-form answers;
  • replace a general-purpose instruction-tuned assistant;
  • provide reliable factual answers without verification;
  • make medical, legal, financial, or safety-critical decisions;
  • generate high-stakes content without human review.

Limitations

uLM-28M is an extremely small language model. Its capabilities are substantially more limited than those of larger language models.

Known limitations include:

  • limited factual knowledge;
  • limited reasoning ability;
  • weak long-form coherence;
  • possible repetition during long or greedy generation;
  • sensitivity to prompt formatting and decoding parameters;
  • possible incorrect, misleading, biased, or inappropriate outputs;
  • limited safety alignment compared with larger production assistants.

The model's short prefix is immediately committed in the intended local-cloud framework. Downstream systems should therefore implement continuation and recovery strategies for incorrect or poorly aligned prefixes.

Training and Evaluation

For details on the model family, training setup, datasets, evaluation tasks, local-cloud continuation framework, and error-recovery methods, see:

License

The model weights and custom model implementation in this repository are released under the MIT License.

See the LICENSE file for the full license text.

Third-party dependencies remain subject to their respective licenses.

Citation

@misc{cheng2026micro,
  title         = {Micro Language Models Enable Instant Responses},
  author        = {Wen Cheng and Tuochao Chen and Karim Helwani and
                   Sriram Srinivasan and Luke Zettlemoyer and
                   Shyamnath Gollakota},
  year          = {2026},
  eprint        = {2604.19642},
  archivePrefix = {arXiv},
  primaryClass  = {cs.CL},
  url           = {https://arxiv.org/abs/2604.19642}
}

Configuration

Architecture
SwenForCausalLM
Context length (tokens)
32,768
Layers
8
Hidden size
512
Feed-forward size
1,408
Attention heads
8
Key/value heads
2
Vocabulary size
12,288
RoPE base
1e+06
Model type
swen

Identity and Version

Repository
Sensente/uLM-28M
Publisher
Wen Cheng
Task
Text generation
Modality
Text
Library
transformers
Parameters
29M parameters
Languages
en
Revision
d115b55583a00aa759614e3692f67295a1a3bfbc
First published
2026-07-24
Last updated
2026-10-20

Files and Weights

12 files, 116.3 MB in total. The weights are 1 file totalling 115.4 MB in safetensors.

Weights1 file · 115.4 MB
Configuration5 files · 26.3 KB
Tokenizer2 files · 853.4 KB
Documentation2 files · 10.7 KB
Other1 file · 510 B
Repository1 file · 1.5 KB
Every file
FileTypeSizeSHA-256
model.safetensorsWeights115.4 MB a8443932e20b
config.jsonConfiguration739 B —
configuration_swen.pyConfiguration2.6 KB —
generation_config.jsonConfiguration132 B —
modeling_swen.pyConfiguration22.3 KB —
special_tokens_map.jsonConfiguration583 B —
LICENSEDocumentation1.1 KB —
README.mdDocumentation9.6 KB —
chat_template.jinjaOther510 B —
.gitattributesRepository1.5 KB —
tokenizer.jsonTokenizer852.4 KB —
tokenizer_config.jsonTokenizer998 B —

License and Download

License
mit
Access
Open weights, no gate
Download size
115.4 MB
Download from Wen Cheng

Released by Wen Cheng through its official repository on Hugging Face. Read the license.

Built From

  • Described by arXiv:2604.19642

Memory Requirements

PrecisionWeights in memory
As published115.4 MB
16-bit0.1 GB
8-bit0.0 GB
4-bit0.0 GB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About uLM-28M

How much GPU memory does uLM-28M need?

About 0.1 GB at 16-bit and 0 GB at 4-bit: the weights (29M parameters) plus a working margin. A long context needs more.

What is the cheapest GPU to run uLM-28M on?

At 16-bit, 1x MI300X from $1.85 an hour; at 4-bit, 1x MI300X from $1.85 an hour, at the lowest on-demand prices the SAVRN Index lists.

Can I use uLM-28M commercially?

Yes. uLM-28M is released under MIT License. The MIT License is a short permissive license. It permits commercial use, modification and redistribution, provided the copyright notice and permission notice are included.

What is uLM-28M's context length?

32,768 tokens, from the maximum position embeddings in its published configuration.

Similar Models

Model · Text generation

lightning-30m-ft

AobanZ

Lightning is a small, autoregressive transformer which utilizes FlashAttention and MHA. This model is trained on a variety of books from a dataset(300 MB). Lightning utilizes FlashAttention and AdamW for performance and capability. Lightning is designed to provide quick, coherent outputs, with the downside of limited embedding. Lightning is intended to be used for research, analysis and fine-tuning, stories and other. It is not intended to be used for professional advice, real writing or any kind of heavy work as generated outputs may be incorrect. Lightning can be used directly for text generation, experimentation, and conversational interactions. Users can provide text prompts and…

Open weights mit 29M parameters transformers

Model · Text generation

trackfit-llm-small

Deepak Samuel

A 31.9M-parameter Llama-architecture causal language model trained from scratch to reconstruct particle-track parameters from detector hit patterns, treating track fitting as a language translation problem: an array of encoded hit positions is translated into a short domain-specific "call" that regenerates it. A detector stack has 12 layers, each with 32 strips. A charged particle (e.g. a cosmic muon) crosses the stack roughly in a straight line, hitting strip round(slp layer + icpt) in every layer it geometrically passes through (slp = slope in strips/layer, icpt = intercept in strips). Each hit is encoded as a single integer layer 32 + strip in [0, 383]. - add — spurious hits not on the…

Open weights mit 32M parameters 128 tokens

Model · Text generation

Hush-Nano-Chat

Leecz

Hush-Nano-Chat is an English, single-turn instruction-tuned version of Soulitude/Hush-Nano. It starts from the 22M-parameter pretrained model and uses supervised fine-tuning (SFT) on instruction–response pairs. Due to the model's limited parameters, its response can be inaccurate, incomplete, or inconsistent. Hush-Nano-Chat has the following features: The base model was pretrained on 8.5B tokens (8,554,042,292) drawn from the following subsets: Then it was fine-tuned on a mixture of the following datasets: unsloth/alpaca-cleaned, databricks/databricks-dolly-15k, and HuggingFaceH4/norobots. Only the assistant response and ending EOS token contribute to the training loss. Zero-shot normalized…

Open weights apache-2.0 23M parameters 1,024 tokens transformers