Tuesday, November 26, 2024

Beyond RAG: Hierarchical Agent Architectures - A Technical Framework


I've had reservations about RAG (Retrieval-Augmented Generation) from the start. Something about it just didn't sit right with me. The approach felt like a temporary solution, reminiscent of how we used Flash for mobile development - functional, but clearly not the final answer.

My skepticism wasn't just theoretical. When I needed to process a large corpus of documents with Ollama, RAG was the only viable solution available. I found myself implementing it despite my reservations, and each time, it felt like I was applying a patch rather than solving the fundamental problem.

The issues with RAG run deeper than just implementation challenges. It's inherently blind to context in ways that concern me. What happens when different people use different terms to describe the same concept? How do we capture information that's relevant but not syntact
ically similar? These questions kept nagging at me, suggesting that we needed a fundamentally different approach. This got me thinking about a different approach, one that might seem a bit unconventional at first.

The idea hit me during breakfast one morning: what if we could create an architecture that mimics how we actually process information? Not the simplified "search-then-process" model of RAG, but something more organic, more distributed. I'm thinking of a system where multiple LLM instances work together, like separate areas of the brain working together, each with its own specialized neural network but collaborating to process information holistically.

I know this might sound ambitious, maybe even a bit naive. But bear with me as I explain the concept.


The Current State of Things

Let's be honest about RAG's limitations. It's not just about the context window constraints, though that's certainly part of it. Every time I implement RAG, I find myself wrestling with the same challenges: the computational overhead of repeated retrievals, the awkward separation between retrieval and generation, and the constant struggle to maintain coherent information synthesis across multiple queries.

These aren't just technical inconveniences - they're signs pointing to a deeper architectural limitation. It's like we're trying to force a rigid, mechanical process onto something that should be organic and fluid, more like how our minds naturally work with information.


A Different Way Forward

The architecture I'm envisioning is different. Instead of the traditional RAG approach, imagine a hierarchy of specialized agents, each with its own focus and capabilities. At the top, we have coordinator agents orchestrating the flow of information. Below them, multiple processing branches handle different aspects of the content, working in parallel, sharing insights, and building a more comprehensive understanding.

This isn't just theoretical - I've been experimenting with early implementations, and while they're still rough around the edges, the potential is exciting. The system can dynamically allocate resources, spawn new processing branches when needed, and synthesize information across multiple domains without the artificial constraints of a single context window.


The Technical Heart

At its core, this architecture operates on three simple principles: hierarchy, autonomy, and synthesis. The coordinator agents act like project managers, deciding how to break down complex tasks and distribute them across the system. The processing branches are the specialists, each focusing on their particular domain but maintaining communication with their peers.

What makes this different from existing approaches is its fluidity. Unlike traditional RAG or even Mixture of Experts systems, this architecture can reshape itself based on the task at hand. It's like having a team that can reorganize itself on the fly, bringing in exactly the expertise needed for each situation.


Implementation Realities

I won't pretend this is easy to implement. The challenges are significant: managing coordination overhead, maintaining consistency across distributed states, and optimizing resource allocation. In my early experiments, I've hit numerous roadblocks and had to rethink several aspects of the design.

But here's what keeps me going: working with LLM, particular writing "System Messages" for AI Agents has opened my eyes to an entirely new programming paradigm. Every time I can squeeze in some time to work on this project, I discover new ways of thinking about and approaching problems. It's like learning to program all over again, but with different rules and possibilities. Each interaction with the system teaches me something new about how we might structure AI systems in the future.


Looking Forward

As I continue to work on this concept, I'm increasingly convinced that this approach, or something like it, represents the future of how we'll handle large-scale information processing in AI systems. The economics are trending in our favor - computational costs are decreasing, and the need for more sophisticated information processing is only growing.

I'm sharing these ideas not because I have all the answers - far from it. I'm sharing them because I believe this is a conversation worth having in our community. Maybe you see flaws in my thinking, or perhaps you have insights that could help refine these concepts further. Either way, I'm excited to hear your thoughts.


The Path Ahead

What excites me most about this architectural approach is not just its technical potential but its alignment with how we naturally process information. As I continue to develop and refine these ideas, I'm increasingly convinced that the future of AI lies not in forcing our existing paradigms to scale, but in rethinking our fundamental approaches to match the natural flow of information processing.

