eigencore 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- eigencore-0.4.0/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
- eigencore-0.4.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
- eigencore-0.4.0/.github/ISSUE_TEMPLATE/feature_request.md +16 -0
- eigencore-0.4.0/.github/PULL_REQUEST_TEMPLATE.md +14 -0
- eigencore-0.4.0/.github/workflows/ci.yml +52 -0
- eigencore-0.4.0/.github/workflows/release.yml +62 -0
- eigencore-0.4.0/.gitignore +13 -0
- eigencore-0.4.0/CHANGELOG.md +86 -0
- eigencore-0.4.0/CODE_OF_CONDUCT.md +32 -0
- eigencore-0.4.0/CONTRIBUTING.md +44 -0
- eigencore-0.4.0/LICENSE +21 -0
- eigencore-0.4.0/PKG-INFO +144 -0
- eigencore-0.4.0/README.md +114 -0
- eigencore-0.4.0/SECURITY.md +23 -0
- eigencore-0.4.0/assets/brand/README-snippet.md +9 -0
- eigencore-0.4.0/assets/brand/README.md +33 -0
- eigencore-0.4.0/assets/brand/eigencore-banner-animated.svg +1 -0
- eigencore-0.4.0/assets/brand/eigencore-banner.png +0 -0
- eigencore-0.4.0/assets/brand/eigencore-banner.svg +1 -0
- eigencore-0.4.0/assets/brand/eigencore-lockup-dark.png +0 -0
- eigencore-0.4.0/assets/brand/eigencore-lockup-dark.svg +1 -0
- eigencore-0.4.0/assets/brand/eigencore-lockup-light.png +0 -0
- eigencore-0.4.0/assets/brand/eigencore-lockup-light.svg +1 -0
- eigencore-0.4.0/assets/brand/eigencore-logo.png +0 -0
- eigencore-0.4.0/assets/brand/eigencore-logo.svg +1 -0
- eigencore-0.4.0/assets/brand/eigencore-mark-small.svg +1 -0
- eigencore-0.4.0/assets/brand/eigencore-wordmark-ink.svg +1 -0
- eigencore-0.4.0/assets/brand/eigencore-wordmark-light.svg +1 -0
- eigencore-0.4.0/assets/brand/favicon-16.png +0 -0
- eigencore-0.4.0/assets/brand/favicon-32.png +0 -0
- eigencore-0.4.0/assets/brand/favicon-512.png +0 -0
- eigencore-0.4.0/assets/brand/favicon-apple-touch.png +0 -0
- eigencore-0.4.0/assets/brand/favicon.ico +0 -0
- eigencore-0.4.0/assets/brand/favicon.svg +1 -0
- eigencore-0.4.0/docs/INDEX.md +38 -0
- eigencore-0.4.0/docs/architecture/competitive-landscape.md +57 -0
- eigencore-0.4.0/docs/architecture/local-inference-roadmap.md +62 -0
- eigencore-0.4.0/docs/architecture/ml-foundations.md +94 -0
- eigencore-0.4.0/docs/architecture/system-overview.md +57 -0
- eigencore-0.4.0/docs/design/DESIGN_HANDBOOK.md +238 -0
- eigencore-0.4.0/docs/design/TUI.md +66 -0
- eigencore-0.4.0/docs/design/terminal-chat.md +90 -0
- eigencore-0.4.0/docs/design/tui/approval-card.svg +1 -0
- eigencore-0.4.0/docs/design/tui/chat-plain.svg +1 -0
- eigencore-0.4.0/docs/design/tui/chat-wide.svg +1 -0
- eigencore-0.4.0/docs/design/tui/onboarding-fit.svg +1 -0
- eigencore-0.4.0/docs/design/tui/ssd-warning.svg +1 -0
- eigencore-0.4.0/docs/design/tui/states.svg +1 -0
- eigencore-0.4.0/docs/presentation/SLIDES_V2.md +173 -0
- eigencore-0.4.0/docs/presentation/STUDY_GUIDE.md +178 -0
- eigencore-0.4.0/docs/research/adaptive-training.md +78 -0
- eigencore-0.4.0/docs/research/emergent-gaps.md +143 -0
- eigencore-0.4.0/docs/research/gemini-session-insights.md +54 -0
- eigencore-0.4.0/docs/research/matrix-math-foundations.md +80 -0
- eigencore-0.4.0/docs/research/sparse-activation-and-routing.md +92 -0
- eigencore-0.4.0/docs/review/FINAL_REPORT.md +274 -0
- eigencore-0.4.0/docs/review/HOPLITE_PROMPT.md +88 -0
- eigencore-0.4.0/docs/review/research/engine-fit.md +87 -0
- eigencore-0.4.0/docs/review/research/kernels.md +84 -0
- eigencore-0.4.0/docs/review/research/layerskip-ssd.md +108 -0
- eigencore-0.4.0/docs/review/research/sparse.md +66 -0
- eigencore-0.4.0/docs/review/research/specdec.md +77 -0
- eigencore-0.4.0/docs/review/research/tui-sandbox.md +108 -0
- eigencore-0.4.0/docs/roadmap/custom-model-plan.md +84 -0
- eigencore-0.4.0/docs/roadmap/phased-plan.md +83 -0
- eigencore-0.4.0/pyproject.toml +52 -0
- eigencore-0.4.0/src/eigencore/__init__.py +82 -0
- eigencore-0.4.0/src/eigencore/agent/__init__.py +45 -0
- eigencore-0.4.0/src/eigencore/agent/executor.py +297 -0
- eigencore-0.4.0/src/eigencore/agent/grammar.py +121 -0
- eigencore-0.4.0/src/eigencore/agent/policy.py +262 -0
- eigencore-0.4.0/src/eigencore/agent/react.py +261 -0
- eigencore-0.4.0/src/eigencore/agent/tool.py +149 -0
- eigencore-0.4.0/src/eigencore/analysis/__init__.py +3 -0
- eigencore-0.4.0/src/eigencore/analysis/sparsity.py +184 -0
- eigencore-0.4.0/src/eigencore/benchmark/__init__.py +33 -0
- eigencore-0.4.0/src/eigencore/benchmark/harness.py +342 -0
- eigencore-0.4.0/src/eigencore/cli/__init__.py +0 -0
- eigencore-0.4.0/src/eigencore/cli/main.py +856 -0
- eigencore-0.4.0/src/eigencore/context/__init__.py +3 -0
- eigencore-0.4.0/src/eigencore/context/manager.py +318 -0
- eigencore-0.4.0/src/eigencore/engine/__init__.py +3 -0
- eigencore-0.4.0/src/eigencore/engine/inference.py +378 -0
- eigencore-0.4.0/src/eigencore/engine/layer_skip.py +268 -0
- eigencore-0.4.0/src/eigencore/engine/prompt_lookup.py +39 -0
- eigencore-0.4.0/src/eigencore/engine/pruning.py +116 -0
- eigencore-0.4.0/src/eigencore/engine/sparse_inference.py +218 -0
- eigencore-0.4.0/src/eigencore/engine/sparsity_experiment.py +109 -0
- eigencore-0.4.0/src/eigencore/engine/speculative.py +238 -0
- eigencore-0.4.0/src/eigencore/fit/__init__.py +34 -0
- eigencore-0.4.0/src/eigencore/fit/estimator.py +310 -0
- eigencore-0.4.0/src/eigencore/fit/gguf_meta.py +130 -0
- eigencore-0.4.0/src/eigencore/forge.py +216 -0
- eigencore-0.4.0/src/eigencore/hal/__init__.py +3 -0
- eigencore-0.4.0/src/eigencore/hal/_cpuid_win.py +119 -0
- eigencore-0.4.0/src/eigencore/hal/profiler.py +349 -0
- eigencore-0.4.0/src/eigencore/kernels/__init__.py +28 -0
- eigencore-0.4.0/src/eigencore/kernels/q4k.py +76 -0
- eigencore-0.4.0/src/eigencore/kernels/reference.py +168 -0
- eigencore-0.4.0/src/eigencore/models/__init__.py +3 -0
- eigencore-0.4.0/src/eigencore/models/registry.py +193 -0
- eigencore-0.4.0/src/eigencore/router/__init__.py +3 -0
- eigencore-0.4.0/src/eigencore/router/classifier.py +176 -0
- eigencore-0.4.0/src/eigencore/training/__init__.py +3 -0
- eigencore-0.4.0/src/eigencore/training/convergence.py +112 -0
- eigencore-0.4.0/src/eigencore/training/trainer.py +401 -0
- eigencore-0.4.0/src/eigencore/tui/__init__.py +5 -0
- eigencore-0.4.0/src/eigencore/tui/chat.py +265 -0
- eigencore-0.4.0/src/eigencore/tui/onboarding.py +134 -0
- eigencore-0.4.0/src/eigencore/tui/theme.py +61 -0
- eigencore-0.4.0/tests/__init__.py +0 -0
- eigencore-0.4.0/tests/test_approval.py +148 -0
- eigencore-0.4.0/tests/test_benchmark.py +170 -0
- eigencore-0.4.0/tests/test_context.py +128 -0
- eigencore-0.4.0/tests/test_convergence.py +114 -0
- eigencore-0.4.0/tests/test_engine_integration.py +104 -0
- eigencore-0.4.0/tests/test_executor.py +158 -0
- eigencore-0.4.0/tests/test_fit.py +161 -0
- eigencore-0.4.0/tests/test_gpu_fit.py +76 -0
- eigencore-0.4.0/tests/test_grammar.py +139 -0
- eigencore-0.4.0/tests/test_kernels.py +164 -0
- eigencore-0.4.0/tests/test_kv_options.py +75 -0
- eigencore-0.4.0/tests/test_layer_skip.py +100 -0
- eigencore-0.4.0/tests/test_onboarding.py +110 -0
- eigencore-0.4.0/tests/test_optimization_audit.py +98 -0
- eigencore-0.4.0/tests/test_policy.py +246 -0
- eigencore-0.4.0/tests/test_profiler.py +58 -0
- eigencore-0.4.0/tests/test_prompt_lookup.py +104 -0
- eigencore-0.4.0/tests/test_pruning.py +65 -0
- eigencore-0.4.0/tests/test_react.py +229 -0
- eigencore-0.4.0/tests/test_registry_moe.py +24 -0
- eigencore-0.4.0/tests/test_router.py +96 -0
- eigencore-0.4.0/tests/test_sparse_inference.py +161 -0
- eigencore-0.4.0/tests/test_sparsity_experiment.py +60 -0
- eigencore-0.4.0/tests/test_speculative.py +150 -0
- eigencore-0.4.0/tests/test_tool.py +181 -0
- eigencore-0.4.0/tests/test_tui_chat.py +194 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Something EigenCore does wrong
|
|
4
|
+
labels: bug
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**What happened**
|
|
8
|
+
|
|
9
|
+
**What you expected**
|
|
10
|
+
|
|
11
|
+
**How to reproduce**
|
|
12
|
+
Command(s) and the smallest input that shows it:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
eigencore ...
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**Environment**
|
|
19
|
+
- OS and version:
|
|
20
|
+
- Python version:
|
|
21
|
+
- EigenCore commit or version:
|
|
22
|
+
- llama-cpp-python version and how it was installed:
|
|
23
|
+
- CPU, RAM, GPU (if any):
|
|
24
|
+
- Model file and quant (name, size):
|
|
25
|
+
|
|
26
|
+
**Output**
|
|
27
|
+
Paste the error or `eigencore profile` output (remove anything private).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature or optimization proposal
|
|
3
|
+
about: Suggest a feature, or an optimization with a plan to measure it
|
|
4
|
+
labels: enhancement
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Problem it solves**
|
|
8
|
+
|
|
9
|
+
**Proposal**
|
|
10
|
+
|
|
11
|
+
**Status label it would change** (PLANNED → SHIPPED, REPORTED-ONLY → SHIPPED, ...)
|
|
12
|
+
|
|
13
|
+
**How we'd know it works**
|
|
14
|
+
For a performance change: the benchmark, hardware and quality check that would prove it. For a UI change: the terminals and modes it must work in (Rich, `--plain`, Windows Terminal, SSH).
|
|
15
|
+
|
|
16
|
+
**Alternatives considered**
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## What this changes
|
|
2
|
+
|
|
3
|
+
## Why
|
|
4
|
+
|
|
5
|
+
## Status labels affected
|
|
6
|
+
<!-- e.g. "Speculative decoding: REPORTED-ONLY → SHIPPED (prompt lookup only)" or "none" -->
|
|
7
|
+
|
|
8
|
+
## Evidence
|
|
9
|
+
- [ ] Tests added or updated
|
|
10
|
+
- [ ] `pytest`, `ruff check` and `ruff format --check` pass locally
|
|
11
|
+
- [ ] Performance claims, if any, include benchmark JSON and the named hardware
|
|
12
|
+
- [ ] User-facing text uses SHIPPED / REPORTED-ONLY / PLANNED correctly
|
|
13
|
+
- [ ] CHANGELOG.md updated under "Unreleased"
|
|
14
|
+
- [ ] No binary files added
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ${{ matrix.os }}
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
os: [ubuntu-latest, windows-latest]
|
|
15
|
+
python-version: ["3.10", "3.12"]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install -e ".[dev]" --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
|
29
|
+
|
|
30
|
+
- name: Lint
|
|
31
|
+
run: ruff check src/ tests/
|
|
32
|
+
|
|
33
|
+
- name: Test
|
|
34
|
+
run: pytest tests/ -v --tb=short
|
|
35
|
+
|
|
36
|
+
lint:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
|
|
41
|
+
- uses: actions/setup-python@v5
|
|
42
|
+
with:
|
|
43
|
+
python-version: "3.12"
|
|
44
|
+
|
|
45
|
+
- name: Install ruff
|
|
46
|
+
run: pip install "ruff>=0.4.0,<0.15"
|
|
47
|
+
|
|
48
|
+
- name: Check formatting
|
|
49
|
+
run: ruff format --check src/ tests/
|
|
50
|
+
|
|
51
|
+
- name: Check imports
|
|
52
|
+
run: ruff check --select I src/ tests/
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
id-token: write # PyPI trusted publishing (OIDC) — no API token stored in GitHub
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
pypi:
|
|
14
|
+
name: Publish to PyPI
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
23
|
+
|
|
24
|
+
- name: Build sdist + wheel
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip build
|
|
27
|
+
python -m build
|
|
28
|
+
|
|
29
|
+
- name: Publish to PyPI (trusted publishing)
|
|
30
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
31
|
+
with:
|
|
32
|
+
# Requires the GitHub OIDC publisher configured once at
|
|
33
|
+
# https://pypi.org/manage/project/eigencore/publishing/ (owner action).
|
|
34
|
+
print-hash: true
|
|
35
|
+
|
|
36
|
+
release:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
with:
|
|
41
|
+
fetch-depth: 0
|
|
42
|
+
|
|
43
|
+
- name: Generate changelog
|
|
44
|
+
id: changelog
|
|
45
|
+
run: |
|
|
46
|
+
PREV_TAG=$(git tag --sort=-v:refname | head -2 | tail -1)
|
|
47
|
+
if [ -z "$PREV_TAG" ]; then
|
|
48
|
+
CHANGES=$(git log --pretty=format:"- %s" HEAD)
|
|
49
|
+
else
|
|
50
|
+
CHANGES=$(git log --pretty=format:"- %s" "${PREV_TAG}..HEAD")
|
|
51
|
+
fi
|
|
52
|
+
echo "changes<<EOF" >> "$GITHUB_OUTPUT"
|
|
53
|
+
echo "$CHANGES" >> "$GITHUB_OUTPUT"
|
|
54
|
+
echo "EOF" >> "$GITHUB_OUTPUT"
|
|
55
|
+
|
|
56
|
+
- name: Create GitHub Release
|
|
57
|
+
uses: softprops/action-gh-release@v2
|
|
58
|
+
with:
|
|
59
|
+
generate_release_notes: false
|
|
60
|
+
body: |
|
|
61
|
+
## What's Changed
|
|
62
|
+
${{ steps.changelog.outputs.changes }}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to EigenCore. Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow the git tags. Dates are commit dates.
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.4.0] - 2026-11-11
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- PyPI release pipeline: `release.yml` now publishes sdist+wheel to PyPI on `v*` tags via trusted publishing (OIDC, `pypa/gh-action-pypi-publish`, no stored tokens). After tagging `v0.4.0` and configuring the GitHub OIDC publisher at pypi.org, `pip install eigencore` works. README quick start updated accordingly (prebuilt llama.cpp wheel index documented for Windows/CPU).
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Stage E slice 3: activation-sparsity experiment scaffolding (REPORTED-ONLY, not wired into inference). `engine/sparsity_experiment.py`: per-layer activation sparsity measurement, sparse-mask plan that only applies above a minimum sparsity, and the kill criterion (measured quality delta > allowed → killed). Rationale recorded: on bandwidth-bound CPU decode the compute saving is small, so the kill criterion matters. No claim without owner runs.
|
|
14
|
+
- Stage E slice 2: layer-pruning experiment scaffolding (REPORTED-ONLY, not wired into inference). `engine/pruning.py` computes ShortGPT Block Influence per layer from boundary hidden states, builds a prune plan that protects head/tail layers, and enforces the kill criterion (measured quality delta > allowed → killed, no pruning). No quality/performance claim without the owner's calibration + perplexity runs.
|
|
15
|
+
- Stage E slice 1: Q4_K reference kernel (`kernels/q4k.py`) — full GGUF super-block dequant (fp16 d/dmin, packed 6-bit sc/min, 4-bit quants, `d*sc*q - dmin*m`) plus grouped quantized dot, on `BackendProtocol`/`ScalarBackend`. **Bit-exact vs `gguf.quants.dequantize` for Q4_K** on random blocks. Reference only; no performance claim, not wired into inference.
|
|
16
|
+
- Stage D slice 3: adaptive terminal chrome + first-run onboarding. New `tui/theme.py` capability probe (`--plain`, non-TTY, `NO_COLOR`, `TERM=dumb` → plain; width tiers wide ≥100 / narrow; header shortens on narrow). New `tui/onboarding.py`: first-run model picker grouped by fit verdict (MoE shows resident vs read-per-token GiB), SSD-paging warning before load when the file exceeds free RAM, config persisted to `~/.eigencore/config.json` (`onboarded`) so it runs once; skipped entirely when non-interactive. Speed in the picker is labeled ESTIMATE.
|
|
17
|
+
- Stage D slice 2: policy-backed approvals. New `agent.policy.ApprovalManager` (ASK / SESSION / DENY, session-scoped per tool name, audit-logged). `ToolExecutor(approver=..., ask_fn=...)` consults it after policy passes but before running; no callback attached means deny. Chat UI renders an approval card (exact redacted args, y/s/n) via `ChatUI.render_approval_card`, plus `/approvals`. Enforcement stays in the executor, never in prompt text or rendering.
|
|
18
|
+
- Stage D slice 1: tool-handler process isolation hardened with POSIX rlimits on the child worker (`RLIMIT_CPU`, `RLIMIT_AS`, `RLIMIT_FSIZE`; `RLIMIT_NPROC` opt-in only, default off because it breaks library imports in the child). Configurable via `ToolExecutor(max_cpu_seconds=, max_memory_mb=, max_file_size_mb=, max_processes=)`; skipped safely on non-POSIX. Kill-on-timeout unchanged.
|
|
19
|
+
- Stage C slice 4: prompt-lookup decoding behind `--pld` on `run`/`chat` (default OFF until the owner's §9 item-9 measurements decide). `engine.prompt_lookup.longest_prompt_continuation` finds the longest prompt-verbatim continuation; the engine emits it directly and swallows the covered backend tokens to keep the stream aligned; copied chars reported via `engine.last_pld_copied_chars`. No speedup claimed.
|
|
20
|
+
- Stage C slice 3: GPU/VRAM fit and layer offload. `profile_hardware()` detects NVIDIA VRAM via `nvidia-smi` (never raises; zeros when absent) and `HardwareProfile` gains `gpu_name`/`total_vram_gb`/`available_vram_gb`, shown in `profile`. `fit.gpu_layers_for_vram()` computes how many layers fit in VRAM after a reserve and the KV cache; `estimate_fit(..., available_vram_gb=...)` reports `gpu_layers`/`gpu_weights_gb` with a note. `InferenceEngine(..., n_gpu_layers=...)` replaces the hardcoded 0; `eigencore run`/`chat` gained `--gpu-layers` and auto-recommend offload when a GPU is detected and the flag is omitted (0 still means CPU-only).
|
|
21
|
+
- Stage C slice 2: KV-cache type and flash-attention options. `InferenceEngine(..., kv_type="fp16"|"q8_0", flash_attn=...)` maps to llama.cpp `type_kv` (0/1); `eigencore run` and `eigencore chat` gained `--kv [fp16|q8_0]` and `--no-flash`. `q8_0` halves KV-cache memory; the fit estimator already accounts for it via `kv_quant`.
|
|
22
|
+
- MoE-aware fit (Stage C slice 1): `ModelGeometry.expert_count`/`expert_used_count` parsed from GGUF (`{arch}.expert_count*`); `ModelSpec.experts_total`/`experts_active` with `is_moe`; registry gains `qwen3-30b-a3b` (Qwen3-30B-A3B, 128 experts / 8 active, Q4_K_M ≈ 18.6 GiB). `estimate_fit` now reports `active_weights_gb`, `resident`, and a `decode_ceiling_tok_s` = bandwidth ÷ active bytes-per-token (ceiling, not a measurement); non-resident models get an explicit mmap/SSD-paging warning. CLI shows MoE active params, resident/paging status, and the ceiling. No dense-model SSD streaming built, per the review.
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
- Chat TUI: model output is sanitized (ANSI/OSC/CSI stripped, newline/tab kept) and Rich-escaped; Ctrl-C mid-stream keeps partial history without regenerating; stream errors keep the partial response and never double-print.
|
|
26
|
+
- Benchmark harness: completion tokens counted via the backend tokenizer (chars/4 fallback only when no tokenizer), and the summary reports cold (first run per case) vs warm runs separately instead of one mixed median.
|
|
27
|
+
- Agent safety: `ToolExecutor` is now deny-by-default (defaults to `default_policy()` — READ-only, workspace-confined — when no policy is passed; `Forge.agent()`/`ReActAgent` inherit this). Path confinement uses explicitly declared `ToolParam(is_path=True)` parameters (no more name heuristics) and handlers receive resolved workspace-confined absolute paths. Timeouts now run handlers in a spawned process that is terminated/killed on timeout. Successful string output is credential-redacted. Tests cover `/etc/passwd` denial and child-process kill.
|
|
28
|
+
- Q4_0 reference dequantizer: corrected to the ggml strided nibble layout (byte j low nibble → element j, high nibble → element j+16) and now also accepts raw 18-byte blocks; Q8_0 accepts 34-byte blocks. Verified bit-exact against `gguf.quants.dequantize` for Q4_0 and Q8_0.
|
|
29
|
+
- Fit estimator: all sizes in GiB end to end; weights use actual GGUF file size when available; KV cache computed only from architecture-aware GGUF geometry (`{arch}.block_count` / `embedding_length` / `attention.head_count*`), otherwise verdict is `UNKNOWN` instead of a 15–30×-low heuristic; `max_context_for_budget` returns 0 without geometry. CLI `profile`/`models`/`chat` pass real GGUF metadata when the model is downloaded. Profiler GiB/GB mix fixed and 25% of usable RAM reserved for KV, so recommended context no longer pins at 2048 below ~38 GiB. Added `gguf` dependency and `eigencore.fit.read_gguf_model_info`.
|
|
30
|
+
|
|
31
|
+
### Documentation
|
|
32
|
+
- Added a full review: truth audit, 30–40B memory and bandwidth arithmetic, ranked issues, prioritized plan and owner benchmark list (`docs/review/`).
|
|
33
|
+
- Brand v2: flat logo, small mark, favicon, lockups, wordmarks and banners as SVG in `assets/brand/` (PNG/ICO exports to follow); v2 design handbook.
|
|
34
|
+
- Brand v2 fix: eigen-axis realigned to a clean 45° dotted line inside the die, evenly spaced dots, no trace crossings; middle trace now ends on the axis.
|
|
35
|
+
- Added MIT `LICENSE` (© 2026 Khubaib Nazeer).
|
|
36
|
+
- Added terminal UI status, technology decision and v2 screen mock-ups (`docs/design/TUI.md`, `docs/design/tui/`).
|
|
37
|
+
- Added presentation materials: slides v2 text with change list, and a study guide (`docs/presentation/`).
|
|
38
|
+
- README rewritten to install from source (not on PyPI), with a SHIPPED / REPORTED-ONLY / PLANNED status table and known bugs.
|
|
39
|
+
- Review notes added to research and positioning docs whose claims overstate the code.
|
|
40
|
+
- Added CONTRIBUTING, CODE_OF_CONDUCT, SECURITY, issue and PR templates, and this changelog.
|
|
41
|
+
|
|
42
|
+
### Known issues (found by the review, not yet fixed)
|
|
43
|
+
- Fit estimator KV fallback underestimates by ~15–30×, and the CLI always uses it.
|
|
44
|
+
- Profiler GiB/GB mix pins recommended context at 2048 below ~38 GB RAM.
|
|
45
|
+
- Q4_0 reference dequantizer and its test use the wrong nibble order.
|
|
46
|
+
- Tool policy is opt-in in the agent API; executor timeout does not stop handlers; path checks depend on parameter names.
|
|
47
|
+
- Chat crashes on Rich markup in model output and passes terminal escape sequences.
|
|
48
|
+
- Speculative verifier is not a correct rejection sampler.
|
|
49
|
+
|
|
50
|
+
## [Post-0.3.0 on main] - 2026-07-18 to 2026-11-08
|
|
51
|
+
Not tagged; package version is still 0.3.0.
|
|
52
|
+
|
|
53
|
+
### Added
|
|
54
|
+
- Phase 1 benchmark harness with quality cases and JSON reports.
|
|
55
|
+
- Conservative model-fit estimator with KV-cache and context budgeting.
|
|
56
|
+
- Deny-unless-allow-listed tool policy engine with path confinement and audit log.
|
|
57
|
+
- Streaming chat UI with plain mode, slash commands and fit-aware header.
|
|
58
|
+
- Backend protocol and scalar reference kernels with tests.
|
|
59
|
+
- Brand kit and animated banner.
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
- Optimization statistics labelled as reported-only; none is wired into the backend.
|
|
63
|
+
- CI pins ruff below 0.15.
|
|
64
|
+
|
|
65
|
+
### Fixed
|
|
66
|
+
- `generate`/`stream` routed through chat completion.
|
|
67
|
+
|
|
68
|
+
## [0.3.0] - 2026-07-18
|
|
69
|
+
### Added
|
|
70
|
+
- Agent framework: tool system, GBNF grammar builder, ReAct loop, wired into the Forge API, with tests.
|
|
71
|
+
- `benchmark` command; Phase 2 optimizers attached to the inference engine (reporting only).
|
|
72
|
+
### Changed
|
|
73
|
+
- README rewritten.
|
|
74
|
+
|
|
75
|
+
## [0.2.0] - 2026-07-17
|
|
76
|
+
### Added
|
|
77
|
+
- Hardware profiler with CPUID detection and model registry.
|
|
78
|
+
- Inference engine over llama.cpp with hardware-aware configuration.
|
|
79
|
+
- Task router, attention-aware context manager, QLoRA training components, sparsity analysis tools.
|
|
80
|
+
- CLI and Forge API; architecture, research and roadmap docs.
|
|
81
|
+
- Layer-skipping scheduler, speculative decoding module and sparsity predictor (not wired into inference).
|
|
82
|
+
- GitHub Actions CI and release workflow.
|
|
83
|
+
|
|
84
|
+
## [0.1.0] - 2026-07-17
|
|
85
|
+
### Added
|
|
86
|
+
- Project skeleton with `pyproject.toml` and README.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Code of conduct
|
|
2
|
+
|
|
3
|
+
EigenCore follows the spirit of the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). This is a short, project-sized version of it.
|
|
4
|
+
|
|
5
|
+
## Our pledge
|
|
6
|
+
|
|
7
|
+
We want participation in EigenCore to be harassment-free for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, colour, religion, or sexual identity and orientation.
|
|
8
|
+
|
|
9
|
+
## Expected behaviour
|
|
10
|
+
|
|
11
|
+
- Be kind and assume good intent.
|
|
12
|
+
- Critique code and claims, not people. Disagreement backed by evidence is welcome.
|
|
13
|
+
- Accept correction gracefully, including about numbers you published.
|
|
14
|
+
- Help newcomers; this is a learning-friendly project.
|
|
15
|
+
|
|
16
|
+
## Unacceptable behaviour
|
|
17
|
+
|
|
18
|
+
- Harassment, insults, slurs, sexualised language or imagery, and personal attacks.
|
|
19
|
+
- Publishing someone's private information without permission.
|
|
20
|
+
- Sustained disruption of issues, discussions or reviews.
|
|
21
|
+
|
|
22
|
+
## Scope
|
|
23
|
+
|
|
24
|
+
This applies in all project spaces (issues, pull requests, discussions) and when representing the project elsewhere.
|
|
25
|
+
|
|
26
|
+
## Reporting and enforcement
|
|
27
|
+
|
|
28
|
+
Report incidents privately to the maintainer (contact listed in `pyproject.toml`). Reports are handled confidentially. The maintainer may warn, temporarily restrict, or ban participants, depending on severity, following the Contributor Covenant's enforcement guidelines.
|
|
29
|
+
|
|
30
|
+
## Attribution
|
|
31
|
+
|
|
32
|
+
Adapted from the Contributor Covenant, version 2.1, https://www.contributor-covenant.org/version/2/1/code_of_conduct/.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Contributing to EigenCore
|
|
2
|
+
|
|
3
|
+
Thanks for helping. EigenCore is a small, pre-alpha project, so this guide is short.
|
|
4
|
+
|
|
5
|
+
## Before you start
|
|
6
|
+
|
|
7
|
+
- Read the [review and plan](docs/review/FINAL_REPORT.md); section 8 lists the work in priority order.
|
|
8
|
+
- For anything larger than a small fix, open an issue first so we can agree on the approach.
|
|
9
|
+
|
|
10
|
+
## Setup
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
git clone https://github.com/Khubaib7-del/EigenCore.git
|
|
14
|
+
cd EigenCore
|
|
15
|
+
python -m pip install -e ".[dev]"
|
|
16
|
+
pytest tests/ -v
|
|
17
|
+
ruff check src/ tests/
|
|
18
|
+
ruff format --check src/ tests/
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
CI runs on Ubuntu and Windows with Python 3.10 and 3.12. Ruff is pinned below 0.15 on purpose.
|
|
22
|
+
|
|
23
|
+
## Rules that keep the project honest
|
|
24
|
+
|
|
25
|
+
1. **Label claims.** Anything user-facing (README, docs, CLI or TUI output) is SHIPPED, REPORTED-ONLY or PLANNED. Don't describe a plan as a feature.
|
|
26
|
+
2. **No unmeasured numbers.** No "x faster", "speedup" or tok/s unless it was measured, with the machine, model, quant, context, threads and backend version recorded. Arithmetic ceilings are labelled "estimate".
|
|
27
|
+
3. **Correctness before speed.** New kernels or optimizations need a reference comparison (for kernels: gguf-py / ggml), a fallback, and a benchmark through `eigencore benchmark` before they can be enabled by default.
|
|
28
|
+
4. **Safety stays below the UI.** Tool permissions are enforced in the policy layer, never only in prompts or rendering.
|
|
29
|
+
5. **No binary files** (images, decks, models, archives) in pull requests unless a maintainer asks.
|
|
30
|
+
|
|
31
|
+
## Pull requests
|
|
32
|
+
|
|
33
|
+
- One concern per PR, with tests.
|
|
34
|
+
- Add a line under "Unreleased" in [CHANGELOG.md](CHANGELOG.md).
|
|
35
|
+
- Use [Conventional Commit](https://www.conventionalcommits.org/) prefixes (`feat:`, `fix:`, `docs:`, `test:`, `ci:`), as the history already does.
|
|
36
|
+
- Fill in the PR template, including which status label the change affects.
|
|
37
|
+
|
|
38
|
+
## Benchmarks
|
|
39
|
+
|
|
40
|
+
If your change claims a performance effect, attach the JSON from `eigencore benchmark --report run.json` (or `llama-bench -o json`) and name the hardware. Maintainers may ask for a run on the reference laptop before merging.
|
|
41
|
+
|
|
42
|
+
## Conduct
|
|
43
|
+
|
|
44
|
+
By participating you agree to the [code of conduct](CODE_OF_CONDUCT.md).
|
eigencore-0.4.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Khubaib Nazeer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
eigencore-0.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: eigencore
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: CPU-first LLM intelligence runtime — hardware-aware inference, training, and agent orchestration
|
|
5
|
+
Author-email: Khubaib Nazeer <khubaibnazeer8@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: ai,cpu,framework,inference,llm
|
|
9
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Requires-Dist: click>=8.0.0
|
|
16
|
+
Requires-Dist: gguf>=0.10.0
|
|
17
|
+
Requires-Dist: huggingface-hub>=0.20.0
|
|
18
|
+
Requires-Dist: llama-cpp-python>=0.3.0
|
|
19
|
+
Requires-Dist: psutil>=5.9.0
|
|
20
|
+
Requires-Dist: rich>=13.0.0
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
23
|
+
Requires-Dist: ruff<0.15,>=0.4.0; extra == 'dev'
|
|
24
|
+
Provides-Extra: train
|
|
25
|
+
Requires-Dist: bitsandbytes>=0.43.0; extra == 'train'
|
|
26
|
+
Requires-Dist: peft>=0.10.0; extra == 'train'
|
|
27
|
+
Requires-Dist: torch>=2.0.0; extra == 'train'
|
|
28
|
+
Requires-Dist: transformers>=4.40.0; extra == 'train'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
<img src="assets/brand/eigencore-banner-animated.svg" alt="EigenCore — local models, on your own silicon" width="100%">
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
<h1 align="center">EigenCore</h1>
|
|
36
|
+
<p align="center">A CPU-first Python runtime for local language models, hardware-aware inference, and agent building blocks.</p>
|
|
37
|
+
|
|
38
|
+
<p align="center">
|
|
39
|
+
<img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-3776AB?logo=python&logoColor=white">
|
|
40
|
+
<img alt="Version 0.3.0" src="https://img.shields.io/badge/version-0.3.0-56A9F5">
|
|
41
|
+
<img alt="License MIT" src="https://img.shields.io/badge/license-MIT-72B7A8">
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
EigenCore profiles a machine, estimates whether a local model fits, and runs inference through `llama-cpp-python` (llama.cpp). It also ships a benchmark harness, a terminal chat, and agent building blocks with a tool policy layer. The transformer math is llama.cpp's; EigenCore owns the judgement around it.
|
|
45
|
+
|
|
46
|
+
> **Reality check:** a dense 30–40B model at 4-bit is roughly 18–24 GB of weights, more than 8–16 GB of RAM before any KV cache. It can only run by paging from SSD, and decode is then expected to be well under 1 token/s (estimate). Even when a model fits, CPU decode is memory-bandwidth-bound: tok/s ≤ bandwidth ÷ weight bytes. The realistic route to 30B-class models on a 16 GB laptop is a Mixture-of-Experts model, which is planned and not yet measured. See the [review](docs/review/FINAL_REPORT.md) for the arithmetic. No speed figure in this repository is a measurement until a named-hardware run is published.
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
Install from PyPI:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
python -m pip install eigencore
|
|
54
|
+
# on Windows/CPU without prebuilt llama.cpp wheels, add the prebuilt index for a fast install:
|
|
55
|
+
# python -m pip install eigencore --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
|
56
|
+
# pipx alternative: pipx install eigencore
|
|
57
|
+
# from source (development): git clone ... && python -m pip install -e ".[dev]"
|
|
58
|
+
|
|
59
|
+
eigencore profile
|
|
60
|
+
eigencore models
|
|
61
|
+
eigencore download tinyllama-1.1b
|
|
62
|
+
eigencore run --prompt "Explain binary search in one paragraph"
|
|
63
|
+
eigencore chat # add --plain for scripts or minimal terminals
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Use `eigencore --help` for every command. `llama-cpp-python` may need a backend-specific install; see its documentation before assuming GPU acceleration (EigenCore currently loads models CPU-only).
|
|
67
|
+
|
|
68
|
+
## Status
|
|
69
|
+
|
|
70
|
+
Labels: **SHIPPED** runs on `main` and is tested · **REPORTED-ONLY** computes plans or numbers that never reach llama.cpp · **PLANNED** design docs only.
|
|
71
|
+
|
|
72
|
+
| Area | Status | Notes |
|
|
73
|
+
| --- | --- | --- |
|
|
74
|
+
| Inference through llama-cpp-python | SHIPPED | `engine/inference.py`; CPU-only (`n_gpu_layers=0`) |
|
|
75
|
+
| Hardware profile | SHIPPED | ISA, RAM, bandwidth probe (reads low). GiB/GB mix fixed; 25% of usable RAM reserved for KV so recommended context no longer pins at 2048 under ~38 GB |
|
|
76
|
+
| Model-fit estimator | SHIPPED | Weights (real GGUF file size when downloaded) + reserve + KV from architecture-aware GGUF geometry + margin; GiB end to end. Without geometry the verdict is `UNKNOWN` — no heuristic. CLI passes real GGUF metadata when the model file exists |
|
|
77
|
+
| Benchmark harness | SHIPPED | `eigencore benchmark --report run.json`; tokens counted via backend tokenizer, cold/warm reported separately; no published runs yet |
|
|
78
|
+
| Terminal chat | SHIPPED | Streaming, `--plain`/NO_COLOR/TERM=dumb auto-detection, width-tiered header, slash commands incl. `/approvals`, sanitized output, safe Ctrl-C. First-run onboarding (fit-grouped model picker + SSD-paging warning, runs once via config) SHIPPED. Full-screen takeover deliberately not done (line mode per TUI.md) |
|
|
79
|
+
| Tool policy | SHIPPED, deny-by-default | `ToolExecutor` defaults to `default_policy()` (READ-only, workspace-confined) even when no policy is passed. Path params are declared (`is_path=True`) and resolved to confined absolute paths before handlers. Timeouts run handlers in a spawned process that is killed on timeout. Handlers still run in-process otherwise — not an OS sandbox |
|
|
80
|
+
| Tool policy | SHIPPED, deny-by-default | Same as above, plus POSIX rlimits on the child worker and approval cards (`ApprovalManager` + `/approvals` in chat; y/s/n with redacted args, enforced in the executor). Full OS sandbox (cgroups/namespaces) PLANNED |
|
|
81
|
+
| Reference kernels | SHIPPED (scalar, NumPy) | RMSNorm, Q8_0/Q4_0 (ggml layout, bit-exact vs gguf-py) and Q4_K super-blocks (bit-exact), Q8_0/Q4_K dots. Not used by inference; SIMD/C-intrinsics lib PLANNED (Stage E) |
|
|
82
|
+
| Layer skipping | REPORTED-ONLY | Planner and estimates only |
|
|
83
|
+
| Layer pruning (ShortGPT BI) | REPORTED-ONLY (experiment scaffolding) | `engine/pruning.py`: BI scores, head/tail-protected prune plan, kill criterion on quality delta. Not wired into inference; needs owner calibration + perplexity runs |
|
|
84
|
+
| Activation sparsity | REPORTED-ONLY | Predictor never receives activations; `eigencore analyze` measures output-logit sparsity, not neurons |
|
|
85
|
+
| Activation-sparsity experiment | REPORTED-ONLY (scaffolding) | `engine/sparsity_experiment.py`: mask plan + kill criterion. Dense-model sparsity is a poor near-term bet on bandwidth-bound CPUs (per review); MoE-native routing is the real path |
|
|
86
|
+
| Speculative decoding | REPORTED-ONLY | Module not wired into generation; verifier now implements correct rejection sampling (distribution-preserving, tested) but no speedup is measured or claimed |
|
|
87
|
+
| MoE-aware fit + SSD-paging warning + decode ceiling on active weights | SHIPPED | `qwen3-30b-a3b` registered; `estimate_fit` reports active/resident/ceiling |
|
|
88
|
+
| KV cache type (`--kv fp16|q8_0`) + flash attention (`--no-flash`) on `run`/`chat` | SHIPPED | Engine passes `type_kv`/`flash_attn` to llama.cpp; q8_0 halves KV memory. GPU offload, prompt-lookup decoding PLANNED |
|
|
89
|
+
| GPU/VRAM detection + layer offload (`--gpu-layers`, auto-recommend on GPU machines) | SHIPPED | `nvidia-smi` VRAM probe (safe when absent); `gpu_layers_for_vram` fits layers after reserve+KV; `n_gpu_layers` wired into llama.cpp. Prompt-lookup decoding PLANNED |
|
|
90
|
+
| Prompt-lookup decoding (`--pld`, default OFF) | SHIPPED (flag) | Copies prompt-verbatim spans and swallows covered backend tokens; copied chars counted. Default stays OFF until owner benchmark §9 item 9 |
|
|
91
|
+
| SIMD / native kernels | PLANNED | Research track; decode is bandwidth-bound |
|
|
92
|
+
| Training (LoRA/QLoRA) | Code present, not evaluated | Optional `[train]` extra |
|
|
93
|
+
|
|
94
|
+
## Architecture
|
|
95
|
+
|
|
96
|
+
```mermaid
|
|
97
|
+
flowchart LR
|
|
98
|
+
U[User] --> CLI[Click CLI]
|
|
99
|
+
U --> API[Forge Python API]
|
|
100
|
+
CLI --> HAL[Hardware profile and model registry]
|
|
101
|
+
API --> HAL
|
|
102
|
+
HAL --> ROUTE[Task and model routing]
|
|
103
|
+
ROUTE --> CTX[Context manager]
|
|
104
|
+
CTX --> ENGINE[InferenceEngine]
|
|
105
|
+
ENGINE --> BACKEND[llama-cpp-python backend]
|
|
106
|
+
API --> AGENT[ReAct agent]
|
|
107
|
+
AGENT --> REG[Tool registry]
|
|
108
|
+
REG --> EXEC[ToolExecutor]
|
|
109
|
+
EXEC -. handlers run in process today .-> HOST[Python process]
|
|
110
|
+
TRAIN[Optional training components] --> ADAPTER[LoRA adapter output]
|
|
111
|
+
HAL -. proposed: verified fit estimates .-> UX[Future adaptive TUI]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
This is a module map, not a process-isolation diagram. In particular, the current executor’s validation and timeout are not an OS sandbox or an approval workflow.
|
|
115
|
+
|
|
116
|
+
## Development
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
python -m pip install -e ".[dev]"
|
|
120
|
+
pytest tests/ -v
|
|
121
|
+
ruff check src/ tests/
|
|
122
|
+
ruff format --check src/ tests/
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). Report security issues privately as described in [SECURITY.md](SECURITY.md). This project follows a [code of conduct](CODE_OF_CONDUCT.md).
|
|
126
|
+
|
|
127
|
+
## Documentation
|
|
128
|
+
|
|
129
|
+
- [Review and plan (2026-11)](docs/review/FINAL_REPORT.md): truth audit, 30–40B arithmetic, prioritized plan, benchmarks to run.
|
|
130
|
+
- [Design handbook](docs/design/DESIGN_HANDBOOK.md): v2 identity, palette, terminal UI, approval flow.
|
|
131
|
+
- [Terminal UI status and v2 screens](docs/design/TUI.md).
|
|
132
|
+
- [Brand assets](assets/brand/README.md).
|
|
133
|
+
- [System architecture](docs/architecture/system-overview.md) and [local inference roadmap](docs/architecture/local-inference-roadmap.md).
|
|
134
|
+
- [Terminal chat design](docs/design/terminal-chat.md).
|
|
135
|
+
- [Documentation index](docs/INDEX.md).
|
|
136
|
+
- [Changelog](CHANGELOG.md).
|
|
137
|
+
|
|
138
|
+
## Project status
|
|
139
|
+
|
|
140
|
+
Pre-alpha. APIs and behaviour may change. Feature presence is not a performance claim.
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
[MIT](LICENSE) © 2026 Khubaib Nazeer.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/brand/eigencore-banner-animated.svg" alt="EigenCore — local models, on your own silicon" width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">EigenCore</h1>
|
|
6
|
+
<p align="center">A CPU-first Python runtime for local language models, hardware-aware inference, and agent building blocks.</p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-3776AB?logo=python&logoColor=white">
|
|
10
|
+
<img alt="Version 0.3.0" src="https://img.shields.io/badge/version-0.3.0-56A9F5">
|
|
11
|
+
<img alt="License MIT" src="https://img.shields.io/badge/license-MIT-72B7A8">
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
EigenCore profiles a machine, estimates whether a local model fits, and runs inference through `llama-cpp-python` (llama.cpp). It also ships a benchmark harness, a terminal chat, and agent building blocks with a tool policy layer. The transformer math is llama.cpp's; EigenCore owns the judgement around it.
|
|
15
|
+
|
|
16
|
+
> **Reality check:** a dense 30–40B model at 4-bit is roughly 18–24 GB of weights, more than 8–16 GB of RAM before any KV cache. It can only run by paging from SSD, and decode is then expected to be well under 1 token/s (estimate). Even when a model fits, CPU decode is memory-bandwidth-bound: tok/s ≤ bandwidth ÷ weight bytes. The realistic route to 30B-class models on a 16 GB laptop is a Mixture-of-Experts model, which is planned and not yet measured. See the [review](docs/review/FINAL_REPORT.md) for the arithmetic. No speed figure in this repository is a measurement until a named-hardware run is published.
|
|
17
|
+
|
|
18
|
+
## Quick start
|
|
19
|
+
|
|
20
|
+
Install from PyPI:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
python -m pip install eigencore
|
|
24
|
+
# on Windows/CPU without prebuilt llama.cpp wheels, add the prebuilt index for a fast install:
|
|
25
|
+
# python -m pip install eigencore --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
|
26
|
+
# pipx alternative: pipx install eigencore
|
|
27
|
+
# from source (development): git clone ... && python -m pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
eigencore profile
|
|
30
|
+
eigencore models
|
|
31
|
+
eigencore download tinyllama-1.1b
|
|
32
|
+
eigencore run --prompt "Explain binary search in one paragraph"
|
|
33
|
+
eigencore chat # add --plain for scripts or minimal terminals
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Use `eigencore --help` for every command. `llama-cpp-python` may need a backend-specific install; see its documentation before assuming GPU acceleration (EigenCore currently loads models CPU-only).
|
|
37
|
+
|
|
38
|
+
## Status
|
|
39
|
+
|
|
40
|
+
Labels: **SHIPPED** runs on `main` and is tested · **REPORTED-ONLY** computes plans or numbers that never reach llama.cpp · **PLANNED** design docs only.
|
|
41
|
+
|
|
42
|
+
| Area | Status | Notes |
|
|
43
|
+
| --- | --- | --- |
|
|
44
|
+
| Inference through llama-cpp-python | SHIPPED | `engine/inference.py`; CPU-only (`n_gpu_layers=0`) |
|
|
45
|
+
| Hardware profile | SHIPPED | ISA, RAM, bandwidth probe (reads low). GiB/GB mix fixed; 25% of usable RAM reserved for KV so recommended context no longer pins at 2048 under ~38 GB |
|
|
46
|
+
| Model-fit estimator | SHIPPED | Weights (real GGUF file size when downloaded) + reserve + KV from architecture-aware GGUF geometry + margin; GiB end to end. Without geometry the verdict is `UNKNOWN` — no heuristic. CLI passes real GGUF metadata when the model file exists |
|
|
47
|
+
| Benchmark harness | SHIPPED | `eigencore benchmark --report run.json`; tokens counted via backend tokenizer, cold/warm reported separately; no published runs yet |
|
|
48
|
+
| Terminal chat | SHIPPED | Streaming, `--plain`/NO_COLOR/TERM=dumb auto-detection, width-tiered header, slash commands incl. `/approvals`, sanitized output, safe Ctrl-C. First-run onboarding (fit-grouped model picker + SSD-paging warning, runs once via config) SHIPPED. Full-screen takeover deliberately not done (line mode per TUI.md) |
|
|
49
|
+
| Tool policy | SHIPPED, deny-by-default | `ToolExecutor` defaults to `default_policy()` (READ-only, workspace-confined) even when no policy is passed. Path params are declared (`is_path=True`) and resolved to confined absolute paths before handlers. Timeouts run handlers in a spawned process that is killed on timeout. Handlers still run in-process otherwise — not an OS sandbox |
|
|
50
|
+
| Tool policy | SHIPPED, deny-by-default | Same as above, plus POSIX rlimits on the child worker and approval cards (`ApprovalManager` + `/approvals` in chat; y/s/n with redacted args, enforced in the executor). Full OS sandbox (cgroups/namespaces) PLANNED |
|
|
51
|
+
| Reference kernels | SHIPPED (scalar, NumPy) | RMSNorm, Q8_0/Q4_0 (ggml layout, bit-exact vs gguf-py) and Q4_K super-blocks (bit-exact), Q8_0/Q4_K dots. Not used by inference; SIMD/C-intrinsics lib PLANNED (Stage E) |
|
|
52
|
+
| Layer skipping | REPORTED-ONLY | Planner and estimates only |
|
|
53
|
+
| Layer pruning (ShortGPT BI) | REPORTED-ONLY (experiment scaffolding) | `engine/pruning.py`: BI scores, head/tail-protected prune plan, kill criterion on quality delta. Not wired into inference; needs owner calibration + perplexity runs |
|
|
54
|
+
| Activation sparsity | REPORTED-ONLY | Predictor never receives activations; `eigencore analyze` measures output-logit sparsity, not neurons |
|
|
55
|
+
| Activation-sparsity experiment | REPORTED-ONLY (scaffolding) | `engine/sparsity_experiment.py`: mask plan + kill criterion. Dense-model sparsity is a poor near-term bet on bandwidth-bound CPUs (per review); MoE-native routing is the real path |
|
|
56
|
+
| Speculative decoding | REPORTED-ONLY | Module not wired into generation; verifier now implements correct rejection sampling (distribution-preserving, tested) but no speedup is measured or claimed |
|
|
57
|
+
| MoE-aware fit + SSD-paging warning + decode ceiling on active weights | SHIPPED | `qwen3-30b-a3b` registered; `estimate_fit` reports active/resident/ceiling |
|
|
58
|
+
| KV cache type (`--kv fp16|q8_0`) + flash attention (`--no-flash`) on `run`/`chat` | SHIPPED | Engine passes `type_kv`/`flash_attn` to llama.cpp; q8_0 halves KV memory. GPU offload, prompt-lookup decoding PLANNED |
|
|
59
|
+
| GPU/VRAM detection + layer offload (`--gpu-layers`, auto-recommend on GPU machines) | SHIPPED | `nvidia-smi` VRAM probe (safe when absent); `gpu_layers_for_vram` fits layers after reserve+KV; `n_gpu_layers` wired into llama.cpp. Prompt-lookup decoding PLANNED |
|
|
60
|
+
| Prompt-lookup decoding (`--pld`, default OFF) | SHIPPED (flag) | Copies prompt-verbatim spans and swallows covered backend tokens; copied chars counted. Default stays OFF until owner benchmark §9 item 9 |
|
|
61
|
+
| SIMD / native kernels | PLANNED | Research track; decode is bandwidth-bound |
|
|
62
|
+
| Training (LoRA/QLoRA) | Code present, not evaluated | Optional `[train]` extra |
|
|
63
|
+
|
|
64
|
+
## Architecture
|
|
65
|
+
|
|
66
|
+
```mermaid
|
|
67
|
+
flowchart LR
|
|
68
|
+
U[User] --> CLI[Click CLI]
|
|
69
|
+
U --> API[Forge Python API]
|
|
70
|
+
CLI --> HAL[Hardware profile and model registry]
|
|
71
|
+
API --> HAL
|
|
72
|
+
HAL --> ROUTE[Task and model routing]
|
|
73
|
+
ROUTE --> CTX[Context manager]
|
|
74
|
+
CTX --> ENGINE[InferenceEngine]
|
|
75
|
+
ENGINE --> BACKEND[llama-cpp-python backend]
|
|
76
|
+
API --> AGENT[ReAct agent]
|
|
77
|
+
AGENT --> REG[Tool registry]
|
|
78
|
+
REG --> EXEC[ToolExecutor]
|
|
79
|
+
EXEC -. handlers run in process today .-> HOST[Python process]
|
|
80
|
+
TRAIN[Optional training components] --> ADAPTER[LoRA adapter output]
|
|
81
|
+
HAL -. proposed: verified fit estimates .-> UX[Future adaptive TUI]
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
This is a module map, not a process-isolation diagram. In particular, the current executor’s validation and timeout are not an OS sandbox or an approval workflow.
|
|
85
|
+
|
|
86
|
+
## Development
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
python -m pip install -e ".[dev]"
|
|
90
|
+
pytest tests/ -v
|
|
91
|
+
ruff check src/ tests/
|
|
92
|
+
ruff format --check src/ tests/
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). Report security issues privately as described in [SECURITY.md](SECURITY.md). This project follows a [code of conduct](CODE_OF_CONDUCT.md).
|
|
96
|
+
|
|
97
|
+
## Documentation
|
|
98
|
+
|
|
99
|
+
- [Review and plan (2026-11)](docs/review/FINAL_REPORT.md): truth audit, 30–40B arithmetic, prioritized plan, benchmarks to run.
|
|
100
|
+
- [Design handbook](docs/design/DESIGN_HANDBOOK.md): v2 identity, palette, terminal UI, approval flow.
|
|
101
|
+
- [Terminal UI status and v2 screens](docs/design/TUI.md).
|
|
102
|
+
- [Brand assets](assets/brand/README.md).
|
|
103
|
+
- [System architecture](docs/architecture/system-overview.md) and [local inference roadmap](docs/architecture/local-inference-roadmap.md).
|
|
104
|
+
- [Terminal chat design](docs/design/terminal-chat.md).
|
|
105
|
+
- [Documentation index](docs/INDEX.md).
|
|
106
|
+
- [Changelog](CHANGELOG.md).
|
|
107
|
+
|
|
108
|
+
## Project status
|
|
109
|
+
|
|
110
|
+
Pre-alpha. APIs and behaviour may change. Feature presence is not a performance claim.
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
[MIT](LICENSE) © 2026 Khubaib Nazeer.
|