Skip to content

Adolfo-GM/AGGM-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AGGM-1

Adolfo GM's Generative Model - Version 1

AGGM-1

Lightweight. Context-Aware. Unique.

AGGM-1 is a powerful and efficient language model designed for conversational AI. It operates without the need for massive neural networks, making it incredibly fast and lightweight. Its core strength lies in a sophisticated algorithm that intelligently matches user input to a knowledge base and generates contextually relevant, dynamic responses.

At its heart, AGGM-1 is equipped with a unique, state-of-the-art text-based world model system, known as AGWM (Adolfo's Generative World Model), which allows it to prepend generated "internal thoughts" or contextual background to its responses, creating a richer and more unique interaction.


How It Works: A Deep Dive

AGGM-1's intelligence comes from a multi-stage process that combines deterministic matching with probabilistic generation. It doesn't just find a canned response; it finds the best conversational context and generates a fresh reply from it.

1. Initialization: Building the Brain

When AGGM-1 is initialized, it performs a one-time setup:

  • Corpus Parsing: It reads the provided corpus and parses it into distinct user prompt and ai response pairs.
  • IDF Calculation: It analyzes all user prompts to calculate the Inverse Document Frequency (IDF) for every word. It uses an aggressive (N / count)^2 formula, which gives immense weight to rare and specific words (like "color" or "hobbies") while down-weighting common words ("is", "a", "the"). This is crucial for understanding the user's true intent. (this is similar to attention in transformer models)
  • Global Markov Chain Construction: It builds a global transition model (a 3rd-order Markov chain) from all the ai responses. This model learns which word is likely to follow any given sequence of three words, forming the foundation of its generative capabilities.

2. The Matching Process: Finding the Perfect Context

When a user provides a prompt, AGGM-1 doesn't just look for keywords. It performs a sophisticated similarity search to find the single best match in its user prompt database. The matching score is calculated from two key components:

  1. Keyword Relevance (IDF Score): The model identifies all common words between the user's prompt and a prompt from its database. It then sums their powerful IDF weights. A match on a rare word like "hobbies" contributes exponentially more to the score than a match on a common word like "you".
  2. Contextual Order (LCS Bonus): The model finds the Longest Common Subsequence (LCS) between the user's prompt and the database prompt. This rewards prompts where the words appear in the same relative order, ensuring the contextual structure is similar. This score is also amplified by the IDF weights of the words in the sequence.

This two-part system ensures that the chosen match is not only semantically relevant but also structurally similar to the user's query.

3. Response Generation: Localized Seeding, Global Generation

This is where AGGM-1 truly shines. It is not a simple retrieval bot.

  • Once the single best-matching user prompt is identified, the model takes the corresponding AI response from that pair.
  • It uses the first three words of that AI response as a "starting context" or "seed".
  • From this seed, it uses the global Markov chain to generate the rest of the response word-by-word, creating a new, dynamic sentence that is stylistically consistent with the original training data but not necessarily identical.

This "localized seeding" ensures the response is perfectly on-topic, while the global generation model allows for creativity and variation.

4. The World Model (AGWM)

AGGM-1 can be configured to use its external world model. When the text_world_model=True flag is used in the ask() method:

  1. The AGWM system, which is a separate Markov chain trained on a dedicated text file (training_data/WM.txt), generates a block of text.
  2. This text represents the model's "internal monologue," "world knowledge," or a specific personality trait.
  3. This generated block is wrapped in <world_model> tags and prepended to the final, context-aware response from the main model.

Features

  • High-Speed & Lightweight: Runs entirely on CPU with minimal memory, no GPU required.
  • Sophisticated Matching: Uses a powerful IDF + LCS algorithm to understand user intent beyond simple keywords.
  • Context-Aware Generation: Generates novel responses by seeding a global Markov chain with the context of the best-matched training example.
  • Integrated World Model: Optionally prepends generative "thoughts" to responses for richer, more unique interactions.
  • Easily Trainable: Simply add new user/ai pairs to the corpus file to expand its knowledge base.

Example

{
  "user": "Hello, how are you?",
  "ai": "<world_model>Standing slowly I let my eyes wander the hum of hushed conversations and the aroma of roasted spices something spicy warming promising comfort. I pause watching a street vendor pack away their cart a small chorus of clinks and chatter accompanying the fading night. Nearby a small café s outdoor heater crackles softly illuminating a cluster of trees I hear the distant call of an owl an echo of the expansive night sky I saw earlier. The relic inside a tarnished locket perhaps whispers of stories long past. The faint scent of garlic and frying oil</world_model> Just the usual, learning new things and getting ready to assist. What are you up to?"
}

About

AGGM-1 is a powerful and efficient language model designed for conversational AI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages