Text Generation
Transformers
entropy
hallucination
logits-processor
lean4
formal-verification
cuda-q
temperature-scheduling
audit-log
harness
guardrails
snapkitty
agda
python
cuda
Instructions to use Snapkitty/sovereign-entropy-theorem with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Snapkitty/sovereign-entropy-theorem with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Snapkitty/sovereign-entropy-theorem")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Snapkitty/sovereign-entropy-theorem", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Snapkitty/sovereign-entropy-theorem with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Snapkitty/sovereign-entropy-theorem" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Snapkitty/sovereign-entropy-theorem", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Snapkitty/sovereign-entropy-theorem
- SGLang
How to use Snapkitty/sovereign-entropy-theorem 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 "Snapkitty/sovereign-entropy-theorem" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Snapkitty/sovereign-entropy-theorem", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Snapkitty/sovereign-entropy-theorem" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Snapkitty/sovereign-entropy-theorem", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Snapkitty/sovereign-entropy-theorem with Docker Model Runner:
docker model run hf.co/Snapkitty/sovereign-entropy-theorem
Download python/verify_entropy.py from Snapkitty/sovereign-entropy-theorem: direct link, hf CLI and curl.
- Browser
- Download file 5.72 kB
-
https://huggingface.co/Snapkitty/sovereign-entropy-theorem/resolve/main/python/verify_entropy.py
- Command line
-
hf download hf://Snapkitty/sovereign-entropy-theorem/python/verify_entropy.py
-
curl -L -o verify_entropy.py https://huggingface.co/Snapkitty/sovereign-entropy-theorem/resolve/main/python/verify_entropy.py
5.72 kB
| #!/usr/bin/env python3 | |
| """ | |
| Sovereign Entropy Theorem β Numerical Verification | |
| Verifies the entropy bound H < 0.20 nats for: | |
| - Any discrete energy function F >= 0 | |
| - Temperature schedule T(F) = T0 + (1-T0)*exp(-alpha*F) | |
| - K ground states | |
| - Minimum logit difference d >= 1 | |
| Author: Ahmad Ali Parr | |
| Trust: Bel Esprit D'Accord Irrevocable Trust EIN 42-697643 | |
| """ | |
| import math | |
| # βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # CORE MATHEMATICAL FUNCTIONS | |
| # βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| def temperature(F, T0=0.1, alpha=2.0): | |
| """T(F) = T0 + (1-T0)*exp(-alpha*F)""" | |
| return T0 + (1 - T0) * math.exp(-alpha * F) | |
| def softmax_ratio(d, T): | |
| """s = exp(d/T) for logit difference d""" | |
| return math.exp(d / T) | |
| def binary_entropy(s): | |
| """H(s) = log(s+1) - s*log(s)/(s+1) for binary expert selection""" | |
| if s <= 0: | |
| return float('inf') | |
| return math.log(s + 1) - s * math.log(s) / (s + 1) | |
| def general_entropy(K, d, T): | |
| """General K-ary entropy for softmax with minimum logit difference d.""" | |
| s = math.exp(d / T) | |
| Z = 1 + (K - 1) + s | |
| return math.log(Z) - s * (d / T) / Z | |
| # βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # THEOREM VERIFICATION | |
| # βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| def verify_entropy_bound(T0=0.1, alpha=2.0, d=1.0, K=2, F_min=1, F_max=1000, H_max=0.20): | |
| """ | |
| Verify H(F) < H_max for all F >= F_min. | |
| Returns (max_H, max_F, bound_satisfied, margin). | |
| """ | |
| max_H = 0.0 | |
| max_F = F_min | |
| for F in range(F_min, F_max + 1): | |
| T = temperature(F, T0, alpha) | |
| H = general_entropy(K, d, T) | |
| if H > max_H: | |
| max_H = H | |
| max_F = F | |
| # Asymptotic limit F -> inf | |
| T_inf = T0 | |
| H_inf = general_entropy(K, d, T_inf) | |
| if H_inf > max_H: | |
| max_H = H_inf | |
| max_F = float('inf') | |
| return max_H, max_F, max_H < H_max, H_max - max_H | |
| def verify_temperature_bound(F_min=1, T0=0.1, alpha=2.0, T_bound=0.2218): | |
| """Verify T(F) <= T_bound for all F >= F_min.""" | |
| for F in range(F_min, 10000): | |
| T = temperature(F, T0, alpha) | |
| if T > T_bound: | |
| return False, T, F | |
| T_inf = temperature(10**6, T0, alpha) | |
| return T_inf <= T_bound, T_inf, float('inf') | |
| def verify_softmax_bound(T_upper=0.2218, d_lower=1.0, s_lower=90.75): | |
| """Verify exp(d/T) >= s_lower when T <= T_upper and d >= d_lower.""" | |
| T = T_upper | |
| d = d_lower | |
| s = softmax_ratio(d, T) | |
| return s >= s_lower, s | |
| # βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # MAIN | |
| # βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| if __name__ == '__main__': | |
| print("=" * 72) | |
| print("SOVEREIGN ENTROPY THEOREM β NUMERICAL VERIFICATION") | |
| print("=" * 72) | |
| print() | |
| # Parameters | |
| T0, alpha, d, K = 0.1, 2.0, 1.0, 2 | |
| # Lemma 1: Temperature bound | |
| ok, T_inf, F_inf = verify_temperature_bound() | |
| print(f"Lemma 1: T(F) <= 0.2218 for F >= 1") | |
| print(f" T(inf) = {T_inf:.6f} <= 0.2218: {ok}") | |
| print() | |
| # Lemma 2: Softmax bound | |
| ok, s_val = verify_softmax_bound() | |
| print(f"Lemma 2: exp(d/T) >= 90.75 when T <= 0.2218, d >= 1") | |
| print(f" exp(1/0.2218) = {s_val:.4f} >= 90.75: {ok}") | |
| print() | |
| # Lemma 3: Binary entropy at 19 | |
| H19 = binary_entropy(19.0) | |
| print(f"Lemma 3: H(19.0) < 0.20") | |
| print(f" H(19.0) = {H19:.6f} < 0.20: {H19 < 0.20}") | |
| print() | |
| # Main theorem | |
| max_H, max_F, ok, margin = verify_entropy_bound() | |
| print(f"Main Theorem: H(F) < 0.20 for all F >= 1") | |
| print(f" Max H = {max_H:.6f} at F = {max_F}") | |
| print(f" Bound satisfied: {ok} (margin: {margin:.6f})") | |
| print() | |
| # General K-ary | |
| print("General K-ary entropy bounds:") | |
| for K in [2, 3, 5, 10, 20]: | |
| mH, mF, ok, mg = verify_entropy_bound(K=K, H_max=0.20 if K == 2 else 1.0) | |
| print(f" K={K:2d}: max H = {mH:.6f} at F = {mF}") | |
| print() | |
| # Theta = 89/2462 | |
| theta = 89 / 2462 | |
| print(f"Theta = 89/2462 = {theta:.6f}") | |
| print(f" T0 = theta: T(1) = {temperature(1, theta, 2.0):.6f}") | |
| print(f" T0 = 0.1: T(1) = {temperature(1, 0.1, 2.0):.6f}") | |
| print() | |
| # Step-by-step proof chain | |
| print("PROOF CHAIN VERIFICATION:") | |
| print("-" * 72) | |
| F = 5 | |
| T = temperature(F) | |
| s = softmax_ratio(d, T) | |
| H = binary_entropy(s) | |
| print(f" F = {F}") | |
| print(f" T = T0 + (1-T0)*exp(-alpha*F) = {T:.6f}") | |
| print(f" T <= 0.2218: {T <= 0.2218}") | |
| print(f" s = exp(d/T) = {s:.4f}") | |
| print(f" s >= 90.75: {s >= 90.75}") | |
| print(f" s > 19.0: {s > 19.0}") | |
| print(f" H(s) = {H:.6f}") | |
| print(f" H < 0.20: {H < 0.20}") | |
| print() | |
| print("=" * 72) | |
| print("THE CHAIN HOLDS. THE BOUND IS STRUCTURAL.") | |
| print("=" * 72) | |