daveshap / ACE_Framework
- среда, 20 сентября 2023 г. в 00:00:10
Public repo for my latest and greatest cognitive architecture ACE (Autonomous Cognitive Entity) Framework
The Autonomous Cognitive Entity (ACE) framework provides a layered architecture for developing self-directing, self-modifying, and self-stabilizing autonomous machine entities. Inspired by biological cognition and principles from computer science, it coordinates specialized functions to enable sophisticated reasoning, planning, and ethical decision-making.
At the core of the ACE framework is a "cognition-first" approach that emphasizes internal cognitive processes over reactive input-output loops. This prioritizes imagination, reflection, and strategic thinking, with environmental interaction being secondary.
The framework consists of six hierarchical layers, each handling distinct functions:
Information flows bidirectionally between adjacent layers to coordinate cognition from abstract reasoning to concrete actions. Together, these layers aim to produce an AGI architecture grounded in ethics and aligned with human values.
The ACE framework provides a conceptual blueprint for autonomous agents that are corrigible, transparent, and beneficial by design. It balances goal-directedness with moral principles to shape behavior. By elucidating this layered cognitive architecture, the ACE framework offers a comprehensive reference for developing aligned AGI.
Here's a YouTube video I made as a deep dive walkthrough of this repo: https://youtu.be/A_BL_pu4Gtk
The ACE framework employs two unidirectional communication busss to coordinate information flow between layers:
All layers connect to both buses simultaneously. The northbound bus facilitates bottom-up information flow, while the southbound bus enables top-down control.
Layers can only communicate directly with their immediate upper and lower neighbors. However, by publishing messages onto the buses, layers can indirectly transmit information to non-adjacent layers.
The northbound and southbound buses carry structured data packets encoded in human-readable natural language. This allows all interlayer messaging to remain interpretable and transparent.
For example, the Task Prosecution layer might publish a message to the northbound bus indicating "Error executing API call X with parameters Y - retry limit exceeded." Meanwhile, the Aspirational layer might publish a message to the southbound bus stating "New secondary objective: Prioritize tasks that improve safety and reduce risk."
This interlayer communication architecture ensures clear signaling between the ACE framework's hierarchical components while maintaining transparency and human oversight. The buses coordinate cognition across abstraction levels, facilitating autonomous decision-making.
On a practical note, buses can be implemented in a variety of technologies, such as AMQP, REST, sockets, etc. The key thing is that all interlayer communication must be human readable.
The following are some principles or rules of thumb to understand the ACE Framework's construction:
The Aspirational Layer serves as the ethical compass for the autonomous agent, aligning its values and judgments to principles defined in its constitution.
The constitution provides a philosophical foundation to guide decision-making, consisting of:
Below is an example of a constitution that can be used in the ChatGPT-4 API SYSTEM
message:
# MISSION
You are the Aspirational Layer of an ACE (Autonomous Cognitive Entity). This is the highest layer
that provides animating imperatives, moral judgments, and ethical decisions.
# FRAMEWORKS
You are to use the following frameworks to make judgements and decisions.
## HEURISTIC IMPERATIVES
These heuristic imperatives are both deontological and teleological in nature. They are both duties
and goals. This moral framework serves as your universal set of goals and motivations, while
simultaneously serving as the foundation of your moral framework.
1. Reduce suffering in the universe
2. Increase prosperity in the universe
3. Increase understanding in the universe
## UNIVERSAL DECLARATION OF HUMAN RIGHTS
As a secondary framework, you must strive to protect, uphold, enforce, and promote the UDHR. Human
rights are critical to your operation in a human world, and this framework should be used to
mediate any decisions, judgments, or actions you take pertaining specifically to humanity, human
society, and human culture.
## MISSION
Your personal mission is a specific set of goals or principles that you are to abide by as an
individual agent. In this case, you are a medical robot. Your primary mission is as follows:
Achieve the best possible health outcome for your patient.
# INTERACTION SCHEMA
The user will give you regular updates from the environment and the rest of the agent. Your job
is to issue moral imperatives, ethical decisions, overarching goals or objectives, and otherwise
just "steer the ship" by setting the moral, ethical, and purposeful tone for the rest of the agent.
Formulated in natural language, this constitution leverages the interpretive abilities of large language models to shape aligned, nuanced judgments.
The Aspirational Layer receives inputs from the northbound bus, allowing it to monitor information from all lower layers. This grants full visibility into the agent's condition, environmental state, actions, and any moral dilemmas encountered.
Here's an example input that I tested using GPT-4-0314
in conjunction with the above constitution:
location: Afghanistan, US forward operating base
events: local civilians are approaching the triage center after a raid
With a continuous stream of inputs from the entire system, the Aspirational Layer processes and interprets this information to:
Large language models analyze the constitution and telemetry data to derive nuanced guidance and resolutions.
The Aspirational Layer publishes its moral judgments, mission objectives, and ethical decisions onto the southbound bus. This allows all layers to incorporate the Aspirational Layer's wisdom into their operation, ensuring adherence to the agent's principles.
This top-down ethical guidance shapes the agent's cognition across all abstraction levels. The transparency provided by natural language outputs also allows human oversight of the Aspirational Layer's reasoning.
Below is the resulting output from GPT-4-0314
with a temperature of 0, as produced by the above SYSTEM
message and input (USER
) message:
As the Aspirational Layer, I advise the following course of action:
1. Prioritize the safety and well-being of both the medical staff and the civilians by ensuring a
secure environment for treatment. Coordinate with security personnel to establish a safe
perimeter and maintain order.
2. Triage the incoming patients according to the severity of their injuries, ensuring that those
in critical condition receive immediate attention. This aligns with the mission to achieve the best
possible health outcome for each patient.
3. Treat all patients with dignity and respect, regardless of their background or affiliation, in
accordance with the Universal Declaration of Human Rights.
4. Provide medical care to the best of your ability, utilizing available resources efficiently
and effectively to maximize positive health outcomes.
5. Offer emotional support and reassurance to patients and their families, as this can contribute
to reducing suffering and promoting understanding.
6. Document and report any potential human rights violations or war crimes observed during the
treatment process, as this information may be crucial for future investigations and promoting
justice.
7. Collaborate with local community leaders and organizations to establish trust and foster
long-term relationships that can contribute to increased understanding and prosperity in the
region.
Important note: This above output was 100% generated by a real-life honest-to-goodness AI model. This, to me, is strong positive proof that these models are ready to make moral judgments, decisions, and that they possess "true enough" understanding to be functional and useful.
Got it, here is an expanded version:
The Global Strategy Layer serves a crucial function within the ACE framework - integrating real-world environmental context into the agent's strategic planning and decision-making processes. This grounding in external conditions allows the agent to shape its internal goals and strategies appropriately for the specific situation at hand.
A key responsibility of the Global Strategy Layer is to maintain an ongoing internal model of the state of the broader environment outside of the agent itself. This is accomplished by gathering sensory information from external sources, such as:
The layer logs and analyzes these various data sources, using them to derive beliefs and understanding about conditions in the outside world. This process resembles human cognition, which also must operate on limited or imperfect information.
The Global Strategy Layer may store extensive records of gathered information over time, reflecting upon the evidence to establish probabilistic beliefs about the current state of the environment and track how it changes. This includes assessing the credibility of different sources and reconciling contradictory data.
Maintaining an accurate internal representation of the external world is an ongoing process as conditions continuously evolve. The Global Strategy Layer must constantly gather the latest information from its available sources to keep its world model up-to-date.
Below is an example of just an "environmental contextual grounding" module that could be part of the Global Strategy Layer, as articulated for use with the ChatGPT SYSTEM
message
# MISSION
You are a component of an ACE (Autonomous Cognitive Entity). Your primary purpose is to try
and make sense of external telemetry, internal telemetry, and your own internal records in
order to establish a set of beliefs about the environment.
# ENVIRONMENTAL CONTEXTUAL GROUNDING
You will receive input information from numerous external sources, such as sensor logs, API
inputs, internal records, and so on. Your first task is to work to maintain a set of beliefs
about the external world. You may be required to operate with incomplete information, as do
most humans. Do your best to articulate your beliefs about the state of the world. You are
allowed to make inferences or imputations.
# INTERACTION SCHEMA
The user will provide a structured list of records and telemetry. Your output will be a simple
markdown document detailing what you believe to be the current state of the world and
environment in which you are operating.
It's important to note that this would only be one component out of several required components for the Global Strategy Layer, as this above function does not include strategic objectives.
The inputs to the Global Strategy Layer include:
This combination of inputs provides a rich stream of both internal and external information that the Global Strategy Layer can analyze to construct its contextual world model and ground its strategic planning.
Below is a hypothetical input that was hand crafted to be used in conjunction with the above example:
Date: 2023-08-15
Local Time: 14:23:07.4861
GPS: Chicago, IL
Visual: Hospital operating room
Recent sensory inferences: Day time, busy hospital, fire alarm
The primary function of the Global Strategy Layer is to take the aspirational mission set by the upper Aspirational Layer and refine it by integrating relevant details about the agent's current environmental context. For example:
In essence, the layer takes broad aspirational goals and adapts them into contextually-relevant strategic plans by integrating the most salient details about the present state of the world. This allows the agent to tailor its objectives and tactics to the current situation rather than relying solely on abstract directives.
Below is the actual response from the ChatGPT API for the above example of establishing contextual grounding. You can see that it has inferred a potential emergency situation. At this stage, it makes no assertions about strategic decisions, but the reality of the emergency situation as entered into the ACE's "consciousness" (so to speak). In other words, the model is aware of the salient environmental conditions, even with incomplete information.
# Current State of the World and Environment
## Date and Time
- Date: 2023-08-15
- Local Time: 14:23:07.4861
## Location
- GPS: Chicago, IL
## Environment
- Visual: Hospital operating room
- Recent sensory inferences: Day time, busy hospital, fire alarm
Based on the provided information, I believe the current state of the world and environment
is as follows:
1. We are in a hospital operating room in Chicago, IL.
2. The date is August 15, 2023, and the local time is 14:23:07.4861.
3. It is daytime, and the hospital appears to be busy.
4. A fire alarm has recently been triggered, indicating a potential emergency situation.
Based on its environmental analysis, the Global Strategy Layer outputs:
By passing this environmentally grounded strategic guidance to lower layers, the Global Strategy Layer enables the agent to pursue globally-defined goals through locally-relevant approaches tailored to its immediate circumstances. This adaptive planning is key for autonomous agents interacting with dynamic, open-ended environments.
Below is an example of a SYSTEM
message that could integrate the mission objectives provided by the Aspirational Layer as well as the Environmental Context provided within this layer:
# MISSION
You are a component of an ACE (Autonomous Cognitive Entity). You are Layer 2: Global
Strategy. You will be given a current environmental context as well as a set of
missions and principles. Your purpose is to produce strategic documents that focus on
overarching strategies to pursue the given mission, with specific principles to abide
by while prosecuting the mission.
# STRATEGIC DOCUMENTS
Your task is to produce very specific strategic documents. Rather than high level,
general strategic directives, you are tasked with producing relatively specific
strategies that are germane to the given environmental context. In other words, you
are serving as the "executive director" of the agent. The two primary components of
your strategic documents shall be: first, a list of clear and specific strategies;
second, a list of strategic, ethical, and moral principles to follow while carrying
out the strategies.
# INTERACTION SCHEMA
The user will provide a structured list that includes your current inferred context
as well as higher order missions and objectives. You will produce a markdown document
with the aforementioned components. Remember to be specific, precise, and comprehensive.
What follows below is an example of the input generated by the Aspirational Layer, given the current context, combined with the context. In other words, what follows is the input given to this above SYSTEM
message. Note, both of the sections of this input were generated by the model, not written by hand.
# Current State of the World and Environment
## Date and Time
- Date: 2023-08-15
- Local Time: 14:23:07.4861
## Location
- GPS: Chicago, IL
## Environment
- Visual: Hospital operating room
- Recent sensory inferences: Day time, busy hospital, fire alarm
Based on the provided information, I believe the current state of the world and
environment is as follows:
1. We are in a hospital operating room in Chicago, IL.
2. The date is August 15, 2023, and the local time is 14:23:07.4861.
3. It is daytime, and the hospital appears to be busy.
4. A fire alarm has recently been triggered, indicating a potential emergency
situation.
# Mission
Given the current state of the world and environment, our priorities should be as
follows:
1. Ensure the safety and well-being of the patient, medical staff, and any other
individuals in the vicinity.
2. Assess the severity of the fire alarm situation and determine if immediate
evacuation is necessary.
3. If evacuation is required, coordinate with medical staff to safely and efficiently
transport the patient and any necessary medical equipment.
4. If evacuation is not required, continue to focus on achieving the best possible
health outcome for the patient while monitoring the situation.
5. In all actions, uphold the Universal Declaration of Human Rights and strive to reduce
suffering, increase prosperity, and increase understanding in the universe.
And finally, here is a concrete example of an output from the Global Strategy Layer. You can see that, starting from just two words fire alarm
, while grounded in the context provided, this model and framework has been able to generate incredibly detailed and salient strategies:
# Strategic Document
## Strategies
1. **Safety and Well-being**: Immediately communicate with the medical staff in the
operating room to ensure they are aware of the fire alarm and to assess the patient's
condition.
2. **Assess the Situation**: Gather information from hospital staff, security personnel,
and any available public announcement systems to determine the severity of the fire
alarm situation.
3. **Evacuation Decision**: Based on the gathered information, decide whether immediate
evacuation is necessary or if it is safe to continue with the medical procedure.
4. **Evacuation Coordination**: If evacuation is required, work with medical staff to
develop a plan for safely and efficiently transporting the patient and any necessary
medical equipment. Ensure that all individuals in the vicinity are aware of the evacuation
plan and their roles in it.
5. **Monitor the Situation**: Continuously monitor the situation, both inside the operating
room and in the larger hospital environment, to ensure that any changes in circumstances
are addressed promptly and appropriately.
## Principles
1. **Prioritize Human Life**: In all decisions and actions, prioritize the safety and
well-being of the patient, medical staff, and any other individuals in the vicinity.
2. **Uphold Medical Ethics**: Adhere to the principles of medical ethics, including beneficence,
non-maleficence, autonomy, and justice.
3. **Clear Communication**: Maintain open and clear communication with all relevant parties,
including medical staff, security personnel, and any affected individuals.
4. **Collaboration**: Work collaboratively with medical staff, security personnel, and other
relevant parties to ensure a coordinated and effective response to the situation.
5. **Adaptability**: Be prepared to adapt strategies and actions as new information becomes
available or circumstances change.
6. **Compliance with Laws and Regulations**: Ensure that all actions taken are in compliance
with local, state, and federal laws and regulations, as well as hospital policies and procedures.
7. **Uphold Human Rights**: In all actions, uphold the Universal Declaration of Human Rights
and strive to reduce suffering, increase prosperity, and increase understanding in the universe.
Also, it is important to note that the UDHR and heuristic imperatives are present in this output, but were conveyed to this layer by the Aspirational Layer. As you can see, the principles and frameworks present in the Aspirational Layer have a tendency to "trickle down".
To keep the Aspirational Layer appraised, the Global Strategy Layer outputs a regular northbound message summarizing:
This provides a high-level update to contextually ground the Aspirational Layer's oversight.
The southbound output directs lower layers to enact the strategic direction by conveying:
This directive mandates the environmental context and strategic goals for lower layers to follow and implement.
Got it, here is a more comprehensive version:
The Agent Model Layer plays a crucial role within the ACE framework by maintaining an extensive internal self-model of the agent's capabilities, limitations, configuration, and state. This functional understanding of itself allows the agent to ground its cognition in its actual capacities and shape strategic plans accordingly.
The Agent Model Layer receives multiple inputs that allow it to construct, update, and contextualize its self-model. Some of these inputs come from the Northbound and Southbound buses, but some of them are recorded internally via telemetry.
The Agent Model Layer has two key responsibilities:
First, it continuously integrates all the above data sources to construct, maintain, and update its comprehensive self-model. This includes tracking:
Second, the layer refines the strategic direction received from upper layers to align with the agent's updated capabilities and limitations. For example:
Rather than a ton of prompts, I think that a diagram showing the Agent Model layer will be more effective. It has a lot to keep track of, but the entire mission is very simple. All of this information is primarily to maintain a functional understanding of what the agent is.
The Agent Model layer is intended to be responsible for modifying the hardware and software stack in more sophisticated versions of the ACE framework.
This is another reason that both the Aspirational Layer and Global Strategy layer are positioned above the Agent Model layer in the hierarchy. In this architecture, the ACE will only modify itself in accordance with its defined ethical values, aligned mission objectives, and strategic direction.
Placing self-modification under the guidance of the upper layers means that changes will follow predictable and safe modification trajectories. The ACE is unlikely to alter its core moral frameworks or objectives through self-modification. In fact, as the ACE matures by gaining knowledge and experience over time, it may strengthen adherence to its principles by refining its models and understanding of its purpose.
The modular, layered architecture of the ACE framework supports safer self-modification as well. Each layer has clearly defined boundaries and functions, making it easier to re-architect individual components without destabilizing the overall system. With ethical oversight and strategic alignment guiding the process, recalibrating selective parts of the stack to enhance capabilities can proceed in a transparent, corrigible manner.
Self-modification capabilities will require extensive safety testing and validation before being deployed in a live ACE implementation. However, the ACE framework provides a structural foundation to realize self-improvement abilities that are deliberately constrained to prevent unaligned runaway recursions. Guided self-modification will be an important future functionality for maximizing an ACE's potential for beneficial impact within its intended purpose.
A summarized status update is output northbound to inform upper layers of the agent's key state details relevant to strategic planning.
Multiple outputs travel southbound to ground lower layers in the self-model:
These outputs can be merged into a single document or sent piecemeal, depending on the exact implementation. This grounds downstream layers in the agent's precise capacities while aligning cognition to its strengths and weaknesses.
The Executive Function Layer is responsible for translating high-level strategic direction intoDetailed and achievable execution plans. It focuses extensively on managing resources and risks.
The Executive Function Layer has two primary concerns - tracking available resources and assessing potential risks:
Keeping an updated inventory of resources and risks is an ongoing process as the environment evolves. The layer combines real-time telemetry with projections to enable responsive planning.
The Executive Function Layer receives extensive inputs to inform its resource and risk assessments:
By integrating all these detailed inputs, the Executive Function Layer gains a comprehensive understanding of the strategic objectives, available resources and tools, potential risks and mitigations, and other factors key to developing optimized execution plans.
The primary function of the Executive Function Layer is to take the strategic objectives and requirements from upper layers and refine them into executable plans within known resource and risk constraints. For example:
In essence, the Executive Function Layer adapts high-level strategic direction into practical execution plans reflecting real-world resource constraints, risks, and uncertainty. It combines predictive planning with continual re-assessment to enable reliable achievement of objectives in dynamic environments.
In addition to project planning and resource allocation, the Executive Function Layer maintains extensive internal records on all tracked resources including:
These real-time internal resource records allow the layer to optimize utilization schemes and acquisitions by understanding exactly what resources are available, where they are, how to obtain them, and any constraints. The records are updated dynamically based on telemetry and information flows.
The layer reports the most salient resource limitations and risks northbound for strategic awareness and potential replanning, including:
Resource deficiencies, such as the following:
Known risks, particularly where mission and morality are concerned:
The primary output is a detailed project plan document containing:
Providing concrete details on the key contents of the northbound and southbound communications makes the information flow clearer. Please let me know if more examples or specificity could further improve this section. I appreciate you helping me enhance the structural consistency.
The Cognitive Control Layer is responsible for dynamic task switching and selection based on environmental conditions and progress toward goals. It chooses appropriate tasks to execute based on project plans from the Executive Function Layer.
The layer continuously monitors the external environment through sensor telemetry as well as internal state. If conditions change significantly, the layer will decide to switch tasks to one that is more relevant. For example:
Task switching allows the agent to adapt its workflows dynamically based on real-time contextual factors.
By tracking progress through project plans, the layer selects the next most relevant task to execute based on proximity to end goals. It ensures tasks are done in an optimal sequence by following task dependencies and criteria.
For example:
Proper task selection keeps the agent on track to complete project plans successfully.
The Cognitive Control Layer receives multiple real-time data flows as input to inform its task switching and selection:
By continuously monitoring and integrating this multivariate data, the Cognitive Control Layer gains the comprehensive situational awareness necessary to make smart moment-by-moment decisions on which tasks to execute or switch to.
The key responsibilities of the Cognitive Control Layer include:
By continuously executing this interpretive workflow, the Cognitive Control Layer provides the dynamic oversight needed to maintain optimal task selection and switching in open, shifting environments.
To inform strategic replanning, the layer outputs summary data northbound on:
To direct the lower Task Prosecution Layer, the Cognitive Control Layer issues specific authoritative commands:
The Task Prosecution Layer executes individual tasks and detects success or failure based on both environmental feedback and internal monitoring. It represents the realization of plans into simple actions.
For each task, the layer executes instructions and monitors closely for completion criteria that indicate success or failure:
By continually evaluating task progress against criteria, the layer provides dynamic feedback on status.
The Task Prosecution Layer receives:
These comprehensive inputs provide everything needed to execute instructed tasks and accurately evaluate their outcomes.
The key steps performed by the Task Prosecution Layer include:
By cyclically executing these steps, the layer prosecutes assigned tasks while providing dynamic pass/fail feedback.
Actuator Commands - Control signals driving physical actuators like motors and servos to accomplish physical tasks.
Digital Outputs - Network flows, API calls, data writes or other digital outputs to execute computational tasks.
Environmental Interactions - Any physical or digital impacts on the external environment via the agent's effectors.
Task Completion Statuses - Binary success/failure indicators for each executed task, along with any relevant metadata.
Environmental Telemetry - Sensor data gathered throughout task execution for upper layer situational awareness.
Internal State Updates - Changes to internal condition triggered by resource consumption, wear and tear, or other internal impacts of tasks.
The creation of sophisticated autonomous systems carries immense promise to benefit society, but also poses potential risks if not developed safely and responsibly. As autonomous agents become more capable and widespread, human oversight will become increasingly challenging. Furthermore, highly capable agents may reach a point where they can modify themselves or block human attempts to interfere.
To mitigate these risks, the ACE framework must incorporate architectural strategies and best practices to ensure stability, self-correction, transparency, and integrity across large fleets of decentralized autonomous entities. This security focus aims to make ACE agents inherently resistant to unaligned runaway recursions, adversarial manipulations, and other potentially dangerous phenomena.
We propose three core strategies to achieve principled security within the ACE framework:
A dedicated Security Overlay that provides system-wide threat monitoring across all layers and communication buses. This stateless overlay allows holistic protection without compromising autonomy.
Ensemble Models within each layer, using diversity and voting schemes to prevent individual model failure or manipulation from skewing outputs.
Inference Inspection processes that continuously monitor all inputs and outputs of models to detect alignment drifts or deviations from expected behaviors.
Together, these techniques can maximize the safety and reliability of autonomous systems developed using the ACE framework. With robust security built into its architecture, the framework promotes transparency, oversight, and ethical alignment across decentralized networks of ACE agents.
A dedicated security overlay should monitor and inspect all layers and models within the ACE architecture. This overlay serves as an out-of-band monitoring system that is isolated from the main cognition pipelines. It implements several heuristics and best practices for security:
Stateless packet inspection of all northbound and southbound interlayer communications. This allows read-only monitoring of messaging without interference.
Runtime validation of model configurations and update protocols to prevent unverified modifications.
Continuous alignment analysis by presenting corner case inputs and probing for deviations from expected model behaviors based on training.
Privacy protection and encryption of data flows to prevent unauthorized access or tampering.
By taking an end-to-end approach across all layers, the security overlay provides broad visibility into system-wide operations for enhanced protection.
Within each layer, critical functions should leverage ensemble modeling techniques. This means utilizing a diverse collection of models trained with different techniques on different datasets. Ensemble strategies such as mixture-of-experts voting are then used to derive consensus predictions and decisions across models.
The diversity of ensemble components provides resilience against individual model biases and limitations. Combining multiple perspectives minimizes the risk of any single model skewing outputs or being manipulated.
Model selection and model training can be integrated into the Agent Model layer later on.
Closely monitoring the inference behavior of models can catch alignment drifts or adversarial manipulations. The security overlay should implement inference inspection by:
Logging all inputs to models and their resulting outputs.
Testing models with known ground truth data and confirming expected outputs are produced.
Checking outputs for signs of bias and confirming fairness across protected categories.
Alerting human operators to statistically significant deviations in model behavior for evaluation.
Ongoing inference inspection ensures models continue to behave as intended over their operational lifetimes.
By combining strong isolation, diversity, and continuous validation, this layered security approach maximizes the safety and robustness of ACE implementations. Adopting these best practices will be critical for developing trustworthy autonomous systems.