How benevalterjr/nativa works
Nativa combines a Python-like DSL and interpreter with an AOT C99 path, tensor/model-loading facilities, and separate native local-LLM runtimes. The main user workflow is to run a Nativa program or quantize model weights and then generate text through chat or the API. The graph also preserves the documented BitNet, OpenCL, and benchmarking capabilities; several internal connections are based on README statements because the relevant implementation excerpts were not shown.
Main entry points: nativa.py DSL Frontend · nativa_engine.c NATQ4 Engine · chat_natq4.py Interactive Chat · nativa_sampling.h Token Sampling
Components 24
Language and Runtime
- DSL Frontend
nativa.py - Semantic Analyzer
nativa.py - Interpreter
nativa.py - Tensor Runtime
nativa.py - SafeTensors Loader
nativa.py - AOT C99 Backend
nativa.py - Native Runtime
nativa_rt.h - BitNet Kernels
nativa.py - OpenCL Runtime
tools/nativa_opencl.h
Model Inference
- NATQ4 Engine
tools/nativa_engine.c - Token Sampling
tools/nativa_sampling.h - Qwen 1.5B Runner
tools/qwen_1.5b_q4_native.c - Qwen 1.5B Runner V1
tools/qwen_1.5b_q4_native_v1.c - Qwen 3B Runner
tools/qwen_3b_q4_native.c - Model Offsets
tools/qwen_offsets.h
Model Formats
- Model Quantizer
tools/nativa_quantize.py - NATQ4 Format
tools/natq4_format.h
User Interfaces
- Interactive Chat
tools/chat_natq4.py - HTTP API Server
tools/api_server.py - Model Bundler
tools/nativa_bundle.py
Evaluation
- Benchmark Suite
tools/nativa_benchmark.py - Inference Evaluation
tools/experimento_real_cortex_hipocampo.py
Other components
- Developer
- Local User
Connections 30
- Developer → DSL Frontend: writes programs
README.md - Local User → DSL Frontend: runs programs
README.md - DSL Frontend → Semantic Analyzer: analyzes syntax
README.md - Semantic Analyzer → Interpreter: enables execution
nativa.py - Interpreter → Tensor Runtime: uses tensors
nativa.py - Local User → Model Quantizer: quantizes weights
README.md - Model Quantizer → NATQ4 Format: writes format
- Local User → Interactive Chat: starts chat
README.md - Interactive Chat → NATQ4 Format: loads model
- Interactive Chat → NATQ4 Engine: runs inference
- Local User → HTTP API Server: sends requests
README.md - HTTP API Server → Model Bundler: imports bundler
tools/api_server.py - HTTP API Server → DSL Frontend: imports runtime
tools/api_server.py - Model Bundler → DSL Frontend: imports runtime
tools/nativa_bundle.py - NATQ4 Engine → NATQ4 Format: reads format
tools/nativa_engine.c - NATQ4 Engine → Token Sampling: uses sampling
tools/nativa_engine.c - Qwen 1.5B Runner → Token Sampling: uses sampling
tools/qwen_1.5b_q4_native.c - Qwen 1.5B Runner V1 → Token Sampling: uses sampling
tools/qwen_1.5b_q4_native_v1.c - Qwen 3B Runner → Token Sampling: uses sampling
tools/qwen_3b_q4_native.c - Qwen 1.5B Runner → Model Offsets: imports offsets
tools/qwen_1.5b_q4_native.c - Qwen 1.5B Runner V1 → Model Offsets: imports offsets
tools/qwen_1.5b_q4_native_v1.c - Qwen 3B Runner → Model Offsets: imports offsets
tools/qwen_3b_q4_native.c - Local User → AOT C99 Backend: builds program
README.md - AOT C99 Backend → Native Runtime: uses runtime
- Interpreter → SafeTensors Loader: loads weights
nativa.py - Local User → Benchmark Suite: runs benchmarks
README.md - Benchmark Suite → Interactive Chat: imports chat tools
tools/nativa_benchmark.py - Local User → Inference Evaluation: evaluates inference
- DSL Frontend → BitNet Kernels: supports ternary compute
README.md - NATQ4 Engine → OpenCL Runtime: optional device path