I'm well aware that what I'm proposing here might seem overly ambitious, or perhaps even impractical given current constraints. But I believe that's exactly why we need to start thinking about it now. The limitations of current RAG implementations aren't going away, but both the demands and capabilities of our AI systems are only increasing.

As we look to the future, I see this hierarchical agent architecture not as a replacement for RAG, but as its evolution - the next step in our journey toward more capable, more efficient AI systems. It's a journey I'm excited to be part of, and one I hope others will join.

I'd love to hear your thoughts on this architectural approach. Have you encountered similar challenges with RAG? How do you see the future of information processing in AI systems?

I'm preparing a follow-up article diving into the economic implications of this architectural shift. We'll explore how decreasing computational costs and increasing model capabilities might make this approach not just technically feasible, but economically inevitable. 

I'm particularly interested in your thoughts on this economic angle - what factors do you think will drive or hinder adoption of more sophisticated architectures?

Alternatively I can go deeper into the architecture that I present above, if there is interest.

 Let me know your insights, as they will help shape the discussion.

Wednesday, August 16, 2023

Birth of a Ninjeneer: Tracing an Unexpected Phenomenon



A months ago, in the process of writing about DevOps and how it can optimize organizations, I experienced a spark of inspiration that seemed to come from nowhere. Out of that unexpected moment, a new idea was born - the #Ninjeneer. I had a hunch, a feeling deep within that there was a missing link in the way engineers could contribute to transforming organizations. It was from this idea that the Ninjeneer emerged - an engineer with a ninja's subtle strength, initiating bottom-up changes and nudging their companies toward growth and efficiency.

I was initially uncertain about this concept. It was something new, something different. But as I put my thoughts into words and shared them with the world, I was taken aback by the response. My colleages and friends not only understood but also resonated with this new concept. Their positive feedback was inspiring, spurring me to explore this idea further.

As I ventured deeper into the Ninjeneer's realm, each discovery led to another, like an intricate web of ideas forming a coherent, fascinating narrative. Today, I am writing my tenth post about the Ninjeneer, which I had not anticipated when I first introduced the concept. The metaphor of the Ninjeneer has proven more fascinating and rewarding than I had ever imagined. It has not only offered insights into how engineers can stealthily inspire change but also influenced how they view their careers, personal growth, and the world around them.

Below, I've compiled a series of articles that trace this remarkable journey, along with summaries that reflect my thoughts and intentions when I wrote them. Join me in retracing the footsteps of this unexpected journey into the world of the Ninjeneer.

I'm Not a DevOps Guy, But Here's How You Can Optimize Your Company
When I penned this article, I found myself diving into DevOps territory despite not being a specialist myself. My main aim was to outline ways an organization could enhance its efficiency using DevOps principles. I suggested steps like identifying and rectifying process inefficiencies, fostering cross-functional collaboration, creating department-specific roadmaps, empowering employees, and fostering a culture of transparency and continuous improvement. The process required reassessing the company structure. As I hoped, implementing these steps led to improved performance and a more engaged workforce.

The Rise of the Ninjeneer: How Engineers Can Transform Companies from the Bottom Up
As a follow-up to the previous article, I introduced the concept of "Ninjeneer". When I wrote it, I had in mind an engineer who could instigate bottom-up change in a subtle yet effective manner. I hoped to present strategies for becoming a Ninjeneer, such as harnessing and sharing technical expertise, advocating for manageable changes, leading by example, and building inter-departmental relationships. Reflecting on my writings, it was fulfilling to see the Ninjeneer concept encouraging efficiency, agility, and personal professional growth within organizations.

All Software is Garbage! Transforming Chaos into Order with the Ninjeneer Mindset
When I ventured further into the "Ninjeneer" concept, I was both surprised and inspired by the concept's reception. The Ninjeneer was envisaged as an engineer fostering ground-up changes within their organization, and the central mindset was accepting software's inherent flaws - not to foster negativity, but to spur continuous improvement. As I developed this idea, it became clear that the Ninjeneer's journey was one of continuous learning, collaboration, and compassion towards colleagues. The affirmation from my readers encouraged me to delve deeper into the concept.

