apophatic-engine 0.1.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.
@@ -0,0 +1,24 @@
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <https://unlicense.org>
@@ -0,0 +1,36 @@
1
+ Metadata-Version: 2.4
2
+ Name: apophatic_engine
3
+ Version: 0.1.0
4
+ Summary: Apophatic noise-subtraction filter (¬X) for LLMs.
5
+ Author: xerx593
6
+ Project-URL: Homepage, https://github.com/xerx593/apophatic-engine
7
+ Project-URL: Theory Framework, https://github.com/xerx593/nicht-theory
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: The Unlicense (Unlicense)
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: numpy>=1.20.0
15
+ Dynamic: license-file
16
+
17
+ # Apophatic Engine (`apophatic-engine`)
18
+
19
+ > *Apophatic Noise Subtraction ($\neg X$) for Neural Inference and System Optimization.*
20
+
21
+ The **Apophatic Engine** implements token-by-token noise subtraction ($\neg X$) derived from the **Nicht-Theory** theoretical framework. Instead of maximizing speculative probabilities ($1$-logic), the filter penalizes assertion pressure ($P_A$) and relaxes high-entropy tokens directly into the **Sufficient Invariant Baseline ($B_0$)**.
22
+
23
+ ## Theoretical Grounding
24
+ This repository provides the operational code implementation for Paper IV (*Apophatic Inference Engine*) of the [Nicht-Theory Framework](https://github.com/xerx593/nicht-theory).
25
+
26
+ ## Quickstart
27
+ ```python
28
+ from apophatic_filter import ApophaticEngine
29
+ import numpy as np
30
+
31
+ engine = ApophaticEngine(sigma_threshold=0.40)
32
+ logits = np.array([1.2, 1.1, 1.3, 1.0]) # High-noise logits
33
+
34
+ result = engine.apply_apophatic_filter(logits, step=1)
35
+ print(result)
36
+ # Output: {'status': 'RELAX_TO_BASELINE', 'output_token': '[B_0: SILENCE / UNASSERTED]'}
@@ -0,0 +1,20 @@
1
+ # Apophatic Engine (`apophatic-engine`)
2
+
3
+ > *Apophatic Noise Subtraction ($\neg X$) for Neural Inference and System Optimization.*
4
+
5
+ The **Apophatic Engine** implements token-by-token noise subtraction ($\neg X$) derived from the **Nicht-Theory** theoretical framework. Instead of maximizing speculative probabilities ($1$-logic), the filter penalizes assertion pressure ($P_A$) and relaxes high-entropy tokens directly into the **Sufficient Invariant Baseline ($B_0$)**.
6
+
7
+ ## Theoretical Grounding
8
+ This repository provides the operational code implementation for Paper IV (*Apophatic Inference Engine*) of the [Nicht-Theory Framework](https://github.com/xerx593/nicht-theory).
9
+
10
+ ## Quickstart
11
+ ```python
12
+ from apophatic_filter import ApophaticEngine
13
+ import numpy as np
14
+
15
+ engine = ApophaticEngine(sigma_threshold=0.40)
16
+ logits = np.array([1.2, 1.1, 1.3, 1.0]) # High-noise logits
17
+
18
+ result = engine.apply_apophatic_filter(logits, step=1)
19
+ print(result)
20
+ # Output: {'status': 'RELAX_TO_BASELINE', 'output_token': '[B_0: SILENCE / UNASSERTED]'}
@@ -0,0 +1,3 @@
1
+ from .filter import ApophaticEngine
2
+
3
+ __all__ = ["ApophaticEngine"]
@@ -0,0 +1,59 @@
1
+ import numpy as np
2
+
3
+
4
+ class ApophaticEngine:
5
+ """Apophatic Inference Engine (AIE)
6
+
7
+ Applies apophatic negation (¬X) to strip speculative token noise
8
+ and force low-confidence assertions to decay into the 0-Baseline (B_0).
9
+ """
10
+
11
+ def __init__(self, sigma_threshold: float = 0.45, gamma_decay: float = 0.1):
12
+ """Parameters
13
+
14
+ ----------
15
+ sigma_threshold : float
16
+ Epistemic noise boundary. Distributions with noise above this threshold
17
+ are suppressed into baseline silence.
18
+ gamma_decay : float
19
+ Decay rate for assertion pressure over generation steps.
20
+ """
21
+ self.sigma_threshold = sigma_threshold
22
+ self.gamma_decay = gamma_decay
23
+
24
+ def compute_assertion_penalty(
25
+ self, logits: np.ndarray, step: int
26
+ ) -> np.ndarray:
27
+ """Calculates Assertion Pressure P_A(t) for candidate tokens."""
28
+ probs = np.exp(logits) / np.sum(np.exp(logits))
29
+ assertion_pressure = (1.0 - probs) * np.exp(-self.gamma_decay * step)
30
+ return assertion_pressure
31
+
32
+ def apply_apophatic_filter(self, logits: np.ndarray, step: int = 1) -> dict:
33
+ """Applies the ¬X operator to filter logits.
34
+
35
+ If epistemic noise exceeds threshold, returns RELAX_TO_BASELINE.
36
+ Otherwise, returns the non-assertive invariant token ID.
37
+ """
38
+ probs = np.exp(logits) / np.sum(np.exp(logits))
39
+ max_confidence = np.max(probs)
40
+ sigma = 1.0 - max_confidence
41
+
42
+ if sigma > self.sigma_threshold:
43
+ return {
44
+ "status": "RELAX_TO_BASELINE",
45
+ "output_token": "[B_0: SILENCE / UNASSERTED]",
46
+ "sigma": float(sigma),
47
+ "action": "¬X applied (Assertion Pressure P_A -> 0)",
48
+ }
49
+
50
+ P_A = self.compute_assertion_penalty(logits, step)
51
+ filtered_logits = logits - P_A
52
+ best_token_id = np.argmax(filtered_logits)
53
+
54
+ return {
55
+ "status": "INVARIANT_OUTPUT",
56
+ "token_id": int(best_token_id),
57
+ "sigma": float(sigma),
58
+ "action": "Token cleared through baseline check",
59
+ }
@@ -0,0 +1,36 @@
1
+ Metadata-Version: 2.4
2
+ Name: apophatic_engine
3
+ Version: 0.1.0
4
+ Summary: Apophatic noise-subtraction filter (¬X) for LLMs.
5
+ Author: xerx593
6
+ Project-URL: Homepage, https://github.com/xerx593/apophatic-engine
7
+ Project-URL: Theory Framework, https://github.com/xerx593/nicht-theory
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: The Unlicense (Unlicense)
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: numpy>=1.20.0
15
+ Dynamic: license-file
16
+
17
+ # Apophatic Engine (`apophatic-engine`)
18
+
19
+ > *Apophatic Noise Subtraction ($\neg X$) for Neural Inference and System Optimization.*
20
+
21
+ The **Apophatic Engine** implements token-by-token noise subtraction ($\neg X$) derived from the **Nicht-Theory** theoretical framework. Instead of maximizing speculative probabilities ($1$-logic), the filter penalizes assertion pressure ($P_A$) and relaxes high-entropy tokens directly into the **Sufficient Invariant Baseline ($B_0$)**.
22
+
23
+ ## Theoretical Grounding
24
+ This repository provides the operational code implementation for Paper IV (*Apophatic Inference Engine*) of the [Nicht-Theory Framework](https://github.com/xerx593/nicht-theory).
25
+
26
+ ## Quickstart
27
+ ```python
28
+ from apophatic_filter import ApophaticEngine
29
+ import numpy as np
30
+
31
+ engine = ApophaticEngine(sigma_threshold=0.40)
32
+ logits = np.array([1.2, 1.1, 1.3, 1.0]) # High-noise logits
33
+
34
+ result = engine.apply_apophatic_filter(logits, step=1)
35
+ print(result)
36
+ # Output: {'status': 'RELAX_TO_BASELINE', 'output_token': '[B_0: SILENCE / UNASSERTED]'}
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ apophatic_engine/__init__.py
5
+ apophatic_engine/filter.py
6
+ apophatic_engine.egg-info/PKG-INFO
7
+ apophatic_engine.egg-info/SOURCES.txt
8
+ apophatic_engine.egg-info/dependency_links.txt
9
+ apophatic_engine.egg-info/requires.txt
10
+ apophatic_engine.egg-info/top_level.txt
11
+ tests/test_engine.py
@@ -0,0 +1 @@
1
+ numpy>=1.20.0
@@ -0,0 +1 @@
1
+ apophatic_engine
@@ -0,0 +1,26 @@
1
+ #### **B. `pyproject.toml` (For future PyPI publishing)**
2
+ [build-system]
3
+ requires = ["setuptools>=61.0"]
4
+ build-backend = "setuptools.build_meta"
5
+
6
+ [project]
7
+ name = "apophatic_engine"
8
+ version = "0.1.0"
9
+ authors = [
10
+ { name="xerx593" },
11
+ ]
12
+ description = "Apophatic noise-subtraction filter (¬X) for LLMs."
13
+ readme = "README.md"
14
+ requires-python = ">=3.8"
15
+ dependencies = [
16
+ "numpy>=1.20.0",
17
+ ]
18
+ classifiers = [
19
+ "Programming Language :: Python :: 3",
20
+ "License :: OSI Approved :: The Unlicense (Unlicense)",
21
+ "Operating System :: OS Independent",
22
+ ]
23
+
24
+ [project.urls]
25
+ "Homepage" = "https://github.com/xerx593/apophatic-engine"
26
+ "Theory Framework" = "https://github.com/xerx593/nicht-theory"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,40 @@
1
+ import sys
2
+ from pathlib import Path
3
+
4
+ REPO_ROOT = Path(__file__).resolve().parent.parent
5
+ sys.path.insert(0, str(REPO_ROOT))
6
+
7
+ import numpy as np
8
+ from apophatic_engine import ApophaticEngine
9
+
10
+
11
+ def test_clear_signal():
12
+ engine = ApophaticEngine(sigma_threshold=0.40)
13
+ logits = np.array([0.1, 0.2, 5.0, 0.05])
14
+ res = engine.apply_apophatic_filter(logits, step=1)
15
+ assert res["status"] == "INVARIANT_OUTPUT"
16
+ assert res["token_id"] == 2
17
+
18
+
19
+ def test_speculative_noise_relaxation():
20
+ engine = ApophaticEngine(sigma_threshold=0.40)
21
+ logits = np.array([1.1, 1.05, 1.12, 0.98])
22
+ res = engine.apply_apophatic_filter(logits, step=1)
23
+ assert res["status"] == "RELAX_TO_BASELINE"
24
+ assert res["output_token"] == "[B_0: SILENCE / UNASSERTED]"
25
+
26
+
27
+ def test_step_decay_dynamics():
28
+ engine = ApophaticEngine(gamma_decay=0.2)
29
+ logits = np.array([2.0, 1.5, 0.5])
30
+ p1 = engine.compute_assertion_penalty(logits, step=1)
31
+ p2 = engine.compute_assertion_penalty(logits, step=2)
32
+ # Assertion pressure P_A decays over time steps
33
+ assert np.all(p2 < p1)
34
+
35
+
36
+ if __name__ == "__main__":
37
+ test_clear_signal()
38
+ test_speculative_noise_relaxation()
39
+ test_step_decay_dynamics()
40
+ print("All extended unit tests passed successfully.")