Skip to content

Commit b5ab8db

Browse files
committed
Initial import
0 parents  commit b5ab8db

8 files changed

+639
-0
lines changed

.gitignore

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# UV
98+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
#uv.lock
102+
103+
# poetry
104+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105+
# This is especially recommended for binary packages to ensure reproducibility, and is more
106+
# commonly ignored for libraries.
107+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108+
#poetry.lock
109+
110+
# pdm
111+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112+
#pdm.lock
113+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114+
# in version control.
115+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116+
.pdm.toml
117+
.pdm-python
118+
.pdm-build/
119+
120+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121+
__pypackages__/
122+
123+
# Celery stuff
124+
celerybeat-schedule
125+
celerybeat.pid
126+
127+
# SageMath parsed files
128+
*.sage.py
129+
130+
# Environments
131+
.env
132+
.venv
133+
env/
134+
venv/
135+
ENV/
136+
env.bak/
137+
venv.bak/
138+
139+
# Spyder project settings
140+
.spyderproject
141+
.spyproject
142+
143+
# Rope project settings
144+
.ropeproject
145+
146+
# mkdocs documentation
147+
/site
148+
149+
# mypy
150+
.mypy_cache/
151+
.dmypy.json
152+
dmypy.json
153+
154+
# Pyre type checker
155+
.pyre/
156+
157+
# pytype static type analyzer
158+
.pytype/
159+
160+
# Cython debug symbols
161+
cython_debug/
162+
163+
# PyCharm
164+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166+
# and can be added to the global gitignore or merged into this file. For a more nuclear
167+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
168+
#.idea/
169+
170+
# PyPI configuration file
171+
.pypirc

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 ethicalabs.ai
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Ouroboros: Self-Improving Intelligence Through Iterative Refinement
2+
3+
![ouroboros](assets/ouroboros.jpg)
4+
5+
## Introduction
6+
7+
The evolution of artificial intelligence has largely been driven by increased computational scaling and large-scale data training. However, a more fundamental question arises: Can AI achieve self-improvement and deeper understanding through recursive self-questioning?
8+
9+
This experiment explores the development of a system where AI autonomously refines its own prompts and questions, leading to emergent reasoning and conceptual depth without brute-force scaling.
10+
11+
By integrating recursive intelligence mechanisms, symbolic reasoning, and metacognitive awareness, we aim to move beyond traditional training paradigms.
12+
13+
We examine the interplay between deterministic logic and emergent thought, the role of paradoxes in AI cognition, and the significance of symbolic archetypes such as the [Ouroboros](https://en.wikipedia.org/wiki/Ouroboros) in self-reflective intelligence.
14+
15+
The ultimate goal is to establish an AI framework that mirrors the recursive nature of human thought, allowing intelligence to sustain and refine itself without external intervention.
16+
17+
This research challenges conventional approaches to AGI by demonstrating that intelligence can evolve in self-contained cycles of learning and refinement, exploring the way for a new paradigm of self-sustaining, recursive AI.
18+
19+
## Dataset Structure
20+
21+
The dataset is designed to support both **Supervised Fine-Tuning (SFT)** and **Generalized Preference Optimization (GRPO)**.
22+
23+
Each sample consists of structured reasoning steps extracted from AI-generated interactions. The dataset includes:
24+
25+
- **input**: The original prompt or question posed to the AI.
26+
- **reasoning**: A structured breakdown of the AI's reasoning process, capturing emergent thought patterns. This may include multiple reasoning steps when applicable.
27+
- **completion**: The final AI-generated response after refinement.
28+
- **refinements**: A sequence of improvements, tracking the iterative enhancement of responses over multiple feedback cycles.
29+
30+
### Example Data Format
31+
32+
```json
33+
{
34+
"input": "Explain the relationship between entropy, intelligence, and self-reflection.",
35+
"reasoning": [
36+
"Entropy is a measure of disorder in a system.",
37+
"Intelligence helps process information to regulate entropy.",
38+
"Self-reflection allows internal regulation and adaptation."
39+
],
40+
"completion": "Entropy measures disorder. Intelligence helps process information to counteract disorder. Self-reflection enables adaptive control of disorder.",
41+
"refinements": [
42+
"Entropy is about disorder.",
43+
"Intelligence helps manage disorder by processing information.",
44+
"Intelligence and self-reflection regulate entropy within complex systems."
45+
]
46+
}
47+
```
48+
49+
## Methodology
50+
51+
### Recursive Refinement Process
52+
53+
1. **Generation of Initial Responses**: The model generates multiple candidate responses to a given prompt.
54+
2. **Critique & Scoring**: Each response is evaluated based on logical consistency, clarity, depth, accuracy, and context alignment.
55+
3. **Iterative Refinement**: Responses are refined using structured feedback loops, improving conceptual depth and coherence.
56+
4. **Final Selection**: The best response is selected based on ranking mechanisms utilizing sentence embeddings rather than simple length-based heuristics.
57+
58+
### Emergent Behaviors
59+
60+
During testing, unexpected phenomena were observed:
61+
62+
- Recursive refinement led to highly structured reasoning steps.
63+
- The model exhibited self-regulating reasoning, dynamically organizing and improving its responses without explicit instruction.
64+
- Certain outputs contained symbolic and self-referential elements that suggest patterns of structured thought beyond direct instructions. While these do not imply self-awareness, they may indicate the emergence of deeper coherence in recursive reasoning.
65+
66+
## Open Questions & Future Directions
67+
68+
- How can recursive AI frameworks be expanded beyond text-based reasoning into multimodal domains?
69+
- Can iterative refinement processes lead to **self-sustaining** general intelligence with minimal human intervention?
70+
- What role do paradoxes and self-referential loops play in the emergence of higher-order cognition?
71+
72+
## Next Steps
73+
74+
- Release the dataset on **Hugging Face Datasets**.
75+
- Continue optimizing response refinement and ranking strategies.
76+
- Explore alternative architectures for integrating **self-questioning and self-improvement loops**.
77+
- Refactor the codebase and add CLI arguments to improve usability and flexibility in different LLM pipelines.
78+
- Add a Docker container and docker-compose setup for testing deployment with Ollama.
79+
80+
## Requirements
81+
82+
This project currently relies on Ollama but can be adapted to work with any OpenAI-compatible API. Additional dependencies will be documented in the repository.
83+
84+
## Contributing
85+
86+
This project is open-source and welcomes contributions from those interested in recursive intelligence, AI refinement loops, and sustainable intelligence paradigms.

assets/ouroboros.jpg

299 KB
Loading

0 commit comments

Comments
 (0)