HopeNetwork<T>

Models & Types · AiDotNet.NeuralNetworks

Hope architecture - a self-modifying recurrent neural network variant of Titans with unbounded levels of in-context learning. Core innovation of Google’s Nested Learning paradigm.

Inheritance: NeuralNetworkBase<T> → DeclaredModelLayoutBase<T> → VectorModelLayoutBase<T> → HopeNetwork<T>

Implements: IGeneratedParameterRegistrar<T>

For Beginners

HopeNetwork is a self-modifying neural network inspired by Google’s Nested Learning paradigm. Unlike standard networks with fixed architectures, it can modify its own behavior during inference through a continuum memory system. This allows it to perform unbounded levels of in-context learning, meaning it can keep adapting to new patterns without being retrained. Think of it as a network that can “learn to learn” in real time.

Example

var architecture = new NeuralNetworkArchitecture<float>(inputFeatures: 8, outputSize: 4);
var input = Tensor<float>.CreateRandom(new[] { 1, 10 });
var trainX = Tensor<float>.CreateRandom(4, 8);
var trainY = Tensor<float>.CreateRandom(4, 2);
var result = new AiModelBuilder<float, Tensor<float>, Tensor<float>>()
    .ConfigureModel(new HopeNetwork<float>(architecture))
    .Build(trainX, trainY);
var output = result.Predict(input);

Constructors

Constructor Summary
HopeNetwork() Initializes a new instance with default architecture settings.
HopeNetwork(NeuralNetworkArchitecture<T> architecture, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, HopeNetworkOptions options)

Properties

Property Summary
bool SupportsTraining { get; } Indicates whether the network supports training.
int AdaptationStep { get; } Gets the adaptation step count.
int InContextLearningLevels { get; } Gets the number of in-context learning levels (unbounded in theory, bounded in practice).

Methods

Method Summary
ContinuumMemorySystemLayer<T>[] GetCMSBlocks() Gets the CMS blocks (for inspection/debugging).
IAssociativeMemory<T> GetAssociativeMemory() Gets the associative memory system.
IContextFlow<T> GetContextFlow() Gets the context flow mechanism.
ModelMetadata<T> GetModelMetadata() Gets metadata about the model (required by NeuralNetworkBase).
Tensor<T> Forward(Tensor<T> input) Performs a forward pass through the Hope architecture.
Vector<T> GetMetaState() Gets the current meta-state (for inspection/debugging).
void AddOutputLayer(int outputDim, ActivationFunction activation) Adds an output layer to the Hope network.
void ConsolidateMemory() Consolidates memories across all CMS blocks.
void ResetMemory() Resets all memory in CMS blocks and meta-state.
void ResetRecurrentState() Resets recurrent layer states.
void ResetState() Resets the state of the network (required by NeuralNetworkBase).
void SetSelfModificationRate(T rate) Sets the self-modification rate for self-referential optimization.