Text Generation
Transformers
PyTorch
GGUF
code
multiscale_transformer
code-generation
multi-scale-transformer
cpu-optimized
cubic
llama
byte-level
vision
multi-modal
Eval Results (legacy)
Instructions to use CubicLabs/AXL-Vision-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CubicLabs/AXL-Vision-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CubicLabs/AXL-Vision-v2")# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("CubicLabs/AXL-Vision-v2", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CubicLabs/AXL-Vision-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CubicLabs/AXL-Vision-v2" # 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-Vision-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/CubicLabs/AXL-Vision-v2
- SGLang
How to use CubicLabs/AXL-Vision-v2 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-Vision-v2" \ --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-Vision-v2", "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-Vision-v2" \ --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-Vision-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use CubicLabs/AXL-Vision-v2 with Docker Model Runner:
docker model run hf.co/CubicLabs/AXL-Vision-v2
| license: apache-2.0 | |
| language: | |
| - code | |
| tags: | |
| - code-generation | |
| - multi-scale-transformer | |
| - cpu-optimized | |
| - cubic | |
| - pytorch | |
| - llama | |
| - gguf | |
| - byte-level | |
| - vision | |
| - multi-modal | |
| pipeline_tag: text-generation | |
| library_name: transformers | |
| datasets: | |
| - cubic/axl-synthetic-ui | |
| model-index: | |
| - name: AXL-Vision-v2 | |
| results: | |
| - task: | |
| type: text-generation | |
| metrics: | |
| - name: Perplexity (byte-level) | |
| type: perplexity | |
| value: --- | |
| # AXL-Vision-v2 | |
| UI vision. 4.1M params. Screen-to-code prototype. Trained on synthetic UI screenshots. 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 | 4M | | |
| | Optimizer | SGD | | |
| | Attention | SDPA | | |
| | Vocab Size | 258 (byte-level) | | |
| | Context Window | 256 bytes | | |
| | d_model | 256 | | |
| | Attention Heads | 4 | | |
| | Layers per Scale | 6 | | |
| | 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 | |
| UI screenshot to code prototype. | |
| ```python | |
| import torch | |
| from multiscale_transformer.model.model import MultiScaleTransformer | |
| from multiscale_transformer.training.tokenizer import ByteTokenizer | |
| ckpt = torch.load("axl_vision_v2.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 text generation. Vision-only model. For integration with tools like Continue.dev, LlamaIndex, or LangChain, use the Python API server which provides OpenAI-compatible endpoints. | |
| ## Bias, Risks, and Limitations | |
| This is a vision encoder, not a text generation model. No GGUF export available. Low accuracy on real screenshots. Note: GGUF files for Ollama use a simplified single-stack encoder. For full AXL quality, use the Python API server. | |
| ### 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 for 20 min on 2000 synthetic UI screenshots. Element classification (buttons, textboxes, navbars). | |
| ### Preprocessing | |
| Byte-level tokenization with vocabulary size 258 (256 bytes + BOS + EOS). No vocabulary training required. | |
| ### Speeds, Sizes, Times | |
| | Metric | Value | | |
| |--------|-------| | |
| | Training Steps | 1418 | | |
| | Training Time | 10 min | | |
| | Final Loss | 2.7868 | | |
| ## Evaluation | |
| ### Metrics | |
| Perplexity on held-out Python code using byte-level tokenization. | |
| ### Results | |
| | Metric | Value | | |
| |--------|-------| | |
| | Perplexity (byte-level) | --- | | |
| | Final Loss | 2.7868 | | |
| | Training Steps | 1418 | | |
| | Training Time | 10 min | | |
| **Summary:** Screen-to-code. Trained on synthetic UI elements. | |
| ## Environmental Impact | |
| | Property | Value | | |
| |----------|-------| | |
| | Hardware | AMD Ryzen 5 5600G | | |
| | Hours Used | 0.167 | | |
| | Carbon Emitted | 0.0070 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-Vision-v2 - 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-vision-v2 -f Modelfile | |
| ollama run axl-vision-v2 "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_vision_v2.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())) | |
| ``` |