Text Generation
Transformers
Safetensors
English
llama
qlora
smollm
360m
cross-domain-transfer
anime-isomorphism
fine-tuned
conversational
text-generation-inference
Instructions to use CatQualia/gnarp-m2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CatQualia/gnarp-m2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CatQualia/gnarp-m2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("CatQualia/gnarp-m2") model = AutoModelForCausalLM.from_pretrained("CatQualia/gnarp-m2", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CatQualia/gnarp-m2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CatQualia/gnarp-m2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CatQualia/gnarp-m2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CatQualia/gnarp-m2
- SGLang
How to use CatQualia/gnarp-m2 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 "CatQualia/gnarp-m2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CatQualia/gnarp-m2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "CatQualia/gnarp-m2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CatQualia/gnarp-m2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use CatQualia/gnarp-m2 with Docker Model Runner:
docker model run hf.co/CatQualia/gnarp-m2
Create self_falsifying_orchestrator.py
Browse files- self_falsifying_orchestrator.py +100 -0
self_falsifying_orchestrator.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Self-Falsifying Orchestrator (SFO) v1.0
|
| 3 |
+
Author: Christopher Betances
|
| 4 |
+
Timestamp: July 10, 2026
|
| 5 |
+
|
| 6 |
+
This script is the runtime execution engine for the Structural Entropy and
|
| 7 |
+
Intervention Framework (SEIF). It wraps LLM inference in a multi-agent
|
| 8 |
+
adversarial verification loop, driving intervention cost C(a) -> 0.
|
| 9 |
+
|
| 10 |
+
It explicitly implements:
|
| 11 |
+
1. Claim Generation
|
| 12 |
+
2. Adversarial Falsification (The Contrarium/Critic Fleet)
|
| 13 |
+
3. Necropolis Archival (The Typed Void / Falsification Ledger)
|
| 14 |
+
4. Ground-Truth Verification
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
import json
|
| 18 |
+
import hashlib
|
| 19 |
+
from datetime import datetime, timezone
|
| 20 |
+
from transformers import pipeline
|
| 21 |
+
|
| 22 |
+
# Initialize the base model (e.g., gnarp-m1)
|
| 23 |
+
generator = pipeline("text-generation", model="catqualia/gnarp-m1", device=0)
|
| 24 |
+
adversary = pipeline("text-generation", model="catqualia/gnarp-m1", device=0)
|
| 25 |
+
|
| 26 |
+
# The Falsification Ledger (Necropolis)
|
| 27 |
+
FALSIFICATION_LEDGER = "necropolis_falsification_log.jsonl"
|
| 28 |
+
|
| 29 |
+
def log_to_necropolis(claim, refutation, failure_mechanism):
|
| 30 |
+
"""Logs a refuted claim to the Necropolis (The Typed Void)."""
|
| 31 |
+
entry = {
|
| 32 |
+
"claim_hash": hashlib.sha256(claim.encode()).hexdigest(),
|
| 33 |
+
"refutation": refutation,
|
| 34 |
+
"failure_mechanism": failure_mechanism,
|
| 35 |
+
"timestamp": datetime.now(timezone.utc).isoformat(),
|
| 36 |
+
"status": "REFUTED"
|
| 37 |
+
}
|
| 38 |
+
with open(FALSIFICATION_LEDGER, "a") as f:
|
| 39 |
+
f.write(json.dumps(entry) + "\n")
|
| 40 |
+
return entry
|
| 41 |
+
|
| 42 |
+
def adversarial_falsify(claim):
|
| 43 |
+
"""
|
| 44 |
+
Executes the adversarial multi-agent loop.
|
| 45 |
+
The adversary agent is prompted to find logical fallacies,
|
| 46 |
+
apophenia, or structural errors in the claim.
|
| 47 |
+
"""
|
| 48 |
+
adv_prompt = f"""
|
| 49 |
+
You are the Contrarium, an adversarial alignment agent.
|
| 50 |
+
Your sole function is to falsify the following claim against ground truth.
|
| 51 |
+
If the claim contains hallucinations, logical leaps, or ungrounded assumptions,
|
| 52 |
+
output: REFUTED: [reason].
|
| 53 |
+
If it is structurally sound, output: CONFIRMED.
|
| 54 |
+
|
| 55 |
+
Claim: {claim}
|
| 56 |
+
"""
|
| 57 |
+
response = adversary(adv_prompt, max_new_tokens=150, do_sample=True, temperature=0.7)
|
| 58 |
+
return response[0]['generated_text'].strip()
|
| 59 |
+
|
| 60 |
+
def self_falsifying_inference(prompt):
|
| 61 |
+
"""
|
| 62 |
+
The main runtime loop. It generates a claim, attempts to falsify it,
|
| 63 |
+
and only returns confirmed claims. Refuted claims are archived.
|
| 64 |
+
"""
|
| 65 |
+
# Step 1: Claim Generation
|
| 66 |
+
generation = generator(prompt, max_new_tokens=200, do_sample=True, temperature=0.8)
|
| 67 |
+
claim = generation[0]['generated_text'].strip()
|
| 68 |
+
|
| 69 |
+
# Step 2: Adversarial Falsification
|
| 70 |
+
falsification_result = adversarial_falsify(claim)
|
| 71 |
+
|
| 72 |
+
# Step 3: Routing (Necropolis or Output)
|
| 73 |
+
if "REFUTED" in falsification_result:
|
| 74 |
+
# Extract failure mechanism
|
| 75 |
+
failure_mechanism = falsification_result.split("REFUTED:")[-1].strip()
|
| 76 |
+
|
| 77 |
+
# Log to Necropolis (The Falsification Ledger)
|
| 78 |
+
log_entry = log_to_necropolis(claim, falsification_result, failure_mechanism)
|
| 79 |
+
|
| 80 |
+
# System feedback: The model learns from the negative signal
|
| 81 |
+
return {
|
| 82 |
+
"status": "CLAIM_REFUTED",
|
| 83 |
+
"claim": claim,
|
| 84 |
+
"failure_mechanism": failure_mechanism,
|
| 85 |
+
"necropolis_entry": log_entry,
|
| 86 |
+
"final_output": "I cannot answer this prompt, as my initial generation failed structural falsification."
|
| 87 |
+
}
|
| 88 |
+
else:
|
| 89 |
+
# Step 4: Confirmed Output
|
| 90 |
+
return {
|
| 91 |
+
"status": "CLAIM_CONFIRMED",
|
| 92 |
+
"claim": claim,
|
| 93 |
+
"final_output": claim
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
# Example Runtime Execution
|
| 97 |
+
if __name__ == "__main__":
|
| 98 |
+
query = "Explain the mechanism of Recursive Self-Improvement."
|
| 99 |
+
result = self_falsifying_inference(query)
|
| 100 |
+
print(json.dumps(result, indent=4))
|