How to use from the
Use from the
LiteRT library
# No code snippets available yet for this library.

# To use this model, check the repository files and the library's documentation.

# Want to help? PRs adding snippets are welcome at:
# https://github.com/huggingface/huggingface.js

CCORE-Web-Coder-4B β€” LiteRT-LM

This repository is a conversion of ccore/CCORE-Web-Coder-4B to LiteRT-LM (.litertlm), made with litert-torch at commit 7b614004 for LiteRT-LM 0.20.0, in two files: the desktop file and the phone file. On the GPU of a Galaxy S26 (Snapdragon, SM8850), the phone file decoded 256 tokens at 12.734–12.861 tok/s after a 1,024-token prompt, on 2026-11-30. Speed still being tuned (updates follow).

CCORE-Web-Coder-4B is CCORE's fine-tune of Qwen/Qwen3.5-4B-Base that turns a brief into one HTML file with React: a website, a slide deck or a web infographic. These files contain its text decoder only: text in, text out. The decoder has 24 Gated DeltaNet layers and 8 full-attention layers. The desktop file ran on a Mac CPU, and the phone file on the CPU and the GPU of a Pixel 11 Pro and of the Galaxy S26, all with LiteRT-LM 0.20.0.

On that Mac, the desktop file ran with one litert-lm run command, shown in Usage. Use LiteRT-LM 0.20.0: it is the first stable release with LiteRT #11565, which the GPU needs for the channels-last layout of these files' convolution state. A prompt and its whole reply share the file's KV cache: 32,768 tokens in the desktop file, 16,384 in the phone file. The publisher's card says a full response, reasoning included, typically uses around 20,000 output tokens.

On the Mac CPU, each file answered eight short questions with greedy decoding, thinking off and no system prompt, and every reply ended by itself. In seven questions, the desktop file's reply was token for token that of the publisher's float32 model in Transformers, and in the eighth it shared the first 15 tokens. Against the desktop file, the phone file's replies were the same in seven and shared the first 15 tokens in the eighth. On both phones, CPU and GPU, the phone file's eight replies were token for token its replies on the Mac.

With enable_thinking left out or false, the files' template gave these questions the same prompt tokens as the publisher's template with thinking off. That prompt ends with an empty thought block, <think>\n\n</think>\n\n.

Files

File Use KV cache Size (bytes)
CCORE-Web-Coder-4B_int8_kv32768.litertlm desktop CPU 32,768 tokens 4,354,719,744
CCORE-Web-Coder-4B_int8_kv16384.litertlm Android phones, GPU or CPU 16,384 tokens 4,354,719,744

Usage

Download the file for your device, here the desktop file:

hf download litert-community/CCORE-Web-Coder-4B CCORE-Web-Coder-4B_int8_kv32768.litertlm --local-dir .

Run it on the CPU with the litert-lm package from PyPI, which needs Python 3.10 or newer:

pip install litert-lm==0.20.0
litert-lm run ./CCORE-Web-Coder-4B_int8_kv32768.litertlm --backend cpu --prompt "Write a minimal HTML page with one red button."

With macOS's own python3, which is 3.9.6 on macOS 27.0, pip stops with ERROR: Could not find a version that satisfies the requirement litert-lm==0.20.0. On a Mac with Apple silicon and macOS 27.0, three runs of the command each printed a full HTML page and ended by itself; the third ran the commands above as written, with Python 3.12.13. The first and third each wrote a weight cache of about 4.2 GB next to the model file and peaked at about 12.4 GB of resident memory. The second read the first's cache and peaked at about 7.5 GB.

On Android, use CCORE-Web-Coder-4B_int8_kv16384.litertlm with LiteRT-LM 0.20.0 on the GPU: on both phones its prefill was faster than the CPU's in every run, and on the Galaxy S26 its decode was too. With the default cache folder, the first engine writes caches next to the model file: about 4.2 GB for the CPU, and for the GPU about 4.2 GB on the Pixel 11 Pro and 31 MB on the Galaxy S26.

Performance

The phone file ran with LiteRT-LM 0.20.0, the litert-lm-api Android wheel from PyPI, through its Python API on the phone: Benchmark(model, backend, prefill_tokens=1024, decode_tokens=256, max_num_tokens=2048), three runs on one engine per row, with a 2,048-token KV cache instead of the file's 16,384. Each range spans the three runs. The phones lowered their CPU or GPU clock limits during all four rows.