"If You Build It, They Will Run": The Ninjeneer's Field of Dreams
With this piece, I used the movie "Field of Dreams" as an analogy to describe the Ninjeneer's mindset. I wanted to stress the importance of creating valuable tools and initiatives, even if recognition might not be immediate. I illustrated this through the configuration of a personal Raspberry Pi as a GitLab runner. When I first wrote it, I believed in the Ninjeneer's ability to transform the mundane into the magical. The idea was to foster improvement in professional environments and, surprisingly, it extended to all aspects of work life, making significant contributions to team and organizational success.

Stealth Productivity: The Ninjeneer's Secret to Optimal Performance in the Tech Industry
In this article, I was interested in exploring unconventional productivity within the tech industry, which I referred to as the "Ninjeneer way". The Ninjeneer way stressed on quiet, stealth-like productivity that was about delivering quality results rather than seeming perpetually busy. When I initially crafted this piece, I hoped to illustrate how strategic disengagement could actually enhance productivity. The concept of "covert resilience" was an antidote to burnout, promoting efficient work, purposeful behavior, and resilience against high-performance pressures.

Mastering the Art of the Stealthy Exit: How a Ninjeneer Rises Through Ranks
As I penned the story of Toshiro, our fictional Ninjeneer, I wanted to illustrate how career advancement could be navigated in a unique, stealthy way. The article follows Toshiro's journey as he seeks new challenges, prepares for a smooth transition, and leaves a lasting impact on his former team. When I look back, I can see that the intention was to shed light on how Ninjeneers embark on their stealthy exodus to grow, learn, and take on new challenges.

The Power of Self-Upgrade: How Ninjeneers Continually Evolve
When I wrote this article, I wanted to delve into the self-improvement journey of a Ninjeneer. This process starts with identifying blind spots, overcoming detrimental habits, and leveraging psychological tricks like habit stacking and the two-minute rule for self-improvement. The process of self-upgrade isn't about reaching perfection; it's about constant evolution. As I reflect on this piece, I appreciate the notion that the journey of self-improvement doesn't stop with oneself; it extends to our entire team.

Subjugated by Silicon? How Ninjeneers Turn AI Threat into Opportunity
Looking into the near-future of every engineer and AI, I approached AI-induced job losses as an opportunity for engineers, especially Ninjeneers, to adapt and evolve. When I wrote this piece, I believed in a future where AI augments our roles and liberates us from mundane tasks. The Ninjeneer perspective encourages harnessing AI not just to redefine work but to reimagine our purpose, aiming for fulfillment rather than efficiency in an AI-infused future.(This was a follow-up to Subjugated by Silicon: Will Machines Dictate or Rekindle Our Purpose?)

Shattering the Status Quo: The Ninjeneer’s Guide to Provocative Transformation
In my latest article, I re-examined the Ninjeneer's potential for driving transformation within organizations. At the time, I perceived progress as a compound effect rather than a linear process, with each improvement serving as a building block for the next. My intention was to inspire readers to be patient and persistent, acknowledging that significant changes take time and small daily improvements can result in substantial changes over time. Looking back, I can see how the Ninjeneer approach can drive impactful change in both professional and personal realms.


As we look back at the journey of the Ninjeneer, several key concepts emerge that have shaped this narrative and captured our imagination. These concepts form the essence of the Ninjeneer mindset and offer insights into the transformative power of this unique perspective.

  • #Ninjeneer: A new kind of engineer who subtly instigates change from the ground up, fostering efficiency, agility, and personal professional growth within their organization.
  • #FlawedPerfection: The understanding that all software is flawed, not as a negative aspect, but as a driver for continuous improvement and resilience.
  • Field of Dreams: The faith in the impact of one's work, often implemented behind the scenes, with the belief that users will eventually appreciate and adopt these innovations.
  • #StealthProductivity: An unassuming, effective work style that prioritizes key tasks, reduces unnecessary distractions, and focuses on delivering quality results while maintaining mental health.
  • #InvisibleBalance: A harmonious integration of work and life that promotes sustained productivity and reduces the risk of burnout.
  • #StealthyExodus: A unique, non-disruptive approach to career advancement that leaves a lasting positive impact on former teams.
  • #SelfUpgrade: The relentless pursuit of personal and professional growth through identifying and overcoming weaknesses, forming beneficial habits, and continually learning.
  • #AugmentedFuture: An optimistic vision of AI enhancing our capabilities, freeing us from mundane tasks, and fostering self-expression and growth.
  • #ProvocativeTransformation: The continuous, incremental improvement approach that drives significant change over time, both within organizations and individuals' lives.

