programasweights 0.3.1__tar.gz → 0.3.2__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.
- {programasweights-0.3.1 → programasweights-0.3.2}/AGENTS.md +1 -1
- {programasweights-0.3.1 → programasweights-0.3.2}/PKG-INFO +2 -2
- {programasweights-0.3.1 → programasweights-0.3.2}/PYPI_README.md +1 -1
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/adr/001-llama-cpp-over-pytorch.md +1 -1
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/advanced/adrs.md +5 -4
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/guide/browser-inference.md +1 -1
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/index.md +1 -1
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/__init__.py +2 -1
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/cache.py +3 -2
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/client.py +4 -1
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/runtime_llamacpp.py +3 -4
- {programasweights-0.3.1 → programasweights-0.3.2}/pyproject.toml +1 -1
- {programasweights-0.3.1 → programasweights-0.3.2}/.gitignore +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/.readthedocs.yaml +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/CHANGELOG.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/LICENSE +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/README.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/adr/002-q4_0-adapter-format.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/adr/003-single-spec-field.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/adr/004-compiler-naming.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/adr/005-vllm-hidden-states.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/adr/006-email-api-key-auth.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/advanced/architecture.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/api-reference/cli.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/api-reference/python-sdk.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/api-reference/rest-api.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/architecture.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/case-studies/log-monitoring.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/case-studies/semantic-search.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/case-studies/site-navigation.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/case-studies/tool-calling.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/getting-started/first-program.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/getting-started/installation.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/getting-started/naming-programs.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/guide/how-it-works.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/guide/local-inference.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/guide/writing-good-specs.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/hub/browsing-programs.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/hub/feedback-cases.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/hub/publishing-programs.md +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/docs/requirements.txt +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/examples/flask_app.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/examples/jupyter_notebook.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/examples/langchain_integration.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/examples/paw_monitor.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/examples/replace_openai.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/mkdocs.yml +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/_output.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/artifacts.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/cli.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/compiler/__init__.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/compiler/dummy.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/config.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/convert_peft_to_paw.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/paw_format.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/runtime/__init__.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/runtime/interpreter.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/programasweights/runtime/interpreter_onnx.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/tests/test_offline_cache.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/tests/test_sdk.py +0 -0
- {programasweights-0.3.1 → programasweights-0.3.2}/tests/test_sdk.sh +0 -0
|
@@ -38,7 +38,7 @@ fn("I love this!") # "positive"
|
|
|
38
38
|
## Two Compilers
|
|
39
39
|
|
|
40
40
|
- **Standard** (`paw-4b-qwen3-0.6b`) — higher accuracy, 594 MB base + ~22 MB/program. Default.
|
|
41
|
-
- **Compact** (`paw-4b-gpt2`) — smaller (
|
|
41
|
+
- **Compact** (`paw-4b-gpt2`) — smaller (134 MB base + ~5 MB/program), runs in browser via WebAssembly.
|
|
42
42
|
|
|
43
43
|
## When to Use PAW
|
|
44
44
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: programasweights
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Compile natural language specifications into neural programs that run locally via llama.cpp.
|
|
5
5
|
Project-URL: Homepage, https://programasweights.com
|
|
6
6
|
Project-URL: Repository, https://github.com/programasweights/programasweights-python
|
|
@@ -71,7 +71,7 @@ fn("I love this!") # "positive"
|
|
|
71
71
|
| --------------- | --------------------- | -------------------- |
|
|
72
72
|
| Compiler name | `paw-4b-qwen3-0.6b` | `paw-4b-gpt2` |
|
|
73
73
|
| Accuracy | Higher | Lower |
|
|
74
|
-
| Base model size | 594 MB |
|
|
74
|
+
| Base model size | 594 MB | 134 MB |
|
|
75
75
|
| Program size | ~22 MB | ~5 MB |
|
|
76
76
|
| Local inference | ~0.05-0.5s per call | ~0.03-0.3s per call |
|
|
77
77
|
| Runs in browser | No | Yes (WebAssembly) |
|
|
@@ -41,7 +41,7 @@ fn("I love this!") # "positive"
|
|
|
41
41
|
| --------------- | --------------------- | -------------------- |
|
|
42
42
|
| Compiler name | `paw-4b-qwen3-0.6b` | `paw-4b-gpt2` |
|
|
43
43
|
| Accuracy | Higher | Lower |
|
|
44
|
-
| Base model size | 594 MB |
|
|
44
|
+
| Base model size | 594 MB | 134 MB |
|
|
45
45
|
| Program size | ~22 MB | ~5 MB |
|
|
46
46
|
| Local inference | ~0.05-0.5s per call | ~0.03-0.3s per call |
|
|
47
47
|
| Runs in browser | No | Yes (WebAssembly) |
|
|
@@ -17,5 +17,5 @@ Replace the PyTorch runtime with llama-cpp-python (~80MB install). Use GGUF mode
|
|
|
17
17
|
- Inference uses Metal (Mac), CPU (Linux/Windows) — no GPU required
|
|
18
18
|
- Must pre-render chat templates server-side (no transformers tokenizer on client)
|
|
19
19
|
- .paw format must change from v2 (safetensors) to v3 (GGUF adapter)
|
|
20
|
-
- Base model is downloaded once (~594 MB for
|
|
20
|
+
- Base model is downloaded once (~594 MB Q6_K for Qwen3, ~134 MB Q8_0 for GPT-2) and shared across all functions
|
|
21
21
|
- Per-function adapter download is ~23MB (Q4_0, confirmed lossless at 4096-scale eval)
|
|
@@ -14,16 +14,17 @@ Concise records of major technical choices. Full ADR files may live elsewhere in
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
## ADR 002:
|
|
17
|
+
## ADR 002: Quantization levels for base models and adapters
|
|
18
18
|
|
|
19
|
-
**Decision:** Use **Q4_0** for adapters
|
|
19
|
+
**Decision:** Use **Q4_0** for adapters. For base models, use **Q6_K** for Qwen3 0.6B and **Q8_0** for GPT-2.
|
|
20
20
|
|
|
21
21
|
**Context:** Empirical evaluation on **4096** held-out examples across quantization settings informed the trade-off.
|
|
22
22
|
|
|
23
23
|
**Consequence:**
|
|
24
24
|
|
|
25
|
-
- **Q6_K base** — quality is preserved while the footprint is roughly **60% smaller** than fp16.
|
|
26
|
-
- **
|
|
25
|
+
- **Q6_K base (Qwen3 0.6B)** — quality is preserved while the footprint is roughly **60% smaller** than fp16. 4096-sample eval shows no accuracy loss vs fp16.
|
|
26
|
+
- **Q8_0 base (GPT-2)** — Q6_K caused ~3.5% accuracy loss on GPT-2 (4096-sample eval). Q8_0 closes the gap at only ~29 MB additional cost (134 MB vs 105 MB).
|
|
27
|
+
- **Q4_0 adapter** — quality loss is negligible for both models; adapter size drops to about **23 MB** (Qwen3) / **5 MB** (GPT-2) versus **78 MB** / **19 MB** at fp16.
|
|
27
28
|
|
|
28
29
|
---
|
|
29
30
|
|
|
@@ -84,7 +84,7 @@ paw.configure({
|
|
|
84
84
|
|
|
85
85
|
| Component | Size | When |
|
|
86
86
|
|-----------|------|------|
|
|
87
|
-
| Base model (GPT-2
|
|
87
|
+
| Base model (GPT-2 Q8_0) | 134 MB | First program load (cached) |
|
|
88
88
|
| LoRA adapter | ~5 MB | Per program |
|
|
89
89
|
| Prefix cache | ~7 MB | Per program |
|
|
90
90
|
| **First load total** | **~117 MB** | |
|
|
@@ -56,7 +56,7 @@ Each compiled program has two parts:
|
|
|
56
56
|
1. **Discrete pseudo-program** -- text instructions generated by the neural compiler
|
|
57
57
|
2. **Continuous neural adapter** -- LoRA weights (~23 MB) that tune the interpreter model
|
|
58
58
|
|
|
59
|
-
At runtime, the SDK loads a
|
|
59
|
+
At runtime, the SDK loads a quantized base model (Q6_K ~594 MB for Qwen3, Q8_0 ~134 MB for GPT-2, downloaded once) and applies the LoRA adapter. Inference runs entirely locally via llama.cpp.
|
|
60
60
|
|
|
61
61
|
## Browser Inference
|
|
62
62
|
|
|
@@ -39,6 +39,7 @@ def compile(
|
|
|
39
39
|
tags: list[str] | None = None,
|
|
40
40
|
public: bool = True,
|
|
41
41
|
slug: str | None = None,
|
|
42
|
+
ephemeral: bool = False,
|
|
42
43
|
):
|
|
43
44
|
"""Compile a natural language specification into a neural program.
|
|
44
45
|
|
|
@@ -71,7 +72,7 @@ def compile(
|
|
|
71
72
|
from ._output import status
|
|
72
73
|
status("Compiling...")
|
|
73
74
|
client = PAWClient(api_url=get_api_url(), api_key=get_api_key())
|
|
74
|
-
result = client.compile(spec, compiler=compiler, name=name, tags=tags, public=public, slug=slug)
|
|
75
|
+
result = client.compile(spec, compiler=compiler, name=name, tags=tags, public=public, slug=slug, ephemeral=ephemeral)
|
|
75
76
|
label = f"{result.id}"
|
|
76
77
|
if result.slug:
|
|
77
78
|
ver_str = f" v{result.version}" if result.version and result.version > 1 else ""
|
|
@@ -5,6 +5,7 @@ Cache structure:
|
|
|
5
5
|
~/.cache/programasweights/
|
|
6
6
|
base_models/
|
|
7
7
|
qwen3-0.6b-q6_k.gguf # ~594 MB, downloaded once
|
|
8
|
+
gpt2-q8_0.gguf # ~134 MB, downloaded once
|
|
8
9
|
programs/
|
|
9
10
|
<program_id>/
|
|
10
11
|
adapter.gguf # ~23 MB, Q4_0 LoRA
|
|
@@ -25,12 +26,12 @@ from . import config
|
|
|
25
26
|
|
|
26
27
|
BASE_MODEL_URLS = {
|
|
27
28
|
"qwen3-0.6b-q6_k": "https://huggingface.co/programasweights/Qwen3-0.6B-GGUF-Q6_K/resolve/main/qwen3-0.6b-q6_k.gguf",
|
|
28
|
-
"gpt2-
|
|
29
|
+
"gpt2-q8_0": "https://huggingface.co/programasweights/GPT2-GGUF-Q8_0/resolve/main/gpt2-q8_0.gguf",
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
INTERPRETER_TO_GGUF = {
|
|
32
33
|
"Qwen/Qwen3-0.6B": "qwen3-0.6b-q6_k",
|
|
33
|
-
"gpt2": "gpt2-
|
|
34
|
+
"gpt2": "gpt2-q8_0",
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
|
|
@@ -52,6 +52,7 @@ class PAWClient:
|
|
|
52
52
|
tags: list[str] | None = None,
|
|
53
53
|
public: bool = True,
|
|
54
54
|
slug: str | None = None,
|
|
55
|
+
ephemeral: bool = False,
|
|
55
56
|
) -> Program:
|
|
56
57
|
"""Compile a spec into a neural program on the server.
|
|
57
58
|
|
|
@@ -71,6 +72,8 @@ class PAWClient:
|
|
|
71
72
|
httpx.HTTPStatusError: On API errors (422 for validation, 429 for rate limit).
|
|
72
73
|
"""
|
|
73
74
|
body: dict = {"spec": spec, "compiler": compiler, "public": public}
|
|
75
|
+
if ephemeral:
|
|
76
|
+
body["ephemeral"] = True
|
|
74
77
|
if name:
|
|
75
78
|
body["name"] = name
|
|
76
79
|
if tags:
|
|
@@ -121,7 +124,7 @@ class PAWClient:
|
|
|
121
124
|
from ._output import status
|
|
122
125
|
|
|
123
126
|
status(f"Downloading program {program_id[:12]}...")
|
|
124
|
-
max_wait =
|
|
127
|
+
max_wait = 60
|
|
125
128
|
elapsed = 0
|
|
126
129
|
resp = None
|
|
127
130
|
waiting_logged = False
|
|
@@ -88,7 +88,6 @@ class PawFunction:
|
|
|
88
88
|
_os.close(_old_stderr)
|
|
89
89
|
|
|
90
90
|
placeholder = "{INPUT_PLACEHOLDER}"
|
|
91
|
-
self._use_special = interpreter not in ("gpt2",)
|
|
92
91
|
|
|
93
92
|
if placeholder in self._template:
|
|
94
93
|
prefix_text = self._template.split(placeholder)[0]
|
|
@@ -99,8 +98,8 @@ class PawFunction:
|
|
|
99
98
|
|
|
100
99
|
self._prefix_tokens = self._llm.tokenize(
|
|
101
100
|
prefix_text.encode("utf-8"),
|
|
102
|
-
add_bos=
|
|
103
|
-
special=
|
|
101
|
+
add_bos=False,
|
|
102
|
+
special=True,
|
|
104
103
|
)
|
|
105
104
|
self._suffix_text = suffix_text
|
|
106
105
|
self._n_prefix = len(self._prefix_tokens)
|
|
@@ -183,7 +182,7 @@ class PawFunction:
|
|
|
183
182
|
input_tokens = self._llm.tokenize(
|
|
184
183
|
input_with_suffix.encode("utf-8"),
|
|
185
184
|
add_bos=False,
|
|
186
|
-
special=
|
|
185
|
+
special=True,
|
|
187
186
|
)
|
|
188
187
|
|
|
189
188
|
tokens_used = self._n_prefix + len(input_tokens)
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "programasweights"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.2"
|
|
8
8
|
description = "Compile natural language specifications into neural programs that run locally via llama.cpp."
|
|
9
9
|
readme = "PYPI_README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{programasweights-0.3.1 → programasweights-0.3.2}/programasweights/runtime/interpreter_onnx.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|