Text Generation
Transformers
GGUF
PyTorch
code
multiscale_transformer
code-generation
multi-scale-transformer
cpu-optimized
cubic
llama
byte-level
Eval Results (legacy)
Instructions to use CubicLabs/AXL-Reasoning-Lion with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CubicLabs/AXL-Reasoning-Lion with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CubicLabs/AXL-Reasoning-Lion")# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("CubicLabs/AXL-Reasoning-Lion", dtype="auto") - llama-cpp-python
How to use CubicLabs/AXL-Reasoning-Lion with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="CubicLabs/AXL-Reasoning-Lion", filename="axl-reasoning-lion-f16.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use CubicLabs/AXL-Reasoning-Lion with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf CubicLabs/AXL-Reasoning-Lion:Q4_K_M # Run inference directly in the terminal: llama cli -hf CubicLabs/AXL-Reasoning-Lion:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf CubicLabs/AXL-Reasoning-Lion:Q4_K_M # Run inference directly in the terminal: llama cli -hf CubicLabs/AXL-Reasoning-Lion:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf CubicLabs/AXL-Reasoning-Lion:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf CubicLabs/AXL-Reasoning-Lion:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf CubicLabs/AXL-Reasoning-Lion:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf CubicLabs/AXL-Reasoning-Lion:Q4_K_M
Use Docker
docker model run hf.co/CubicLabs/AXL-Reasoning-Lion:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use CubicLabs/AXL-Reasoning-Lion with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CubicLabs/AXL-Reasoning-Lion" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CubicLabs/AXL-Reasoning-Lion", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/CubicLabs/AXL-Reasoning-Lion:Q4_K_M
- SGLang
How to use CubicLabs/AXL-Reasoning-Lion 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 "CubicLabs/AXL-Reasoning-Lion" \ --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": "CubicLabs/AXL-Reasoning-Lion", "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 "CubicLabs/AXL-Reasoning-Lion" \ --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": "CubicLabs/AXL-Reasoning-Lion", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use CubicLabs/AXL-Reasoning-Lion with Ollama:
ollama run hf.co/CubicLabs/AXL-Reasoning-Lion:Q4_K_M
- Unsloth Studio
How to use CubicLabs/AXL-Reasoning-Lion with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for CubicLabs/AXL-Reasoning-Lion to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for CubicLabs/AXL-Reasoning-Lion to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for CubicLabs/AXL-Reasoning-Lion to start chatting
- Atomic Chat new
- Docker Model Runner
How to use CubicLabs/AXL-Reasoning-Lion with Docker Model Runner:
docker model run hf.co/CubicLabs/AXL-Reasoning-Lion:Q4_K_M
- Lemonade
How to use CubicLabs/AXL-Reasoning-Lion with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull CubicLabs/AXL-Reasoning-Lion:Q4_K_M
Run and chat with the model
lemonade run user.AXL-Reasoning-Lion-Q4_K_M
List all available models
lemonade list
File size: 5,608 Bytes
3abc4d1 c3c7188 a702f57 c3c7188 3abc4d1 c3c7188 a702f57 c3c7188 a702f57 c3c7188 a702f57 c3c7188 a702f57 c3c7188 a702f57 c3c7188 a702f57 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | ---
license: apache-2.0
language:
- code
tags:
- code-generation
- multi-scale-transformer
- cpu-optimized
- cubic
- pytorch
- llama
- gguf
- byte-level
pipeline_tag: text-generation
library_name: transformers
datasets:
- bigcode/starcoderdata
- sahil2801/CodeAlpaca-20k
widget:
- text: "def quicksort(arr):"
- text: "# Calculate factorial step by step\ndef factorial(n):"
model-index:
- name: AXL-Reasoning-Lion
results:
- task:
type: text-generation
metrics:
- name: Perplexity (byte-level)
type: perplexity
value: 1.03
---
# AXL-Reasoning-Lion
Chain-of-thought reasoning. 70M params, 5 layers/scale. PPL 1.03. Context 256 bytes. Part of the AXL model family by [CubicLabs](https://huggingface.co/CubicLabs).
## Model Details
| Property | Value |
|----------|-------|
| Developed by | [CubicLabs](https://huggingface.co/CubicLabs) |
| Architecture | Multi-Scale Transformer |
| Parameters | 70M |
| Optimizer | Lion |
| Attention | SDPA |
| Vocab Size | 258 (byte-level) |
| Context Window | 256 bytes |
| d_model | 512 |
| Attention Heads | 4 |
| Layers per Scale | 5 |
| Downsample Factors | [1, 2, 4] |
| License | Apache 2.0 |
### Sources
- **Repository:** [GitHub](https://github.com/Cubic/AXL)
- **Organization:** [CubicLabs](https://huggingface.co/CubicLabs)
## Uses
### Direct Use
Multi-step code generation requiring reasoning.
```python
import torch
from multiscale_transformer.model.model import MultiScaleTransformer
from multiscale_transformer.training.tokenizer import ByteTokenizer
ckpt = torch.load("axl_reasoning_lion.pt", map_location="cpu")
model = MultiScaleTransformer(config)
model.load_state_dict(ckpt["model_state_dict"])
model.eval()
tokenizer = ByteTokenizer()
ids = torch.tensor([tokenizer.encode("def hello():")], dtype=torch.long)
with torch.no_grad():
out = model.generate(ids, max_new_tokens=50, temperature=0.8)
print(tokenizer.decode(out[0].tolist()))
```
### Out-of-Scope Use
Not for production code generation. Not for non-code NLP tasks. For integration with tools like Continue.dev, LlamaIndex, or LangChain, use the Python API server which provides OpenAI-compatible endpoints.
## Bias, Risks, and Limitations
Byte-level perplexity is not comparable to BPE-level perplexity. Not suitable for production code generation. Max context 256 bytes (~80 lines of Python). IMPORTANT: GGUF files exported for Ollama/LM Studio use only the fine-scale encoder (1/3 of the AXL architecture). The reported PPL applies to the full multi-scale model. For full AXL quality, use the Python API server at http://localhost:8880/v1/completions.
### Recommendations
- Use for prototyping and experimentation, not production code generation.
- Byte-level perplexity (258 vocab) is not comparable to BPE-level perplexity (32K vocab).
- For better results, use the Lion-optimized version if available.
## Training Details
### Training Data
Trained on 50MB real HF Python code. 205 steps in 20 min. 5-layer architecture captures long dependency chains.
### Preprocessing
Byte-level tokenization with vocabulary size 258 (256 bytes + BOS + EOS). No vocabulary training required.
### Speeds, Sizes, Times
| Metric | Value |
|--------|-------|
| Training Steps | 205 |
| Training Time | 20 min |
| Final Loss | 0.6279 |
## Evaluation
### Metrics
Perplexity on held-out Python code using byte-level tokenization.
### Results
| Metric | Value |
|--------|-------|
| Perplexity (byte-level) | 1.03 |
| Final Loss | 0.6279 |
| Training Steps | 205 |
| Training Time | 20 min |
**Summary:** Best for multi-step code generation. Extra layers help with complex logic.
## Environmental Impact
| Property | Value |
|----------|-------|
| Hardware | AMD Ryzen 5 5600G |
| Hours Used | 0.334 |
| Carbon Emitted | 0.0140 kg CO2 |
| Cloud Provider | None (local CPU) |
## Technical Specifications
### Model Architecture
Multi-Scale Transformer with three parallel encoder stacks at resolution scales 1x, 2x, and 4x. Cross-scale attention connects all scale pairs. Adaptive gating fusion. SwiGLU feed-forward. RoPE positional encoding.
### Compute Infrastructure
| Property | Value |
|----------|-------|
| Hardware | AMD Ryzen 5 5600G (6 cores, 12 threads) |
| RAM | 16 GB |
| GPU | None (CPU-only) |
## Citation
```bibtex
@misc{axl_2026,
title={AXL: AXL-Reasoning-Lion - Multi-Scale Transformer for CPU Code Generation},
author={Cubic},
year={2026},
url={[https://huggingface.co/CubicLabs](https://huggingface.co/CubicLabs)}
}
```
## How to Get Started
### With Ollama
```bash
ollama create axl-reasoning-lion -f Modelfile
ollama run axl-reasoning-lion "def fibonacci():"
```
### With Python
```python
import torch
from multiscale_transformer.model.config import load_config
from multiscale_transformer.model.model import MultiScaleTransformer
from multiscale_transformer.training.tokenizer import ByteTokenizer
config = load_config("config.json")
model = MultiScaleTransformer(config)
ckpt = torch.load("axl_reasoning_lion.pt", map_location="cpu")
model.load_state_dict(ckpt["model_state_dict"])
model.eval()
tokenizer = ByteTokenizer()
prompt = "def fibonacci():"
ids = torch.tensor([tokenizer.encode(prompt)], dtype=torch.long)
with torch.no_grad():
out = model.generate(ids, max_new_tokens=100, temperature=0.8, top_k=40)
print(tokenizer.decode(out[0].tolist()))
``` |