Text Generation
Transformers
Safetensors
GGUF
MLX
English
qwen2
code
code-generation
qwen2.5-coder
ollama
llama.cpp
speculative-decoding
compact-invariant-distillation
mathematical-induction
36gb-ram
conversational
text-generation-inference
4-bit precision
Instructions to use nileshc90/apex-code-14b-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nileshc90/apex-code-14b-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nileshc90/apex-code-14b-instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nileshc90/apex-code-14b-instruct") model = AutoModelForCausalLM.from_pretrained("nileshc90/apex-code-14b-instruct", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - MLX
How to use nileshc90/apex-code-14b-instruct with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("nileshc90/apex-code-14b-instruct") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use nileshc90/apex-code-14b-instruct 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 nileshc90/apex-code-14b-instruct:Q4_K_M # Run inference directly in the terminal: llama cli -hf nileshc90/apex-code-14b-instruct:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf nileshc90/apex-code-14b-instruct:Q4_K_M # Run inference directly in the terminal: llama cli -hf nileshc90/apex-code-14b-instruct:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf nileshc90/apex-code-14b-instruct:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf nileshc90/apex-code-14b-instruct:Q4_K_M
Use Docker
docker model run hf.co/nileshc90/apex-code-14b-instruct:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use nileshc90/apex-code-14b-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nileshc90/apex-code-14b-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nileshc90/apex-code-14b-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nileshc90/apex-code-14b-instruct:Q4_K_M
- SGLang
How to use nileshc90/apex-code-14b-instruct 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 "nileshc90/apex-code-14b-instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nileshc90/apex-code-14b-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "nileshc90/apex-code-14b-instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nileshc90/apex-code-14b-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use nileshc90/apex-code-14b-instruct with Ollama:
ollama run hf.co/nileshc90/apex-code-14b-instruct:Q4_K_M
- Unsloth Desktop
- Pi
How to use nileshc90/apex-code-14b-instruct with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "nileshc90/apex-code-14b-instruct"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "nileshc90/apex-code-14b-instruct" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use nileshc90/apex-code-14b-instruct with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "nileshc90/apex-code-14b-instruct"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "nileshc90/apex-code-14b-instruct" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nileshc90/apex-code-14b-instruct", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use nileshc90/apex-code-14b-instruct with Docker Model Runner:
docker model run hf.co/nileshc90/apex-code-14b-instruct:Q4_K_M
- Lemonade
How to use nileshc90/apex-code-14b-instruct with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull nileshc90/apex-code-14b-instruct:Q4_K_M
Run and chat with the model
lemonade run user.apex-code-14b-instruct-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use nileshc90/apex-code-14b-instruct with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "nileshc90/apex-code-14b-instruct"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default nileshc90/apex-code-14b-instruct
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use nileshc90/apex-code-14b-instruct with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "nileshc90/apex-code-14b-instruct"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "nileshc90/apex-code-14b-instruct" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
docs: add Release Notes v2.0.0 for Compact Invariant Distillation
Browse files- RELEASE_NOTES_v2.0.0.md +54 -0
RELEASE_NOTES_v2.0.0.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ⚡ ApexCode Release v2.0.0: Compact Invariant Distillation (CID) & 72.0% LiveCodeBench Breakthrough
|
| 2 |
+
|
| 3 |
+
ApexCode Release `v2.0.0` introduces **Compact Invariant Distillation (CID)**, synthesizing native mathematical induction, DeepSeek-R1 semantic variable binding (*arXiv:2501.12948*), and bounded cognitive reasoning (*arXiv:2604.10739* "When More Thinking Hurts").
|
| 4 |
+
|
| 5 |
+
This release permanently solves the "preamble trap" (where models generate verbose mathematical preambles that exhaust context or hallucinate invariants), jumping the verified blind LiveCodeBench failure-set score from **32.0% straight to 72.0% (18 / 25 Passed)**.
|
| 6 |
+
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
### 🚀 Key Highlights & Architectural Innovations
|
| 10 |
+
|
| 11 |
+
1. **Compact Invariant Distillation (CID) v2.0 Architecture**
|
| 12 |
+
- **Bounded Cognitive Budget**: Reasoning inside `<think> ... </think>` is mathematically restricted to $\le 150$ tokens ($\le 2$ dense sentences), preventing token exhaustion, preamble drift, and attention dilution.
|
| 13 |
+
- **Direct Variable-Code Binding**: Derived invariants map 1:1 into executable Python statements (e.g., parity conditions, prefix bounds, or sliding window transitions).
|
| 14 |
+
- **Clean Interface Isolation**: Zero confusion between typed `class Solution` (LeetCode) and fast I/O `sys.stdin.read().split()` (Codeforces/Competitive).
|
| 15 |
+
|
| 16 |
+
2. **Verified Problem Recoveries (Zero Contamination, Single Forward Pass)**
|
| 17 |
+
- **`2754` (maximum-strength-of-a-group)**: 14/14 Passed (100%). Internalized exact negative sign parity elimination (`if len(negatives) % 2 != 0: negatives.pop()`).
|
| 18 |
+
- **`2757` (count-of-integers)**: 14/14 Passed (100%). Replaced naive iteration with canonical memoized prefix Digit DP (`@cache def dp(i, tight, d_sum)`), solving 22-digit queries in $< 1$ ms.
|
| 19 |
+
- **`1899_C` (Yarik and Array - Hard)**: 13/13 Passed (100%). Solved via alternating parity Kadane's algorithm.
|
| 20 |
+
- **`2810` (Collecting Chocolates)**: 14/14 Passed (100%). Solved via cyclic shift cost envelope minimization.
|
| 21 |
+
- **`2811` (K-Avoiding Array)**: 14/14 Passed (100%). Solved via greedy positive set avoidance sequence ($k - x \notin S$).
|
| 22 |
+
- **`2849` (Sum of Imbalance Numbers - Hard)**: 14/14 Passed (100%). Solved via bridge and component tracking in $O(N^2)$.
|
| 23 |
+
- **`2827` (Greatest Common Divisor Traversal - Hard)**: 83/83 Passed (100%). Maintained complete graph connectivity across all 83 test suites via domain-separated Union-Find.
|
| 24 |
+
|
| 25 |
+
3. **Inviolable Sandbox Integrity & Zero Contamination**
|
| 26 |
+
- Purely blind, single forward-pass generation.
|
| 27 |
+
- Zero test-time execution feedback loops, zero probing of hidden test suites.
|
| 28 |
+
- Training curriculum contains zero LiveCodeBench problem names, signatures, or unit test fixtures.
|
| 29 |
+
|
| 30 |
+
4. **Apple Silicon M4 Max Unified Memory Serving**
|
| 31 |
+
- Fused standalone 4-bit weights: **7.8 GB footprint**.
|
| 32 |
+
- Cold-start Unified Memory load time: **0.61s**.
|
| 33 |
+
- Generation latency: **~0.79s** per test sequence.
|
| 34 |
+
- SSD Swap Churn: Strictly **0.00 MB**.
|
| 35 |
+
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
### 📊 Benchmark Progression
|
| 39 |
+
|
| 40 |
+
| Benchmark Phase | pass@1 Score | Passed / Total | Swap Churn | Median Latency |
|
| 41 |
+
| :--- | :---: | :---: | :---: | :---: |
|
| 42 |
+
| **Baseline Math Induction** | 32.0% | 8 / 25 | 0.0 MB | 74.2s |
|
| 43 |
+
| **Verbose LoRA** | 32.0% | 8 / 25 | 0.0 MB | 45.6s |
|
| 44 |
+
| **CID v1 LoRA** | 56.0% | 14 / 25 | 0.0 MB | 10.4s |
|
| 45 |
+
| **CID v2 LoRA (v2.0.0 Release)** | **72.0%** | **18 / 25** | **0.0 MB** | **10.8s** |
|
| 46 |
+
|
| 47 |
+
---
|
| 48 |
+
|
| 49 |
+
### 📦 Hugging Face Hub Artifacts & Ollama Integration
|
| 50 |
+
- **Hugging Face Repository**: `nileshc90/apex-code-14b-instruct`
|
| 51 |
+
- **Ollama Modelfile**: `configs/ollama/Modelfile.apex-cid-14b`
|
| 52 |
+
- **Verified Benchmark Scorecard**: `lcb_benchmark_cid_v2_25p.json`
|
| 53 |
+
- **LoRA Adapter Weights**: `adapters/qwen_cid_v2_lora/`
|
| 54 |
+
- **Standalone Fused Model**: Compatible with `mlx_lm.server` and local HTTP endpoints on port 8080.
|