Text Generation
Transformers
Safetensors
English
notoken_gen55
notokenlm
byte-level
tokenizer-free
hybrid
hierarchical
code
code-generation
custom_code
Instructions to use VeroLM/NoTokenLM-CodeGen-5.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use VeroLM/NoTokenLM-CodeGen-5.5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="VeroLM/NoTokenLM-CodeGen-5.5", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("VeroLM/NoTokenLM-CodeGen-5.5", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use VeroLM/NoTokenLM-CodeGen-5.5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "VeroLM/NoTokenLM-CodeGen-5.5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VeroLM/NoTokenLM-CodeGen-5.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/VeroLM/NoTokenLM-CodeGen-5.5
- SGLang
How to use VeroLM/NoTokenLM-CodeGen-5.5 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "VeroLM/NoTokenLM-CodeGen-5.5" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VeroLM/NoTokenLM-CodeGen-5.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "VeroLM/NoTokenLM-CodeGen-5.5" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VeroLM/NoTokenLM-CodeGen-5.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use VeroLM/NoTokenLM-CodeGen-5.5 with Docker Model Runner:
docker model run hf.co/VeroLM/NoTokenLM-CodeGen-5.5
Upload 2 files
Browse filesFiles changed (2)
- CodeGen-5.5-Playground.ipynbAdded+392
- README.md+211
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# CodeGen-5.5 β Interactive Playground\n", "\n", "A 169-million-parameter, byte-level, tokenizer-free language model, continued-trained on source code and code instruction data on top of [NoTokenLM-Gen-5.5](https://huggingface.co/VeroLM/NoTokenLM-Gen-5.5). No subword vocabulary, no BPE: raw UTF-8 bytes in, raw UTF-8 bytes out. Internally the bytes are grouped into entropy-based patches (β 6 bytes each) and processed by a hybrid RWKV-7 / attention trunk.\n", "\n", "It is a **small research model**, not a chat assistant. It can continue code, and it understands a plain-text instruction template (`### Instruction:` / `### Response:`), but its output is often wrong: treat every result as untrusted and never run it without review. **Benchmark results: to be added.**\n", "\n", "This notebook lets you:\n", "- Load **CodeGen-5.5** directly from the Hugging Face Hub\n", "- Ask for code with the instruction template, or let the model **complete** code you started\n", "- Control **temperature**, **top-k**, **top-p** and **max new bytes** with an interactive panel\n", "- Re-run generation as many times as you like without reloading the model\n", "\n", "Works on **Google Colab**, **Kaggle Notebooks** and any standard Jupyter environment." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Setup\n", "\n", "Installs the required libraries. Safe to re-run β already-satisfied packages are skipped.\n", "\n", "Note: this intentionally does **not** force-upgrade `torch`. Colab and Kaggle ship a pre-matched `torch`/`torchvision` pair; upgrading only `torch` can break `transformers` imports. If you hit such an error, use `Runtime β Restart session` and re-run from the top." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%pip install -q -U \"transformers>=4.44.0\" ipywidgets safetensors huggingface_hub" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Load the model\n", "\n", "Set `REPO_ID` if you point at a different repo (a fork or a local folder). By default this pulls **CodeGen-5.5** from the Hugging Face Hub (about 0.7 GB). The repository id below is a placeholder: replace it with the final id of the model.\n", "\n", "`trust_remote_code=True` is required β the model ships its own architecture code (byte encoder, entropy patching, RWKV-7 trunk, ROSA) alongside the weights. The model runs in float32." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import torch\n", "from transformers import AutoModelForCausalLM\n", "\n", "REPO_ID = \"VeroLM/CodeGen-5.5\" # placeholder: change this to the final repo id, a fork or a local folder\n", "\n", "device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n", "print(f\"Loading model from '{REPO_ID}' ...\")\n", "model = AutoModelForCausalLM.from_pretrained(REPO_ID, trust_remote_code=True)\n", "model.eval()\n", "\n", "try:\n", " model.to(device)\n", " model.generate(prompt=\"Hi\", max_new_tokens=2, seed=0) # smoke test on the chosen device\n", "except Exception as e: # fall back to CPU if the GPU path misbehaves\n", " print(f\"Could not use '{device}' ({type(e).__name__}: {e}); falling back to CPU.\")\n", " device = \"cpu\"\n", " model.to(device)\n", "\n", "n_params = sum(p.numel() for p in model.parameters())\n", "print(f\"Model loaded: {n_params:,} parameters on {device}.\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. Generation functions\n", "\n", "`run_generation()` is a thin wrapper around the model's own `generate()` method. The model works on bytes, so `max_new_tokens` counts **bytes** (most characters are 1 byte, accented letters 2, many other scripts 3β4) and decoding uses `errors=\"replace\"`, because a generation can legitimately end in the middle of a multi-byte character. Byte `0x00` is the *end-of-document* marker: generation stops when the model emits it, and the marker is dropped from the returned text. The context window is **4,096 bytes** (prompt + new bytes), so keep prompts short.\n", "\n", "`make_prompt()` builds the instruction template the model was fine-tuned on:\n", "\n", "```\n", "### Instruction:\n", "<task>\n", "\n", "### Response:\n", "```\n", "\n", "After its answer the model may continue with further, self-invented `### Instruction:` blocks. `cut_at_next_instruction()` removes everything from the next such marker on." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def run_generation(prompt: str, max_new_tokens: int, temperature: float, top_k: int = 0, top_p: float = 1.0,\n", " do_sample: bool = True, seed: int | None = None, streamer=None):\n", " \"\"\"Generate a continuation for `prompt` and return the full text (prompt + completion).\"\"\"\n", " if not prompt:\n", " prompt = \" \" # avoid feeding a fully empty byte sequence\n", "\n", " input_ids = torch.tensor([list(prompt.encode(\"utf-8\"))], dtype=torch.long)\n", "\n", " output_ids = model.generate(\n", " input_ids,\n", " max_new_tokens=max_new_tokens,\n", " temperature=temperature,\n", " top_k=top_k if top_k > 0 else None,\n", " top_p=top_p,\n", " do_sample=do_sample,\n", " seed=seed,\n", " streamer=streamer,\n", " )\n", "\n", " byte_values = [b for b in output_ids[0].tolist() if 0 < b <= 255] # 0x00 = end-of-document marker\n", " return bytes(byte_values).decode(\"utf-8\", errors=\"replace\")\n", "\n", "\n", "def make_prompt(task: str, system: str = \"\") -> str:\n", " \"\"\"Instruction template used in the fine-tuning data (plain text, no special tokens).\"\"\"\n", " head = f\"### System:\\n{system.strip()}\\n\\n\" if system.strip() else \"\"\n", " return f\"{head}### Instruction:\\n{task.strip()}\\n\\n### Response:\\n\"\n", "\n", "\n", "def cut_at_next_instruction(text: str, prompt: str) -> str:\n", " \"\"\"Return only the first answer: drop a self-invented follow-up '### Instruction:' block.\"\"\"\n", " answer = text[len(prompt):] if text.startswith(prompt) else text\n", " i = answer.find(\"### Instruction:\")\n", " return (answer[:i] if i >= 0 else answer).rstrip()\n", "\n", "\n", "def ask(task: str, max_new_tokens: int = 400, temperature: float = 0.4, top_p: float = 0.95, seed: int | None = 0):\n", " \"\"\"Instruction mode: returns just the model's answer.\"\"\"\n", " prompt = make_prompt(task)\n", " text = run_generation(prompt, max_new_tokens=max_new_tokens, temperature=temperature, top_p=top_p, seed=seed)\n", " return cut_at_next_instruction(text, prompt)\n", "\n", "\n", "# Quick sanity check\n", "print(ask(\"Write a Python function that returns the n-th Fibonacci number.\", max_new_tokens=200))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4. Interactive generation panel\n", "\n", "Choose a **mode**, adjust the settings, then click **Generate**. Re-click any time β the model stays loaded in memory. The text appears progressively while it is being generated.\n", "\n", "- **Mode: Instruction** β your text is wrapped in the `### Instruction:` / `### Response:` template and only the first answer is shown.\n", "- **Mode: Completion** β your text is used as is; the model continues it (a function signature, a docstring, the first lines of a file).\n", "- **Temperature** β for code, lower values (0.2β0.5) are usually better; higher values are more varied but make syntax errors more likely.\n", "- **Top-k** β restricts sampling to the k most likely next bytes at each step (0 = off).\n", "- **Top-p** β nucleus sampling: keep the smallest set of bytes whose probability adds up to p (1.0 = off).\n", "- **Max new bytes** β how many new bytes to generate (the window is 4,096 bytes in total, prompt included).\n", "- **Greedy (no sampling)** β always picks the single most likely next byte. Deterministic, but prone to repetition.\n", "- **Seed** β a fixed integer for reproducible output, or -1 for a different result every time." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import ipywidgets as widgets\n", "from IPython.display import display, clear_output\n", "\n", "mode_toggle = widgets.ToggleButtons(\n", " options=[\"Instruction\", \"Completion\"], value=\"Instruction\",\n", " description=\"Mode:\", style={\"description_width\": \"100px\", \"button_width\": \"120px\"},\n", ")\n", "\n", "prompt_box = widgets.Textarea(\n", " value=\"Write a Python function that checks whether a string is a palindrome.\",\n", " placeholder=\"Describe the task, or type the beginning of some code...\",\n", " description=\"Prompt:\",\n", " layout=widgets.Layout(width=\"100%\", height=\"110px\"),\n", " style={\"description_width\": \"100px\"},\n", ")\n", "\n", "temperature_slider = widgets.FloatSlider(\n", " value=0.4, min=0.05, max=1.5, step=0.05,\n", " description=\"Temperature:\",\n", " style={\"description_width\": \"100px\"},\n", " layout=widgets.Layout(width=\"400px\"),\n", " readout_format=\".2f\",\n", ")\n", "\n", "top_k_slider = widgets.IntSlider(\n", " value=0, min=0, max=200, step=1,\n", " description=\"Top-k (0=off):\",\n", " style={\"description_width\": \"100px\"},\n", " layout=widgets.Layout(width=\"400px\"),\n", ")\n", "\n", "top_p_slider = widgets.FloatSlider(\n", " value=0.95, min=0.1, max=1.0, step=0.05,\n", " description=\"Top-p:\",\n", " style={\"description_width\": \"100px\"},\n", " layout=widgets.Layout(width=\"400px\"),\n", " readout_format=\".2f\",\n", ")\n", "\n", "max_tokens_slider = widgets.IntSlider(\n", " value=400, min=10, max=2048, step=10,\n", " description=\"Max new bytes:\",\n", " style={\"description_width\": \"100px\"},\n", " layout=widgets.Layout(width=\"400px\"),\n", ")\n", "\n", "greedy_checkbox = widgets.Checkbox(value=False, description=\"Greedy (no sampling)\", style={\"description_width\": \"initial\"})\n", "cut_checkbox = widgets.Checkbox(value=True, description=\"Instruction mode: cut at next '### Instruction:'\", style={\"description_width\": \"initial\"})\n", "\n", "seed_box = widgets.IntText(\n", " value=-1,\n", " description=\"Seed (-1 = random):\",\n", " style={\"description_width\": \"140px\"},\n", " layout=widgets.Layout(width=\"260px\"),\n", ")\n", "\n", "generate_button = widgets.Button(description=\"Generate\", button_style=\"primary\", icon=\"magic\")\n", "\n", "output_area = widgets.Output()\n", "\n", "def on_generate_clicked(_):\n", " generate_button.disabled = True\n", " try:\n", " with output_area:\n", " clear_output(wait=True)\n", " seed = None if seed_box.value < 0 else seed_box.value\n", " instruction_mode = mode_toggle.value == \"Instruction\"\n", " prompt = make_prompt(prompt_box.value) if instruction_mode else (prompt_box.value or \" \")\n", " produced = bytearray(prompt.encode(\"utf-8\"))\n", " print(\"Generating...\\n\")\n", "\n", " def show_progress(b): # called with every new byte\n", " if b != 0:\n", " produced.append(b)\n", " if len(produced) % 12 == 0:\n", " clear_output(wait=True)\n", " print(bytes(produced).decode(\"utf-8\", errors=\"replace\"))\n", "\n", " text = run_generation(\n", " prompt=prompt,\n", " max_new_tokens=max_tokens_slider.value,\n", " temperature=temperature_slider.value,\n", " top_k=top_k_slider.value,\n", " top_p=top_p_slider.value,\n", " do_sample=not greedy_checkbox.value,\n", " seed=seed,\n", " streamer=show_progress,\n", " )\n", " clear_output(wait=True)\n", " if instruction_mode and cut_checkbox.value:\n", " text = cut_at_next_instruction(text, prompt)\n", " print(text)\n", " finally:\n", " generate_button.disabled = False\n", "\n", "generate_button.on_click(on_generate_clicked)\n", "\n", "controls = widgets.VBox([\n", " mode_toggle,\n", " prompt_box,\n", " widgets.HBox([temperature_slider, top_k_slider]),\n", " widgets.HBox([top_p_slider, max_tokens_slider]),\n", " widgets.HBox([seed_box, greedy_checkbox]),\n", " cut_checkbox,\n", " generate_button,\n", " output_area,\n", "])\n", "\n", "display(controls)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 5. Example prompts (optional)\n", "\n", "A few starting points for both modes (temperature 0.4, up to 400 new bytes). Sample generations for the model card are **to be added**; until then, expect code with the right overall shape but with logic errors, invented functions or syntax mistakes. Set `RUN = list(EXAMPLES)` to run all of them." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "EXAMPLES = {\n", " # instruction mode (wrapped in the template)\n", " \"fibonacci\": (\"instruct\", \"Write a Python function that returns the n-th Fibonacci number.\"),\n", " \"palindrome\": (\"instruct\", \"Write a Python function that checks whether a string is a palindrome.\"),\n", " \"sort_dicts\": (\"instruct\", \"Sort a list of dictionaries by the key 'age' in Python.\"),\n", " \"sql\": (\"instruct\", \"Write a SQL query that returns the 5 customers with the highest total order amount.\"),\n", " \"js_debounce\": (\"instruct\", \"Implement a debounce function in JavaScript.\"),\n", " # completion mode (text is continued as is)\n", " \"py_complete\": (\"completion\", 'def is_prime(n: int) -> bool:\\n \"\"\"Return True if n is a prime number.\"\"\"\\n'),\n", " \"c_complete\": (\"completion\", \"#include <stdio.h>\\n\\nint main(void) {\\n\"),\n", " \"rust_complete\": (\"completion\", \"fn factorial(n: u64) -> u64 {\\n\"),\n", "}\n", "\n", "RUN = [\"fibonacci\", \"py_complete\"] # or: RUN = list(EXAMPLES)\n", "\n", "for name in RUN:\n", " kind, text = EXAMPLES[name]\n", " print(f\"=== {name} ({kind}) ===\")\n", " if kind == \"instruct\":\n", " print(ask(text, max_new_tokens=400, temperature=0.4, seed=42))\n", " else:\n", " print(run_generation(text, max_new_tokens=400, temperature=0.4, top_p=0.95, seed=42))\n", " print()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 6. Batch generation (optional)\n", "\n", "Generate several answers to the same task β useful for comparing sampling settings or for seeing how much the answers vary. With code, it is often worth sampling a few candidates at low temperature and keeping the one that actually runs." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def batch_ask(task: str, n: int = 3, max_new_tokens: int = 300, temperature: float = 0.4, top_k: int = 0, top_p: float = 0.95):\n", " prompt = make_prompt(task)\n", " for i in range(n):\n", " text = run_generation(prompt, max_new_tokens=max_new_tokens, temperature=temperature, top_k=top_k, top_p=top_p)\n", " print(f\"[{i + 1}]\\n{cut_at_next_instruction(text, prompt)}\\n{'-' * 60}\")\n", "\n", "# Example β feel free to edit the arguments and re-run\n", "batch_ask(\"Write a Python function that reverses a linked list.\", n=3, max_new_tokens=300, temperature=0.4)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## About this model\n", "\n", "**CodeGen-5.5** is [NoTokenLM-Gen-5.5](https://huggingface.co/VeroLM/NoTokenLM-Gen-5.5) (a ~169M-parameter byte-level model: byte embeddings plus hashed n-gram and suffix-match (ROSA) features, a small local encoder, entropy-based patching, a 20-layer hybrid RWKV-7 / gated-attention trunk working on patches, and a local byte decoder) continued-trained in a single pass on source-code files (Python-heavy, plus JavaScript, TypeScript, Java, C, C++, Go, Rust, SQL and Shell) and on code instruction data in a plain-text template. The architecture and the entropy patcher are unchanged.\n", "\n", "It is not meant for production code generation, security-sensitive code, factual questions or conversation, and it has no safety tuning. The context is 4,096 *bytes*, a few hundred lines at most. See the full model card on Hugging Face for training details and limitations. **Benchmark results: to be added.**" ] } ], "metadata": { "colab": { "provenance": [], "name": "CodeGen-5.5-Playground.ipynb" }, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" }, "accelerator": "GPU" }, "nbformat": 4, "nbformat_minor": 5}123---license: apache-2.0---123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214---license: apache-2.0language:- enlibrary_name: transformerspipeline_tag: text-generationbase_model: VeroLM/NoTokenLM-Gen-5.5tags:- notokenlm- notoken_gen55- byte-level- tokenizer-free- hybrid- hierarchical- code- code-generation- custom_codedatasets:- OpenCoder-LLM/opc-sft-stage2- OpenCoder-LLM/opc-annealing-corpus- nvidia/OpenCodeInstruct- m-a-p/CodeFeedback-Filtered-Instruction- ise-uiuc/Magicoder-OSS-Instruct-75K- ise-uiuc/Magicoder-Evol-Instruct-110K- bigcode/self-oss-instruct-sc2-exec-filter-50k- bigcode/the-stack-dedup- bigcode/starcoderdata---# CodeGen-5.5**CodeGen-5.5** is a **tokenizer-free, byte-level language model for code**. It is [NoTokenLM-Gen-5.5](https://huggingface.co/VeroLM/NoTokenLM-Gen-5.5) further trained on source-code files and code instruction data. There is no vocabulary and no BPE: UTF-8 bytes go in, UTF-8 bytes come out. Instead of spending a full forward pass on every byte, the model groups bytes into variable-length *patches* (about 5 bytes on code) and runs its large trunk once per patch.It can **complete code** and it can **follow a simple plain-text instruction template** (`### Instruction:` / `### Response:`). It is a small research model (β 169 M parameters): its code often has the right shape but is frequently wrong, so treat every output as untrusted.| | || -------------- | -------------------------------------------------------------------------------------------- || Base model | [`VeroLM/NoTokenLM-Gen-5.5`](https://huggingface.co/VeroLM/NoTokenLM-Gen-5.5) || Parameters | **168.9 M** in total (incl. a 19.9 M hash-embedding table and a frozen 4.5 M entropy patcher) || Input / output | raw UTF-8 bytes (`0..255`), byte `0` = end of document || Context window | 4,096 bytes (the training window) || Trunk | 20 layers, `d = 768`, 5 Γ [RWKV-7, gated attention, RWKV-7, RWKV-7] || Fine-tuning | 7,662 steps on TPU v5e-8, β 8 GB of text: code files (5.5 GB budget) + code instruction data (3.5 GB budget) || Weights | EMA weights of the final checkpoint, fp32 || License | Apache-2.0 (see the note on data licenses below) |## ArchitectureThe architecture is identical to the base model:```bytes ββΊ byte embedding + hashed n-gram embedding (orders 3-8) + ROSA suffix-match featuresββΊ local encoder (conv, conv, windowed attention; d = 256)ββΊ entropy-based patching (max 16 bytes) ββΊ attention poolingββΊ trunk over patches: 5 Γ [RWKV-7 Β· NoPE gated attention Β· RWKV-7 Β· RWKV-7] (d = 768, SwiGLU)ββΊ local decoder (4 windowed-attention blocks; d = 256) ββΊ 256-way next-byte logits```- **Entropy patching.** A small frozen causal convolutional byte model predicts the next byte; wherever its entropy is above a calibrated threshold (`theta`, stored in `config.json`), a new patch starts. The patcher was **not** retrained for CodeGen-5.5, so patch boundaries follow the same rule as in the base model. Patches are somewhat shorter on code (β 5 bytes on average, against β 6 on general text).- **Hybrid trunk.** RWKV-7 layers carry most of the sequence mixing, with one gated, QK-normed, position-free attention layer in every block.- **Past-only hashed n-gram embeddings** (orders 3β8), **ROSA** suffix-match features (a copy mechanism that feeds the predicted next byte and match length into the encoder and the output logits) and **DeepEmbed** (per-byte scaling of local FFN activations).Only *closed* patches are passed from the trunk to the decoder, which is what makes generation cheap.## Quick startRequires `torch`, `transformers` and `safetensors`. `trust_remote_code=True` is needed because the architecture ships with the weights.```pythonfrom transformers import AutoModelForCausalLMmodel = AutoModelForCausalLM.from_pretrained("VeroLM/CodeGen-5.5", trust_remote_code=True).eval()prompt = ("### Instruction:\n""Write a Python function that returns the n-th Fibonacci number.\n\n""### Response:\n")print(model.generate_text(prompt, max_new_tokens=300, temperature=0.4, seed=0))```Plain code completion (no template) works too; about 60 % of the fine-tuning budget was ordinary source files:```pythonprompt = 'def is_prime(n: int) -> bool:\n """Return True if n is a prime number."""\n'print(model.generate_text(prompt, max_new_tokens=200, temperature=0.3, seed=0))```Working with raw byte ids (this is what `generate_text` does internally):```pythonimport torchids = torch.tensor([list(prompt.encode("utf-8"))])out = model.generate(ids, max_new_tokens=200, temperature=0.4, top_p=0.95, seed=0) # LongTensor (1, T + new)print(bytes(b for b in out[0].tolist() if b != 0).decode("utf-8", errors="replace"))````generate` supports `temperature`, `top_k`, `top_p`, `do_sample=False` (greedy), `seed` and `stop_at_eod`. Generation stops when the model emits byte `0` (end of document). Because the model works on bytes, a cut-off multi-byte character is possible at the end of a generation; decode with `errors="replace"`. Run in **float32** (the default). For code, temperatures around 0.2β0.5 usually work best.There is also an interactive playground notebook that supports both modes (instruction and completion).## Prompt formatInstruction data was converted to a plain-text template. The model has no special tokens; the end-of-document byte (`0`) follows every training example.```### Instruction:<task>### Response:<answer>```Multi-turn data repeats the two blocks, and an optional `### System:` block exists for data that has a system message. After its answer the model may continue with further, self-invented `### Instruction:` blocks until it emits the end-of-document byte; cut the output at the next `### Instruction:` if you only want the first answer.## TrainingCodeGen-5.5 starts from the EMA weights of the finished NoTokenLM-Gen-5.5 run, with a fresh optimizer and a step counter of 0.**Data.** A single stream, **one pass**: every source is read once and never repeated. Instruction data is converted to the template above; code files are used as they are (nothing is rewritten, files over 300 kB and near-empty files are dropped). Instruction data is de-duplicated with a Bloom filter, and a small slice of every source is held out for evaluation.| Group | Budget | Sources || ----- | ------ | ------- || **Source code files** | 5.5 GB | Stack-Edu Python (the largest share), The Stack (dedup) for JavaScript, TypeScript, Java, C, Go, Rust, Shell and SQL, StarCoder data for C++, and the OpenCoder annealing corpus || **Code instruction data (SFT)** | 3.5 GB | OpenCoder `opc-sft-stage2`, `OpenCodeInstruct`, `CodeFeedback-Filtered-Instruction`, `Magicoder-OSS-Instruct-75K`, `Magicoder-Evol-Instruct-110K`, `self-oss-instruct-sc2-exec-filter-50k` |The budgets are upper limits. Sources smaller than their share (several instruction sets) were used completely and the remainder was redistributed, so the amount actually seen is lower: the run processed β 8 GB (7,662 steps of 1,048,576 bytes) in total.**Setup.**| | || --- | --- || Hardware | TPU v5e-8 (data parallel, 8 chips) || Batch | 256 windows Γ 4,096 bytes = 1,048,576 bytes / step || Steps | 7,662 || Optimizer | Muon + AdamW (as in the base run), EMA 0.999 || Learning rate | peak 2.5e-4, 100 warm-up steps, then constant, with linear decay to 2 % of the peak over the last 20 % of the steps (the base run's peak was 1.5e-3: the base model had already converged, so a lower rate protects what it already knows) || Objective | causal next-byte prediction only (no masked steps) || Patch slots per window | `max_patches = 1536` || Precision | bfloat16 compute, fp32 weights |## Evaluation### Held-out bits per byteBits per byte (lower is better) of the EMA weights on small held-out slices of each training source, measured during training (last evaluation, step 7,500 of 7,662). Instruction data was scored in the same template used for training.| Group | Mean bpb | Step 2,000 β step 7,500 || ----- | -------- | ----------------------- || All sources | 0.591 | 0.644 β 0.591 || Code files | 0.696 | 0.754 β 0.696 || Instruction data | 0.399 | 0.443 β 0.399 || Code files | bpb | | Instruction data | bpb || ---------- | --- | --- | ---------------- | --- || Python | 0.66 | | OpenCodeInstruct | 0.28 || JavaScript | 0.60 | | OpenCoder SFT | 0.41 || TypeScript | 0.50 | | CodeFeedback | 0.32 || Java | 0.46 | | Magicoder OSS-Instruct | 0.36 || Go | 0.52 | | Magicoder Evol-Instruct | 0.65 || C++ | 0.61 | | self-oss-instruct | 0.37 || C | 0.72 | | | || Rust | 0.73 | | | || Shell | 0.96 | | | || SQL | 1.45 | | | || OpenCoder annealing | 0.43 | | | |These are language-modelling numbers on slices that are small, so they are noisy, and they say little about whether generated code *works*; they cannot be compared across sources (different data have different intrinsic entropy) or with the bpb of the base model on general text. Shell and SQL are clearly the hardest.### Benchmarks**Benchmark results: to be added.**| Benchmark | NoTokenLM-Gen-5.5 (base) | CodeGen-5.5 || --------- | :----------------------: | :---------: || HumanEval (pass@1) | β | *to be added* || MBPP (pass@1) | β | *to be added* || HellaSwag | 34.32 | *to be added* || ARC-Easy | 38.68 | *to be added* || PIQA | 60.77 | *to be added* || ArithMark3 | 37.20 | *to be added* || Tiny ToM | 38.15 | *to be added* || BananaMind Base Bench | 54.57 | *to be added* |The base-model column is copied from the [base model card](https://huggingface.co/VeroLM/NoTokenLM-Gen-5.5#evaluation). The general-knowledge rows are listed because specialising on code can cost general ability.## Sample generations*To be added.*## Intended use and limitations- **Intended for:** research on byte-level / tokenizer-free and patch-based models, studying how such a model adapts to code, and experiments with a small code-capable base.- **Not for:** production code generation, code that is run without review, security-sensitive code, factual question answering, or general chat. There is no safety tuning and no preference tuning of any kind.- **Small model.** With about 169 M parameters, expect code that has the right overall shape but contains logic errors, wrong API usage, invented functions and syntax mistakes.- **Short context.** The window is 4,096 *bytes* (a few hundred lines at most), not tokens. Long files and multi-file context do not fit.- **Languages.** Python is the largest share of the code data. JavaScript, TypeScript, Java, C, C++, Go, Rust, SQL and Shell are present in smaller amounts and SQL and Shell are weak. Other languages are not part of the fine-tuning data. Instruction data is mostly English.- **Template, not chat.** The `### Instruction:` / `### Response:` format is a plain-text convention, not a chat interface.- **Possible memorisation.** Like any model trained on public source code, it may reproduce licensed code, or code containing secrets or vulnerabilities, from its training data.- **Data licenses.** The weights are released under Apache-2.0, but the training data comes from several sources with their own terms (some instruction sets are synthetic and were generated with other language models; The Stack and StarCoder data are gated and restricted to permissively licensed code, with their own conditions). Check the individual dataset cards before commercial use.## Repository contents| File | What it is || ---- | ---------- || `model.safetensors` | EMA weights (fp32), including the frozen entropy patcher under the `patcher.` prefix || `config.json` | architecture hyper-parameters, calibrated patch threshold `theta`, training step || `configuration_notoken_gen55.py`, `modeling_notoken_gen55.py` | PyTorch implementation (inference) || `tokenization_notoken_gen55.py`, `tokenizer_config.json` | trivial byte "tokenizer" (`id == byte value`) |## LicenseApache-2.0. See the notes on data licenses above.
CodeGen-5.5-Playground.ipynbAdded+392
README.md+211