These concepts result from my explorations and underscore the transformative journey of the Ninjeneer. It has grown from an unexpected idea to a powerful metaphor for change, growth, and resilience in the world of engineering and beyond. The journey has been as rewarding as it has been enlightening. I think I will delve deeper into the Ninjeneer's world. Looking forward to unearthing more insights into this fascinating narrative.

Please comment and share, any thoughts on where I should drive this concept in the future?

Monday, July 17, 2023

Shattering the Status Quo: The Ninjeneer’s Guide to Provocative Transformation


Unleashing transformation within an organization takes a blend of strategy, agility, and creativity. A familiar character from our previous articles has exhibited these qualities and more - the Ninjeneer. Today, we delve deeper into the world of the Ninjeneer, a figure who truly understands the power of continuous, incremental improvements and the immense possibilities they unlock.

"Ninjeneer", a term merging "Ninja" and "Engineer", represents a unique kind of engineer. Much like the stealthy and adaptable ninjas from the annals of history, the Ninjeneer orchestrates influential, bottom-up transformations within their organization. They understand that the journey to significant change isn't about making giant leaps but is, instead, a process of consistent, incremental improvements.

One of the key misconceptions the Ninjeneer works to correct is the understanding of progress. Many perceive it as a linear process – a series of ones adding up to a sum (1+1+1+1+1=5). But the Ninjeneer knows better. They see that each improvement doesn't exist in isolation; instead, it's a building block that enables the next improvement, leading to a compounding effect (1+2+3+4+5=15). Each change catalyzes the next, creating a cascade of positive impact across the organization and in their professional lives.

The Ninjeneer's approach to continuous improvement is not a series of steps but an instinctive part of their workflow. Their strategic foresight enables them to foresee the ripple effect of each enhancement and build momentum from a solid, optimized foundation.

This continuous and instinctive improvement is not limited to their professional lives. The Ninjeneer understands that this approach can unlock powerful changes in all aspects of life, leading to personal growth, improved relationships, and better quality of life. They know that the cumulative power of small, daily improvements can lead to truly transformational change.

In the world of Ninjeneering, continuous improvement is not just a tool but a mindset. The Ninjeneer is always seeking the next opportunity for enhancement, constantly pushing boundaries and innovating. Their ability to see the potential in each small improvement is what sets them apart, enabling them to drive lasting change that benefits both their organization and themselves.

So, how can you embrace the spirit of the Ninjeneer? Here are three crucial steps to consider:

Be Patient and Persistent: The Ninjeneer’s journey is characterized by patience and persistence. Just as the nimble Ninja waits for the perfect moment to strike, the Ninjeneer understands that significant transformations take time. The process of continuous improvement is not about instant gratification; instead, it's about the steady accumulation of benefits from each small enhancement. Remember, the compounding effect of these improvements takes time to materialize. Persistence is key, for every day brings new opportunities for optimization and innovation.

Enjoy the Small Wins: The Ninjeneer knows how to relish each minor victory. Each small win represents a step forward, a testament to your continuous improvement journey. It's about appreciating the process as much as, if not more than, the destination. Embrace the joy that comes from noticing improvements, however small they may seem. Celebrating these moments isn’t just about acknowledgment - it's about fostering a positive mindset that cherishes the journey of continuous improvement and the compounding effect it brings.

Share the Vision: One Ninjeneer can bring about a significant change, but imagine the power of an organization filled with Ninjeneers! As a Ninjeneer, share your vision of continuous improvement with your colleagues. Enlighten them about the cumulative power of small, everyday improvements. As more people understand and adopt this philosophy, the collective impact on the organization can be profound.

The journey to becoming a Ninjeneer is one of persistence, joy, and shared vision. Each day brings a new opportunity for improvement, and each improvement is a step towards transformation. Embrace this journey, and witness the compounding power of continuous improvement. Welcome to the Ninjeneer Revolution!