NSHkr.com Security Engineering Chat

North Shore AI Ecosystem

The North Shore AI Ecosystem

A comprehensive industrial ML infrastructure built on Elixir and the BEAM platform. This ecosystem comprises 50+ libraries organized into a 7-tiered architectural model, connected by organizing metaphors that encode architectural decisions into memorable concepts.


The 7-Tiered Architectural Model

                     +------------------------------------------+
                     |        TIER 1: PUBLIC INTERFACE          |
                     |              nsai_sites                  |
                     |    (Cloudflare Workers, Edge Delivery)   |
                     +--------------------+---------------------+
                                          |
                                          v
                     +------------------------------------------+
                     |     TIER 2: GATEWAY & ORCHESTRATION      |
                     |       nsai_gateway | nsai_registry       |
                     |  (Auth, Rate Limit, Discovery, Health)   |
                     +--------------------+---------------------+
                                          |
          +-------------------------------+-------------------------------+
          |                               |                               |
          v                               v                               v
+------------------------+    +------------------------+    +------------------------+
|   TIER 3: PROCESSING   |    |   TIER 3: PROCESSING   |    |   TIER 3: PROCESSING   |
|        KITCHEN         |    |         FORGE          |    |          CNS           |
|   crucible_kitchen     |    |    forge / anvil       |    |    Dialectical AI      |
|   tinkex_cookbook      |    |    ingot / labeling_ir |    |    cns / cns_crucible  |
+------------------------+    +------------------------+    +------------------------+
          |                               |                               |
          +-------------------------------+-------------------------------+
                                          |
                                          v
                     +------------------------------------------+
                     |        TIER 4: CORE FRAMEWORK            |
                     |   crucible_framework | crucible_ir       |
                     |           crucible_bench                 |
                     | (Pipeline Orchestration, IR, Statistics) |
                     +--------------------+---------------------+
                                          |
                                          v
                     +------------------------------------------+
                     |        TIER 5: MLOPS ASSEMBLY            |
                     |  crucible_train | crucible_model_registry|
                     |  crucible_deployment | crucible_feedback |
                     |   (Train, Version, Deploy, Feedback)     |
                     +--------------------+---------------------+
                                          |
                                          v
                     +------------------------------------------+
                     |      TIER 6: RELIABILITY & SAFETY        |
                     |   LlmGuard | crucible_ensemble           |
                     |   crucible_hedging | ExFairness          |
                     |   crucible_xai | crucible_adversary      |
                     +--------------------+---------------------+
                                          |
                                          v
                     +------------------------------------------+
                     |     TIER 7: FOUNDATIONAL UTILITIES       |
                     |  tiktoken_ex | embed_ex | chz_ex         |
                     |  hf_hub_ex | hf_datasets_ex | nx_penalties|
                     +------------------------------------------+

Organizing Metaphors

Complex systems require organizing metaphors that make abstract relationships concrete. The NSAI ecosystem uses two primary metaphor families.

The Kitchen/Cookbook Metaphor (Training Infrastructure)

A professional kitchen is a carefully orchestrated environment where raw ingredients become finished dishes through standardized processes, specialized equipment, and skilled practitioners.

ConceptReal-World AnalogNSAI ComponentFunction
KitchenRestaurant kitchen facilitycrucible_kitchenBackend-agnostic ML training orchestration
CookbookStandardized recipestinkex_cookbookTraining recipes and configurations
ChefSkilled cookML PractitionerHuman expertise and judgment
Mise en PlaceIngredient preparationData preprocessingDataset staging and validation
                THE KITCHEN METAPHOR
                ====================

+------------------+     +------------------+     +------------------+
|                  |     |                  |     |                  |
|    RAW DATA      | --> |     KITCHEN      | --> |  TRAINED MODEL   |
|   (Ingredients)  |     |  (Infrastructure)|     |     (Dish)       |
|                  |     |                  |     |                  |
+------------------+     +--------+---------+     +------------------+
                                  |
                                  | uses
                                  v
                         +------------------+
                         |    COOKBOOK      |
                         |    (Recipes)     |
                         +--------+---------+
                                  |
                                  | guided by
                                  v
                         +------------------+
                         |      CHEF        |
                         |  (Practitioner)  |
                         +------------------+

The Metalworking Metaphor (Data Labeling Stack)

A blacksmith’s forge transforms raw ore into refined metal through heat, pressure, and skilled craftsmanship.

ConceptReal-World AnalogNSAI ComponentFunction
ForgeSmelting furnaceforgeDomain-agnostic sample factory
AnvilShaping surfaceanvilHuman-in-the-loop labeling and governance
IngotFinished metal productingotPhoenix LiveView labeling UI
CrucibleHigh-heat testing vesselcrucible_*ML experimentation infrastructure
                THE METALWORKING METAPHOR
                =========================