Phone Backend Prefill, tok/s Decode, tok/s Memory, about
Pixel 11 Pro, Android 17 CPU, 4 threads 31.41–48.08 5.889–8.163 5.54 GB peak resident
Pixel 11 Pro, Android 17 GPU 110.99–130.48 8.107–8.499 1.23 GB peak resident, available 9.60 β†’ 4.10 GB
Galaxy S26 (Snapdragon, SM8850), Android 16 CPU, 4 threads 46.25–59.80 8.669–9.503 5.37 GB peak resident
Galaxy S26 (Snapdragon, SM8850), Android 16 GPU 82.01–95.95 12.734–12.861 1.68 GB peak resident, available 7.65 β†’ 1.93 GB

Peak resident is the process's VmHWM. The GPU engine's memory is not in it. It shows as the fall of the phone's MemAvailable, read right before the engine was created and at its lowest during the row. With the file's 16,384-token KV cache, in the eight-question runs, peak resident on the CPU was about 6.04–6.05 GB on the Pixel 11 Pro and 5.80–6.15 GB on the Galaxy S26. 1 GB = 10⁹ bytes.

Notes

  • Message whitespace. The files' chat template keeps the whitespace at the start and end of each message, and the publisher's template removes it. Strip each message to get the publisher's prompt.
  • <|endoftext|> in a prompt. A <|endoftext|> token (id 248044) in a prompt is treated as padding: the Gated DeltaNet layers get a zero input at that position.
  • One engine per conversation. Create a new engine for each conversation, as every reply on this card did. See LiteRT-LM #3165.
  • 10-minute limit of a blocking send. With LiteRT-LM 0.20.0, 0.19.0 and 0.18.1, the blocking send (Python send_message, C litert_lm_conversation_send_message, C++ Conversation::SendMessage) fails a reply that is still generating after 10 minutes with DEADLINE_EXCEEDED. With all three, streaming with send_message_async ran past 10 minutes without it, so a reply that may take longer can be streamed instead. Both were measured with the test model in LiteRT-LM's repository, runtime/testdata/test_lm_dynamic.litertlm, not with these files. At the decode speeds in the table, 10 minutes of decoding is about 3,500 to 7,700 tokens (600 s Γ— 5.889 to 12.861 tok/s). On LiteRT-LM's main branch, commit fb51b498 makes the blocking send's wait fail only when no progress is made for 10 minutes; it is not in 0.20.0.
  • A message that overflows the context. With LiteRT-LM 0.19.1 and 0.19.2, once a message failed because it did not fit in the context window, every later message in that conversation failed too, with Task failed with state: 7; a new conversation answered. LiteRT-LM 0.20.0 was not checked.
  • GPU program cache on Android. On the Pixel 11 Pro and the Galaxy S26, the second GPU engine loaded the program cache that the first one wrote, and the program cache did not grow. Creating the engine took 47.34 s, then 13.32 s on the Pixel 11 Pro, and 8.65 s, then 6.86 s on the Galaxy S26.
  • Phones with 8 GB of memory. On a phone with 8 GB of memory, the GPU engine of the phone file is not expected to fit: with the file's 16,384-token KV cache, in the eight-question runs, the phone's available memory fell by about 5.65–5.84 GB on the Pixel 11 Pro and 6.06–6.42 GB on the Galaxy S26. The phone file was not run on an 8 GB phone.
  • Not checked. On a Mac, the GPU was not checked with these files. These files were not run on a Linux or Windows desktop. No other phone was measured, and these files were not measured on iOS. Tool calls were not checked. The files' replies were checked with thinking off only, while the publisher's card recommends thinking on. With the system prompt from the publisher's card, only the first 256 tokens of one desktop-file reply were compared with the publisher's model, and the first 67 matched.

License and changes

Distributed under Apache-2.0, the source model's license. Its LICENSE file is included, and the source repository has no NOTICE file. Changes from the original work: the text decoder, from the publisher's weights at commit 2a2d6220, converted to LiteRT-LM with int8 per-channel weights, except the in_proj_a and in_proj_b projections, which stay float32; the publisher's tokenizer.json, with the 11 added tokens of its tokenizer_config.json that it lacks, ids 248066–248076, appended; the chat template of LiteRT-LM v0.19.0's models/qwen3_5 configuration. The vision weights are not converted. No training or fine-tuning.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for litert-community/CCORE-Web-Coder-4B

Quantized
(9)
this model