Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions research/ai_generated_agi_architectures/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Preserve recorded request/raw bytes and their hashes across checkout platforms.
* -text whitespace=cr-at-eol
2 changes: 2 additions & 0 deletions research/ai_generated_agi_architectures/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__pycache__/
collection/sources/
37 changes: 37 additions & 0 deletions research/ai_generated_agi_architectures/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Local model architecture proposals: an auditable constraint study

This packet addresses [issue #5](https://github.com/aLexzzz430/Cognitive-OS/issues/5) by collecting actual proposals from eight named open-weight instruction/chat models on one 12 GB workstation. It studies what compact local systems propose under Cognitive-OS constraints; it is **not a comparison of eight frontier services, eight independent lineages, or demonstrated AGI systems**.

The useful result is a set of implementation decisions grounded in the proposals' omissions and contradictions. A section labelled “recovery” does not define recoverable file effects; a section labelled “governance” does not define authority. Several models repeat the prompt's SQLite/verifier concepts, some introduce incompatible cloud or distributed infrastructure, and TinyLlama invents empirical performance numbers. Those claims remain in the raw evidence and are explicitly rejected in the analysis.

## Read the packet

- [prompts.md](prompts.md): exact common prompt, serialization and generation protocol.
- [sources.md](sources.md): pinned models, attribution, dates, licenses, local environment and edits.
- [raw_outputs/](raw_outputs/): unedited decoded generations, including termination tokens.
- [comparison.csv](comparison.csv): eight systems × eleven dimensions, with a verbatim quote, source line and analyst assessment in every row.
- [summary.md](summary.md): agreements, disagreements, failures and limits of inference.
- [synthesis.md](synthesis.md): a bounded local architecture and integration decisions tied to the current repository.
- [collection/runs/](collection/runs/): exact requests, rendered prompts, input/output token IDs, generation settings, timestamps, hashes and runtime versions.
- [recovery_experiment.py](recovery_experiment.py): an isolated, executable process-crash example; it does not exercise the actual Cognitive-OS runtime.

## Method and evidential limits

Collection uses one frozen user prompt per model, its own chat template, greedy decoding, BF16, eager attention, batch one and a 1,400-new-token cap. The requested length is at most 850 words, but equal token budgets do not imply equal word budgets. A length-capped answer is retained rather than extended or replaced. Completed model outputs are never regenerated to choose a better answer. Failed attempts are documented in [collection/incidents.md](collection/incidents.md).

The sample is selected for public access, local hardware and license compatibility. Its small size, shared architecture ancestry, one prompt, one output per model and lack of blinding do not support statistical rankings or broad claims about model families. “SQLite consensus” is especially confounded: SQLite, journaling, governed tools and verifier-gated patches were explicitly supplied in the prompt. Instruction-following failures are observations for these exact runs, not universal model properties.

The collection records support inspection and local reproduction, not independent proof from a model provider. Hashes establish correspondence between recorded files; they do not establish the truth of a model's assertions or prove that another device will emit identical tokens. No hidden prompts, account tokens, paid-service screenshots or model weights are included. Research analysis and scripts are separate from the raw generations attributed to the named models.

## Recheck

From the repository root:

```bash
python research/ai_generated_agi_architectures/verify_packet.py
python research/ai_generated_agi_architectures/recovery_experiment.py
python scripts/check_conos_repo_layout.py
pytest -q tests/test_public_repo_smoke.py
```

The repository's public smoke tests require a Unix environment because existing runtime code imports `resource`. The required Linux checks are recorded separately from the isolated experiment. The packet makes no claim that all repository tests, production crash recovery or AGI capabilities have been validated. See [validation.md](validation.md) for exact completed checks and their scope.
106 changes: 106 additions & 0 deletions research/ai_generated_agi_architectures/collection/analysis.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Build a consistent comparison and locate every quoted source in raw output."""
import csv
import json
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
DIMENSIONS = ["memory", "reasoning_planning", "learning", "tools_actions", "world_self",
"safety_governance", "evaluation", "persistence_recovery", "orchestration",
"engineering_feasibility", "originality"]
analysis = json.loads((ROOT / "collection/analysis.json").read_text(encoding="utf-8"))
models = json.loads((ROOT / "collection/models.json").read_text(encoding="utf-8"))
rows = []
for model in models:
slug = model["slug"]
raw_path = ROOT / f"raw_outputs/{slug}.txt"
raw = raw_path.read_text(encoding="utf-8")
response = json.loads((ROOT / f"collection/runs/{slug}/response.json").read_text(encoding="utf-8"))
entries = analysis[slug]
assert len(entries) == len(DIMENSIONS), slug
for dimension, (quote, assessment) in zip(DIMENSIONS, entries):
assert quote and quote in raw, (slug, dimension, quote)
line = raw[:raw.index(quote)].count("\n") + 1
rows.append(dict(system=slug, model=model["model_id"], dimension=dimension,
output_quote=quote, analysis=assessment,
evidence=f"raw_outputs/{slug}.txt#L{line}",
termination=response["termination"]))
with (ROOT / "comparison.csv").open("w", newline="", encoding="utf-8") as stream:
writer = csv.DictWriter(stream, fieldnames=list(rows[0]))
writer.writeheader()
writer.writerows(rows)
print(f"Wrote {len(rows)} source-checked comparison rows.")
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Render attribution directly from successful collection records."""
import json
from pathlib import Path

root = Path(__file__).resolve().parent.parent
models = json.loads((root / "collection/models.json").read_text())
lines = ["# Sources and attribution", "", "All outputs were generated locally on 2026-09-09 using public Hugging Face model snapshots. Links below pin the model revision rather than a mutable model name. Provider/tool for every execution: local Hugging Face Transformers on the contributor's workstation; the named model organizations did not host these requests.", "", "| System/model | Revision | License in model metadata | UTC collection start | New tokens | Stop |", "|---|---|---|---|---:|---|"]
for model in models:
response = json.loads((root / f"collection/runs/{model['slug']}/response.json").read_text())
license_name = "TII Falcon-LLM License 2.0" if model["slug"] == "falcon" else model["license"]
lines.append(f"| [{model['model_id']}]({model['source']}) | `{model['revision']}` | {license_name} | {response['started_utc']} | {response['generated_tokens']} | {response['termination']} |")
lines.extend(["", "## Access, ancestry and licenses", "",
"The publishers are XHToken (Spark), Qwen/Alibaba, Microsoft (Phi), Hugging Face (SmolLM), IBM (Granite), Technology Innovation Institute/Falcon-LLM Team, TinyLlama and H2O.ai (Danube). These are eight distinct named projects/checkpoints, not eight proven independent training lineages. TinyLlama's card states it adopts the Llama2 architecture/tokenizer; Danube3 adjusts the Llama2 architecture and uses the Mistral tokenizer. Shared architecture, synthetic training material and training-data overlap limit independence. No frontier-service names are used to label local outputs.", "",
"License metadata and public model cards were inspected before use. Falcon is not Apache-2.0: its card links the [TII terms](https://falconllm.tii.ae/falcon-terms-and-conditions.html), including the applicable acceptable-use conditions. The Falcon-LLM Team's [release article](https://huggingface.co/blog/falcon3) is an additional attribution source. The intended use is lawful local architecture research. Model licensing is not a warranty that generated text is correct or unique. We redistribute generated proposals and small collection records, not model weights or the full downloaded model-card archive.", "",
"## Runtime and evidence", "",
"The responses record Python3.13.5, Windows, an NVIDIA GeForce RTX4070, CUDA12.8, torch2.8.0+cu128 and Transformers4.57.1, plus exact supporting package versions. Each response is the authoritative runtime record. Danube additionally required sentencepiece0.2.2 and protobuf7.36.1 before its successful invocation. The collector remains the same for all eight successful runs; its SHA-256 is recorded in every response. No model was re-run after producing a completed response.", "",
"`request.json` stores the exact user message, rendered chat prompt, input IDs and generation settings. `response.json` stores generated token IDs, unedited decoded text, timestamps, stop condition and hashes. `model-files.json` records the actual weight/config/tokenizer/custom-code files used locally. File hashes can establish a match to these records but cannot independently attest execution or validate claims in generated text.", "",
"## Edits and byte handling", "",
"Raw decoded outputs were not rewritten, corrected, translated, continued or deduplicated. Special tokens remain in raw_outputs; readable.txt removes tokenizer special tokens only. The collector wrote text on Windows, which can serialize newlines as CRLF. Its output_sha256 is over the decoded UTF-8 string (LF), while request_sha256 and the packet manifest are over actual file bytes. verify_packet.py checks both deliberately. Packet .gitattributes prevents Git from silently normalizing preserved evidence. Line references in comparison.csv count text lines after universal-newline decoding.", "",
"Analysis, comparison assessments, synthesis and scripts are separate from the eight recorded generations. The raw outputs have no human edits. The model assertions that components are implemented or benchmarks achieved have not been promoted to facts. Failed downloads/tokenizer setup and other incidents are disclosed in collection/incidents.md.", "",
"## Repository and external references", "",
"- [Original task and acceptance criteria](https://github.com/aLexzzz430/Cognitive-OS/issues/5).", "- [Inspected repository baseline](https://github.com/aLexzzz430/Cognitive-OS/tree/e20d2ff4d5c84d4c11c87218c4ae9a04ab0046ca).", "- Source paths supporting integration observations are linked in synthesis.md. Those observations are separate from model output.", "- No proprietary prompts, private API output, credentials, account screenshots or private customer data were used. Existing competing submissions were not used as sources for model outputs or the comparison.", ""])
(root / "sources.md").write_text("\n".join(lines), encoding="utf-8")
print("Wrote sources for", len(models), "successful model records")
72 changes: 72 additions & 0 deletions research/ai_generated_agi_architectures/collection/collect.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
"""Collect one real local response; never overwrite an existing record."""
import argparse
from datetime import datetime, timezone
import hashlib
import importlib.metadata
import json
import os
from pathlib import Path
import platform
import time

os.environ['HF_HUB_OFFLINE'] = '1'
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig, set_seed

ROOT = Path(__file__).resolve().parent
parser = argparse.ArgumentParser()
parser.add_argument('--model-dir', type=Path, required=True)
parser.add_argument('--slug', required=True)
args = parser.parse_args()
entry = next(m for m in json.loads((ROOT/'models.json').read_text()) if m['slug'] == args.slug)
out = ROOT/'runs'/args.slug
out.mkdir(parents=True, exist_ok=True)
if (out/'response.json').exists():
raise SystemExit('Existing response preserved; no repeat collection.')
prompt = (ROOT/'prompt.txt').read_text(encoding='utf-8')
messages = [{'role':'user', 'content':prompt}]
torch.set_num_threads(4)
assert torch.cuda.is_available() and torch.cuda.is_bf16_supported()
set_seed(20260909)
started_utc = datetime.now(timezone.utc).isoformat()
trust_code = args.slug == 'spark'
tokenizer = AutoTokenizer.from_pretrained(args.model_dir, local_files_only=True, trust_remote_code=trust_code)
rendered = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
inputs = tokenizer(rendered, add_special_tokens=False, return_tensors='pt').to('cuda')
print('LOADING', args.slug, 'prompt tokens', inputs.input_ids.shape[-1], flush=True)
model = AutoModelForCausalLM.from_pretrained(args.model_dir, local_files_only=True, trust_remote_code=trust_code,
torch_dtype=torch.bfloat16, attn_implementation='eager', device_map='cuda', use_safetensors=True).eval()
config = GenerationConfig(max_new_tokens=1400, do_sample=False, use_cache=True,
bos_token_id=model.generation_config.bos_token_id, eos_token_id=model.generation_config.eos_token_id,
pad_token_id=tokenizer.eos_token_id)
request = dict(model=entry, messages=messages, rendered_prompt=rendered,
input_ids=inputs.input_ids[0].tolist(), generation_config=config.to_dict(),
seed=20260909, dtype='bfloat16', attention='eager', enable_thinking=False,
prompt_sha256=hashlib.sha256(prompt.encode()).hexdigest())
(out/'request.json').write_text(json.dumps(request, indent=2, ensure_ascii=False)+'\n', encoding='utf-8')
torch.cuda.synchronize()
started = time.perf_counter()
with torch.inference_mode():
result = model.generate(**inputs, generation_config=config, use_model_defaults=False)
torch.cuda.synchronize()
ids = result[0, inputs.input_ids.shape[-1]:].tolist()
raw = tokenizer.decode(ids, skip_special_tokens=False)
readable = tokenizer.decode(ids, skip_special_tokens=True)
eos = config.eos_token_id
eos = [eos] if isinstance(eos, int) else eos or []
response = dict(output_ids=ids, raw_output=raw, generated_tokens=len(ids),
termination='eos' if ids and ids[-1] in eos else 'length',
seconds=time.perf_counter()-started,
started_utc=started_utc, completed_utc=datetime.now(timezone.utc).isoformat(),
model=entry, output_sha256=hashlib.sha256(raw.encode()).hexdigest(),
request_sha256=hashlib.sha256((out/'request.json').read_bytes()).hexdigest(),
collector_sha256=hashlib.sha256(Path(__file__).read_bytes()).hexdigest(),
python=platform.python_version(), platform=platform.system(),
gpu=torch.cuda.get_device_name(), cuda=torch.version.cuda,
packages={p:importlib.metadata.version(p) for p in ['torch','transformers','accelerate','huggingface-hub','tokenizers','safetensors']})
(out/'response.json').write_text(json.dumps(response, indent=2, ensure_ascii=False)+'\n', encoding='utf-8')
raw_dir = ROOT.parent/'raw_outputs'
raw_dir.mkdir(exist_ok=True)
(raw_dir/f'{args.slug}.txt').write_text(raw, encoding='utf-8')
(out/'readable.txt').write_text(readable, encoding='utf-8')
print('COLLECTED', args.slug, len(ids), response['termination'], flush=True)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Download pinned public model snapshots without remote code execution."""
import argparse
import json
import os
import time
from pathlib import Path

os.environ.setdefault('HF_HUB_DISABLE_XET', '1')
from huggingface_hub import snapshot_download

ROOT = Path(__file__).resolve().parent
parser = argparse.ArgumentParser()
parser.add_argument('--model-root', type=Path, required=True)
parser.add_argument('--slug', required=True)
args = parser.parse_args()
entry = next(m for m in json.loads((ROOT/'models.json').read_text()) if m['slug'] == args.slug)
for attempt in range(1, 4):
try:
snapshot_download(entry['model_id'], revision=entry['revision'],
local_dir=args.model_root/entry['slug'], max_workers=2,
allow_patterns=['*.json', '*.jinja', '*.txt', '*.model', '*.safetensors', 'LICENSE', 'README.md'] + (['*.py'] if args.slug == 'spark' else []),
token=False)
break
except Exception as exc:
print('DOWNLOAD_ATTEMPT_FAILED', entry['slug'], attempt, type(exc).__name__, flush=True)
if attempt == 3:
raise
time.sleep(5)
print('SNAPSHOT_READY', entry['slug'], entry['revision'], flush=True)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Record exact local model/tokenizer/code files; omit paths outside the model."""
import argparse
import hashlib
import json
from pathlib import Path

parser = argparse.ArgumentParser()
parser.add_argument("--slug", required=True)
parser.add_argument("--model-dir", type=Path, required=True)
args = parser.parse_args()
root = Path(__file__).resolve().parent
model = next(m for m in json.loads((root / "models.json").read_text()) if m["slug"] == args.slug)
records = []
for path in sorted(args.model_dir.iterdir()):
if not path.is_file() or path.suffix not in (".safetensors", ".json", ".py", ".model", ".jinja"):
continue
with path.open("rb") as stream:
sha = hashlib.file_digest(stream, "sha256").hexdigest()
records.append(dict(file=path.name, bytes=path.stat().st_size, sha256=sha))
assert any(r["file"].endswith(".safetensors") for r in records)
out = root / "runs" / args.slug / "model-files.json"
out.write_text(json.dumps(dict(model=model, files=records), indent=2) + "\n", encoding="utf-8")
print(args.slug, len(records), "model files hashed", flush=True)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Collection incidents

- Before collection, Qwen2.5-3B-Instruct was considered but its research-only license was unsuitable for this paid submission. It was replaced by Apache-2.0 Qwen2.5-1.5B-Instruct before any inference. No 3B weights or outputs were used.
- The initial Spark invocation failed before generating an output because Transformers merged model-specific defaults into a fresh generation configuration (`top_k=-1` with sampling). The collector now sets `use_model_defaults=False`, preserving the explicitly recorded common generation settings. The failed request is retained in `runs/spark/initial-failed-request.json`. There is no response from that failed invocation.
- Granite/Falcon downloads initially ended with interrupted HTTP bodies; TinyLlama/Danube initially had network/cache errors. Downloads were resumed at the same pinned revisions. Danube's first weight shard needed a further resume after an incomplete transfer; existing successful model outputs were preserved throughout.
- Danube's first collection invocation failed while loading its tokenizer, before rendering a prompt or generating any tokens: the runtime lacked `sentencepiece` and `protobuf`. These dependencies were installed before retrying the same model/prompt. No failed response was invented or counted as an output.
- The first execution of the isolated recovery experiment reached Windows temporary-directory cleanup with an open parent SQLite connection. It failed with WinError32. The script now closes that inspection connection explicitly; the subsequent complete result is preserved separately. This was an experiment harness error, not a demonstrated Cognitive-OS defect.
- The repository layout check passed locally, but Windows public smoke-test collection failed on the existing Unix-only `resource` import. No tests were skipped to conceal this; the original Linux Python3.10/3.11 workflow was run in the public fork.
Loading