+------------------+     +------------------+     +------------------+
|    RAW DATA      | --> |      FORGE       | --> |   CANDIDATES     |
|   (Raw Ore)      |     |  (Bulk Process)  |     | (Shaped Metal)   |
+------------------+     +------------------+     +--------+---------+
                                                          |
                                                          v
+------------------+     +------------------+     +------------------+
|  LABELED DATA    | <-- |      ANVIL       | <-- |   CANDIDATES     |
|    (Refined)     |     | (Human Review)   |     |   (Queue)        |
+------------------+     +------------------+     +------------------+
        |
        |  displayed via
        v
+------------------+
|      INGOT       |
|    (UI Layer)    |
+------------------+

Portfolio RAG Ecosystem

Hexagonal architecture (ports and adapters) for Retrieval-Augmented Generation systems.

                       PORTFOLIO ECOSYSTEM ARCHITECTURE
========================================================================

                       +---------------------------+
                       |    portfolio_manager      |
                       |    (Application Layer)    |
                       |  CLI, Multi-Provider,     |
                       |  Pipeline Orchestration   |
                       +-------------+-------------+
                                     |
                                     | uses
                                     v
                       +---------------------------+
                       |    portfolio_index        |
                       |  (Implementation Layer)   |
                       |  Adapters, Broadway,      |
                       |  RAG Strategies           |
                       +-------------+-------------+
                                     |
                                     | implements
                                     v
+-----------------------------------------------------------------------+
|                        portfolio_core                                  |
|                      (Foundation Layer)                                |
|                                                                        |
|  +------------+  +------------+  +------------+  +------------+        |
|  | VectorStore|  | GraphStore |  |  Embedder  |  |    LLM     |        |
|  |    Port    |  |    Port    |  |    Port    |  |    Port    |        |
|  +------------+  +------------+  +------------+  +------------+        |
|                                                                        |
|  +---------------------------------------------------+                 |
|  |           ETS-backed Adapter Registry             |                 |
|  +---------------------------------------------------+                 |
+-----------------------------------------------------------------------+
                                     |
                                     | domain-specific
                                     v
                       +---------------------------+
                       |    portfolio_coder        |
                       |    (Domain Layer)         |
                       |  Code Intelligence,       |
                       |  Multi-Language Support   |
                       +---------------------------+

Stack Components

ComponentVersionDescription
portfolio_corev0.3.016 Port Specifications, ETS Registry, Manifest Engine
portfolio_indexv0.2.0Pgvector, Neo4j adapters, Broadway pipelines, RAG strategies
portfolio_managerv0.3.0CLI, multi-provider routing, agents, evaluation framework
portfolio_coderv0.1.0Code intelligence platform, multi-language AST analysis

16 Port Specifications

Storage Ports: VectorStore, GraphStore, Cache

Processing Ports: Embedder, Chunker, Retriever, Reranker

Generation Ports: LLM, Router

Orchestration Ports: Pipeline, Agent, Tool

Quality Ports: Evaluation

RAG Strategies

StrategyDescription
Hybrid (RRF)Reciprocal Rank Fusion of dense and sparse retrieval
Self-RAGModel decides when to retrieve, critiques its own generations
GraphRAGGraph traversal for entity-centric retrieval
AgenticAgent-driven retrieval with tool use

Orchestration Frameworks

flowstone (v0.5.2) - Asset-First Data Orchestration

Flowstone treats data assets as first-class citizens. The scheduler derives execution plans from asset dependencies. Materialization is incremental: only stale assets are recomputed.

Core Concepts:

  • Assets: Named data artifacts with materialization functions
  • I/O Managers: Storage abstraction (Memory, Postgres, S3, Parquet)
  • Lineage Tracking: Records which upstream assets contributed to each downstream asset
  • Partition-Aware Execution: Only stale partitions are recomputed

Execution Patterns: Scatter/Gather, Signal Gates, Approval Gates, Conditional Branches

synapse (v0.1.1) - Headless Multi-Agent Orchestration

Synapse provides declarative multi-agent systems with a domain-agnostic signal bus and durable workflows persisted to Postgres.

