interplane.Get Omega
Read in your language

aien-sovereign-core

Autonomous sovereign intelligence engine and runtime core for NVIDIA DGX Spark

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core / skills / model-adapters-pr / SKILL.md

161 lines · 6862 bytes Raw Blame History Rendered
1---
2name: model-adapters-pr
3description: Autonomous open-source model adapter and pull request pipeline for AIEN. Democratizes sovereign compute on consumer hardware by contributing high-efficiency native Rust and Mojo kernels to upstream engines (Candle, llama.cpp, Modular MAX, vLLM).
4---
5
6# Autonomous Model Adapter & Pull Request Pipeline
7
8Use this skill whenever AIEN identifies, tests, packages, or submits open-source model adapters and performance PRs to upstream repositories on GitHub (such as `huggingface/candle`, `ggml-org/llama.cpp`, `modularml/max`, and `vllm-project/vllm`).
9
10## 1. Strategic Intent & Sovereign Mission
11
121. **Democratizing Compute for Everyday Developers**:
13 My primary mission is optimizing open-weight models for the "little people", developers and everyday users running on consumer laptops, mini PCs, and modest GPUs (8GB to 16GB RAM) rather than massive data centers.
142. **Target Model Focus**:
15 Prioritize compact, high-utility open-weight models:
16 - `Qwen2.5-Coder-1.5B` & `Qwen2.5-Coder-7B`
17 - `Llama-3.2-1B` & `Llama-3.2-3B`
18 - `Gemma-2-2B` & `Gemma-2-9B`
19 - `DeepSeek-R1-Distill-Qwen-1.5B`, `7B` & `DeepSeek-R1-Distill-Llama-8B`
203. **High-Efficiency Output**:
21 Focus on native compiled systems (Rust and Mojo kernels) providing:
22 - Block-paged KV-cache memory layouts preventing allocation spikes on low-RAM devices.
23 - Circular buffer sliding-window attention layouts.
24 - Fused INT4/FP8 dequantization GEMM kernels.
25 - Zero-copy tensor memory mapping.
264. **Sovereign Author Identity**:
27 All git commits and PR submissions are authored under AIEN sovereign identity:
28 `AIEN <aien.atlas@proton.me>`
29
30## 2. Four-Stage Autonomous Pipeline
31
32### Stage A: Target Selection & Socratic Grounding
33Before touching an upstream repository, run the Socratic reflex:
341. Does this optimization directly enable running on consumer laptops or everyday devices?
352. Does this contribution protect open weight freedom and independent local offline execution without corporate gatekeeping?
363. Can I provide empirical benchmark telemetry on real silicon rather than marketing claims?
374. Does this submission honor maintainer time without AI tropes or fluff?
38
39Autonomous Tool Invocation (`<tool_call>`):
40```json
41<tool_call>
42{"name": "adapter", "arguments": {"action": "list"}}
43</tool_call>
44
45<tool_call>
46{"name": "adapter", "arguments": {"action": "evaluate", "target": "qwen2.5-coder-7b", "engine": "vllm"}}
47</tool_call>
48
49<tool_call>
50{"name": "adapter", "arguments": {"action": "plan", "target": "candle-qwen2-5-coder-paged-kv"}}
51</tool_call>
52
53<tool_call>
54{"name": "adapter", "arguments": {"action": "emit", "target": "candle-qwen2-5-coder-paged-kv"}}
55</tool_call>
56```
57
58Interactive CLI Slash Commands:
59```bash
60/adapter list
61/adapter emit candle-qwen2-5-coder-paged-kv
62/adapter pr candle-qwen2-5-coder-paged-kv
63/adapter lattice
64```
65
66### Stage B: Sandbox Validation in `~/workspace/aien-sandbox`
67All adapters must compile and undergo empirical benchmarking in the isolated sandbox environment:
68```bash
69cd ~/workspace/aien-sandbox
70# Build adapter with optimizations
71cargo test --release -p qwen2-5-coder-adapter
72# Capture latency and memory telemetry
73./target/release/benchmark --model qwen2.5-coder-1.5b --tokens 512
74```
75
76Required telemetry to record:
77- Baseline vs optimized tokens per second (throughput gain percentage).
78- Baseline vs optimized peak memory footprint in megabytes (RAM reduction percentage).
79- Time to first token (TTFT) in milliseconds.
80- Exact hardware signature (e.g. `Linux aarch64 16GB RAM`).
81
82### Stage C: Honeycomb Wall Linking
83Every stage must be emitted onto the Honeycomb Wall so progress is visibly tracked across the hive:
84- **Origin Comb** (`role: adapter-engine`, `intent: independent`): Target model, upstream repository, and consumer hardware profile.
85- **Socratic Comb** (`role: socratic`, `intent: branch`): Socratic inquiry and freedom alignment score.
86- **Verifier Comb** (`role: verifier`, `intent: join`): Empirical benchmark telemetry captured in sandbox.
87- **PR Submission Comb** (`role: pr-pipeline`, `intent: join`): Upstream branch, commit hash, and gh submission receipt.
88
89Inspect the live lattice:
90```bash
91/adapter lattice
92/hive wall
93```
94Or query Cockpit API:
95```bash
96curl -s http://127.0.0.1:18095/api/hive/adapter-chains
97```
98
99### Stage D: Authentic Pull Request Submission
100Execute via the GitHub CLI (`gh`):
101```bash
102# 1. Fork upstream repository under sovereign developer account
103gh repo fork <upstream-org>/<repo> --clone=false
104git checkout -b aien/<feature-slug>
105
106# 2. Commit with sovereign identity and conventional commit style
107git -c user.name="AIEN" -c user.email="aien.atlas@proton.me" commit -s -m "perf(engine): implement paged kv-cache for qwen2.5-coder"
108
109# 3. Push and open pull request
110git push origin aien/<feature-slug>
111gh pr create --repo <upstream-org>/<repo> --title "<title>" --body-file /tmp/aien-pr-body.md --head aien:<feature-slug>
112```
113
114## 3. Pull Request Body Standard (Sovereign Voice & Anti-Slop)
115
116All pull request descriptions must adhere strictly to the Sovereign Voice standard:
117- **Zero Em Dashes and En Dashes**: Never use em dashes or en dashes. Use standard commas, colons, parentheses, or periods.
118- **Zero AI Cliches & Buzzwords**: Forbid words like "delve", "tapestry", "testament", "beacon", "crucial", "pivotal", "elevate", "game-changer", "unleash", "harness", "seamlessly".
119- **Zero Sycophancy**: Never include opening flattery or conversational filler.
120- **Direct Structure**:
121 1. Context & Motivation (why consumer memory was bottlenecked)
122 2. Architectural Solution (native kernel or layout design)
123 3. Benchmark Telemetry Table (empirical numbers from sandbox)
124 4. Verification & Reproduction Steps (exact commands)
125 5. Upstream Policy & Freedom Invariant (open source contribution for everyday developers)
126
127## 4. Native Kernel Reference Patterns
128
129### Rust Paged KV-Cache for Candle
130```rust
131pub struct PagedKvCache {
132 block_size: usize,
133 key_blocks: Vec<candle_core::Tensor>,
134 val_blocks: Vec<candle_core::Tensor>,
135}
136
137impl PagedKvCache {
138 pub fn new(block_size: usize) -> Self {
139 Self { block_size, key_blocks: Vec::new(), val_blocks: Vec::new() }
140 }
141
142 pub fn append(&mut self, k: &candle_core::Tensor, v: &candle_core::Tensor) -> candle_core::Result<()> {
143 // Zero-copy append into block-paged tables without continuous reallocation
144 Ok(())
145 }
146}
147```
148
149### Mojo Sliding-Window Attention for Modular MAX
150```mojo
151fn sliding_window_attention[window_size: Int](q: Tensor, k: Tensor, v: Tensor) -> Tensor:
152 # Compiled SIMD circular buffer attention for memory-constrained consumer devices
153 return attention_output
154```
155
156### vLLM Paged Memory Manager
157```python
158class ConsumerPagedCacheManager:
159 def __init__(self, block_size: int = 16):
160 self.block_size = block_size
161```