Core Components:

  • Signal Bus: Pub/sub for agent communication with persistence
  • Workflow Engine: FSM state management with checkpointing
  • Agent Definition: Declarative specification of subscriptions and emissions
  • LLM Gateway: Unified interface for OpenAI, Anthropic, Gemini
    Framework Comparison
    ====================

    | Aspect              | flowstone                      | synapse                         |
    |---------------------|--------------------------------|---------------------------------|
    | Primary abstraction | Data assets                    | Agents and signals              |
    | Execution model     | Pull (materialize what's needed)| Push (react to signals)        |
    | Typical latency     | Seconds to hours (batch)       | Milliseconds to minutes         |
    | Use case            | Data pipelines, ETL            | Multi-agent coordination        |

CNS Dialectical Reasoning

Chiral Narrative Synthesis implements dialectical reasoning where claims are systematically challenged, contradictions are surfaced, and resolutions are synthesized through evidence-guided critique.

The Dialectical Flow

+------------------+         +------------------+         +------------------+
|     PROPOSER     | ------> |    ANTAGONIST    | ------> |   SYNTHESIZER    |
|    (Thesis)      |         |   (Antithesis)   |         |   (Synthesis)    |
+--------+---------+         +--------+---------+         +--------+---------+
         |                            |                            |
         v                            v                            v
+------------------+         +------------------+         +------------------+
|  Extract SNOs    |         | Flag Contra-     |         | Resolve with     |
|  (claims +       |         | dictions         |         | Evidence         |
|   evidence)      |         | (B1 gaps,        |         | (critic-guided)  |
|                  |         |  chirality)      |         |                  |
+------------------+         +------------------+         +------------------+

Agents

AgentRoleResponsibilities
ProposerThesis GeneratorClaim extraction, evidence linking, SNO graph construction
AntagonistAntithesis GeneratorContradiction detection, B1 gap identification, chirality analysis
SynthesizerResolution GeneratorClaim reconciliation, evidence weighting, critic-guided resolution

The Critic Ensemble

Five specialized critics evaluate different dimensions of reasoning quality:

CriticCore QuestionChecks
GroundingAre claims supported by cited evidence?Citation accuracy, evidence-claim alignment
LogicIs the reasoning chain valid?Syllogistic validity, fallacy detection
NoveltyDoes this add new information?Semantic novelty, redundancy detection
BiasIs the reasoning systematically skewed?Evidence selection balance, framing analysis
CausalAre causal claims justified?Correlation vs causation, confounder identification

Key Concepts

B1 Gaps (Betti-1 Gaps): Holes in the argument structure detected through topological analysis. The first Betti number counts one-dimensional holes; applied to argument graphs, B1 gaps indicate missing inferential steps.

Chirality: Asymmetric perspective in reasoning. A chiral argument looks different when viewed from opposing positions, revealing implicit framing choices.


Crucible Reliability Stack

Core Framework (Tier 4)

ComponentPurpose
crucible_frameworkML experimentation orchestration, pipeline runner, stage definitions
crucible_irIntermediate representation for ML pipelines
crucible_benchStatistical testing (t-tests, ANOVA, effect sizes, power analysis)

MLOps Assembly (Tier 5)

ComponentPurpose
crucible_trainUnified ML training (supervised, RL, DPO, distillation)
crucible_model_registryModel versioning, artifact storage (S3/HF/local)
crucible_deploymentModel deployment (vLLM/Ollama/TGI/K8s), canary rollouts
crucible_feedbackProduction feedback, drift detection, active learning

Reliability & Safety (Tier 6)

ComponentPurpose
LlmGuardAI firewall - prompt injection, jailbreak, data leakage detection
crucible_ensembleMulti-model voting (majority, weighted, ranked-choice)
crucible_hedgingRequest hedging (fixed, adaptive, percentile, workload-aware)
crucible_adversaryAdversarial testing - attacks, perturbations, defenses
ExFairnessBias detection and mitigation
crucible_xaiExplainable AI - LIME, SHAP, PDP/ICE
ExDataCheckData validation with 34 expectation types

Foundational Utilities (Tier 7)

ComponentPurpose
tiktoken_exPure Elixir BPE tokenizer (Kimi K2 compatible)
embed_exVector embeddings with multiple providers
chz_exConfiguration management with CLI parsing
hf_hub_exHuggingFace Hub API client
hf_datasets_exNative HuggingFace Datasets port for Elixir
nx_penaltiesComposable regularization penalties for Nx

NSAI Sites

DomainPurpose
nsai.onlineCorporate presence
nsai.storeMarketplace
nsai.spaceResearch documentation

GitHub Organizations


Key Patterns

  • Stages: Composable pipeline steps implementing Crucible.Stage behaviour
  • Adapters: Pluggable backends (TDA, fairness, analysis) with noop fallbacks
  • LiveView: Real-time dashboards with PubSub integration
  • Telemetry: Event-driven metrics collection across all projects
  • IR Structs: Shared intermediate representation structs across related projects

Tech Stack

Languages: Elixir, Erlang, Python, Rust

Frameworks: Phoenix, OTP, FastAPI

Platforms: BEAM VM, AWS, GCP, Cloudflare Workers

Focus Areas:

  • Distributed systems and fault tolerance
  • AI/LLM infrastructure and reliability
  • Functional programming and metaprogramming
  • Statistical analysis and experimental design
Type your message here...