Back to "使用 DISE 烹饪 (Part _4): 建筑系统来学习\ , 适应, 和进化"

This is a viewer only at the moment see the article on how this works.

To update the preview hit Ctrl-Alt-R (or ⌘-Alt-R on Mac) or Enter to refresh. The Save icon lets you save the markdown file to disk

This is a preview from the server running through my markdig pipeline

AI Architecture Bot Detection DiSE Machine Learning Systems Design

使用 DISE 烹饪 (Part _4): 建筑系统来学习\ , 适应, 和进化

Monday, 08 December 2025

大多数软件结构假设系统是静态的 .DISE假设系统还活着

注:: 这是Q"_Cooking with DiSE"}序列中的 & 4 part 的部件 < MSk1 > 请参见 部分#1, 毕业学徒,和 无法信赖的神明 本篇文章是建筑概览 -}现在我们有一个工作C# 多数是卢希德.}(机器人检测).

密钥概念@: @行为运行_. 此架构启用了一个新的类别 {-} 。 在这样的类别中, 探测器和学习系统根据所学行为模式反射路线交通的透明性\ ,} 可调适 {"} teams"}\ *,} 不是静态规则=.} YARP 网关, bots 从来没有达到您的后端@. 或者使用中间器械来建立行为路径直接进入您的应用程序层 @.

动态世界中的静态系统问题

@, 管道=, 測試@, 部署}. 所有的線性, 全部可以預料的.

但现代系统,特别是AI -+AUGNATIONE MESK2}不再像钟一样的动作 它们的行为就像生态系统

  • 攻击者进化他们的技巧
  • 用户改变行为
  • 需求随时间变化
  • 环境不断变化

静态结构可以'T 跟上. 你修补一个洞"MS K23 您调整了一个阈值,}其他的破解@.你='r 总是反应 ,从不适应.

DISE 建筑结构 (Dirreced合成进化) 将生物学家对待生物体的方式 MS K2 视为必须适应的事物 在压力下改进

核心Idea=:系统作为不断演变的生物体

传统建筑#:

flowchart LR
    B[Build] --> S[Ship] --> P[Patch] --> B

    style B stroke:#6366f1,stroke-width:2px
    style P stroke:#ef4444,stroke-width:2px

DISE 架构@: @%

flowchart LR
    P[Perceive] --> E[Evaluate] --> M[Mutate] --> S[Select] --> P

    style P stroke:#10b981,stroke-width:2px
    style M stroke:#f59e0b,stroke-width:2px
    style S stroke:#6366f1,stroke-width:2px

DISE系统有四种基本行为

-=YTET -伊甸园字幕组=- 翻译: |-----------|--------------|----------------------| | 可见 收集来自环境的信号 | 评价e -=YTET字幕组=- 翻译: | 静变 创造战略的变异 | 选择 @|# 保留有效的东西@,}丢弃了自然选择的 |

这是'的隐喻吗? . 这就是你的系统如何随着时间推移 进化出更聪明的行为

具体实例:Bot检测

多数是卢希德.}(机器人检测) 是第一个执行 DISE 原则的 C#}Let' 200)}追踪架构=:}

黑板结构

该系统使用 黑黑板管弦盘 “-”探测器为共享的状态提供了证据。“,”触发了其他检测器,作为信号积累 ‘:’

// Detectors emit contributions (evidence), not verdicts
public sealed record DetectionContribution
{
    public required string DetectorName { get; init; }
    public required string Category { get; init; }

    // Positive = bot signal, Negative = human signal
    public required double ConfidenceDelta { get; init; }
    public double Weight { get; init; } = 1.0;

    public required string Reason { get; init; }
    public BotType? BotType { get; init; }

    // Signals for triggering other detectors
    public ImmutableDictionary<string, object> Signals { get; init; }
}

多探测器运行 在平行波浪中系统透过许多透镜观察环境,

// Wave 0: All detectors with no trigger conditions run in parallel
// Wave N: Detectors whose triggers are now satisfied run in parallel
while (waveNumber < MaxWaves && !cancellationToken.IsCancellationRequested)
{
    var readyDetectors = availableDetectors
        .Where(d => !ranDetectors.Contains(d.Name))
        .Where(d => CanRun(d, state.Signals))
        .ToList();

    await ExecuteWaveAsync(readyDetectors, state, aggregator, ...);

    // Check for early exit on high confidence
    if (aggregator.ShouldEarlyExit)
        break;
}

与小类的加权共识

证据集成到一个决定中,使用Sigmoid变形@-}这恰当地利用了来自高Q-重量探测器的强烈信号 *:

private (double botProbability, double confidence) CalculateWeightedScore()
{
    var weighted = _contributions
        .Where(c => c.Weight > 0)
        .Select(c => (delta: c.ConfidenceDelta, weight: c.Weight))
        .ToList();

    var weightedSum = weighted.Sum(w => w.delta * w.weight);

    // Sigmoid maps any real number to (0, 1)
    // Strong human signal (-3) → ~5% bot probability
    // Neutral (0) → 50% bot probability
    // Strong bot signal (+3) → ~95% bot probability
    var botProbability = 1.0 / (1.0 + Math.Exp(-weightedSum));

    return (botProbability, confidence);
}

评估是一个单一的模型 做出一个决定 加权协商一致意见 在 AI has ' t运行@,}的情况下, 概率是 粘结 避免过度自信

// CRITICAL: Clamp probability when AI hasn't run
var botProbability = aiRan
    ? rawBotProbability
    : Math.Clamp(rawBotProbability, 0.20, 0.80);

早期退出@:_}快速路径优化

当早期证据被确定为“,”时, 系统总是运行所有检测器@.}它退出快速Q:}

// Early exit on verified bots (good or bad)
public static DetectionContribution VerifiedGoodBot(
    string detector, string botName, string reason) => new()
{
    DetectorName = detector,
    Category = "Verification",
    ConfidenceDelta = 0,
    TriggerEarlyExit = true,
    EarlyExitVerdict = EarlyExitVerdict.VerifiedGoodBot
};

在生产过程中 , 高端-- 信任请求退出@ 10%s 仅仅在“2-3”检测器同意后, “.”表示完全输油管只能用于不确定的病例 ‘.’

电路断路器@: @ self# -_ 治疗

检测器可能失败 . 系统保护自己

// Circuit breaker per detector
private void RecordFailure(string detectorName)
{
    var state = _circuitStates.GetOrAdd(detectorName, _ => new CircuitState());
    state.FailureCount++;
    state.LastFailure = DateTimeOffset.UtcNow;

    if (state.FailureCount >= CircuitBreakerThreshold)
    {
        state.State = CircuitBreakerState.Open;
        // Detector disabled until reset time passes
    }
}

失灵探测器被暂时禁用@. @% 在冷却后 @ , @ @ 它们 @ MOSK2_ 重新试过 @ MPK3\ half@ -open state@ MS K5} 基础设施一级选择压力.

学习系统

当系统以高置信度探测到时 @, @ it 学习 通过向学习活动发布 usa_:

private void PublishLearningEvent(AggregatedEvidence result, ...)
{
    var eventType = result.BotProbability >= 0.8
        ? LearningEventType.HighConfidenceDetection
        : LearningEventType.FullDetection;

    _learningBus.TryPublish(new LearningEvent
    {
        Type = eventType,
        Confidence = result.Confidence,
        Label = result.BotProbability >= 0.5,
        Metadata = new Dictionary<string, object>
        {
            ["botProbability"] = result.BotProbability,
            ["categoryBreakdown"] = result.CategoryBreakdown,
            ["contributingDetectors"] = result.ContributingDetectors
        }
    });
}

这将输入重量存储@ , @ 更新日光检测器} @ MS K1_ 学习时间的加权数=.

认知堆叠

DISE 使用层形认知@: @%

flowchart TB
    subgraph Fast["Fast Path (< 100ms)"]
        H[Static Heuristics]
        D[Detectors]
        ML[Learned Heuristic Model]
    end

    subgraph Slow["Slow Path (Async)"]
        LLM[Ollama LLM]
    end

    subgraph Learn["Learning Layer"]
        W[Weight Store]
        Rep[Reputation]
    end

    Fast --> |escalate uncertain| Slow
    Slow --> |label| Learn
    Learn --> |update weights| Fast

    style Fast stroke:#10b981,stroke-width:2px
    style Slow stroke:#6366f1,stroke-width:2px
    style Learn stroke:#f59e0b,stroke-width:2px
“ ”层“ ”速度“MS K2”目的“ ”博特探测示例“ ”
静态体素 @ @ @ <1 @%s @ I @ inspiritive回应@ _ 已知的UA模式 @MS K4#
探测器 头分析@,IP检查 @
总结经验 * 1-5 * 动态分类 MS K3 物流回归 学习重量
法学硕士 深入推理 分析新模式
学习学习学习 “ 背景”“ 记忆形成 ” @ 体重更新“MS K3 名声的改变”+

系统以真实的-time学习自己的重量。 没有外部 ML 模型需要.} 超常检测器从明智的默认开始, 根据探测反馈来进化@.}

未来: 计划用RAG和嵌入的ONNX模型为 v2.}规划目前的超光速模型='*%s 输出作为未来示范培训标记的培训数据@.}这个架构已经拥有了 “"”+Qgenetic"}(_Presidings\ @,}重量>,}信号{)}能够添加直接合成进化直截指 [-}It'}设计成插件点=MS K11}

此镜像为生物认知@ : @

  • 原生免疫系统 → 静态牛皮
  • 适应性免疫系统 → 学习超常模式
  • 内存单元格 → 重量商店 + 声誉

无外部模型学习

系统不是用外部ML模型,, 而是使用简单的后勤回归和动态特征提取来学习自己的分类器

public class HeuristicDetector : IDetector
{
    // Default weights - sensible starting points
    private static readonly Dictionary<string, float> DefaultWeights = new()
    {
        // Human-like patterns (negative = more likely human)
        ["hdr:accept-language"] = -0.6f,
        ["hdr:referer"] = -0.4f,
        ["fp:received"] = -0.7f,      // Fingerprint = strong human signal
        ["fp:legitimate"] = -0.8f,

        // Bot indicators (positive = more likely bot)
        ["ua:contains_bot"] = 0.9f,
        ["ua:headless"] = 0.8f,
        ["ua:selenium"] = 0.7f,
        ["ua:curl"] = 0.6f,
        ["accept:wildcard"] = 0.4f,
    };

    private (bool IsBot, double Probability) RunInference(Dictionary<string, float> features)
    {
        // Simple linear model: score = bias + Σ(feature * weight)
        float score = _bias;

        foreach (var (featureName, featureValue) in features)
        {
            var weight = _weights.TryGetValue(featureName, out var w)
                ? w
                : DefaultNewFeatureWeight;
            score += featureValue * weight;
        }

        // Sigmoid gives us probability
        var probability = 1.0 / (1.0 + Math.Exp(-score));
        return (probability > 0.5, probability);
    }
}

从请求和汇总证据中动态地提取特征@:

public static class HeuristicFeatureExtractor
{
    public static Dictionary<string, float> ExtractFeatures(
        HttpContext context,
        AggregatedEvidence evidence)
    {
        var features = new Dictionary<string, float>();

        // Request metadata
        features["req:header_count"] = Math.Min(headers.Count / 20f, 1f);
        features["req:cookie_count"] = Math.Min(cookies.Count / 10f, 1f);

        // Header presence
        features["hdr:accept-language"] = headers.ContainsKey("Accept-Language") ? 1f : 0f;

        // UA patterns (dynamic - only present if detected)
        if (ua.Contains("bot")) features["ua:contains_bot"] = 1f;
        if (ua.Contains("selenium")) features["ua:selenium"] = 1f;

        // Detector results (named by actual detector)
        foreach (var contrib in evidence.Contributions)
            features[$"det:{contrib.DetectorName}"] = contrib.ConfidenceDelta;

        // Client-side fingerprint - STRONG human signal
        if (hasFingerprint)
        {
            features["fp:received"] = 1f;
            features["fp:legitimate"] = 1f;
        }

        return features;
    }
}

新功能自动获得默认重量, 并随着时间的流逝学习@ . @ 系统会发现什么重要\ MS K1}#

体重存储@:持久性学习

SQLite 的重量长期存在, 通过指数移动平均@:更新

public class SqliteWeightStore : IWeightStore
{
    public async Task RecordObservationAsync(
        string signatureType,
        string signature,
        bool wasBot,
        double detectionConfidence,
        CancellationToken ct = default)
    {
        // EMA update: weight = weight * (1 - α) + new_value * α
        var alpha = 0.1; // Learning rate
        var weightDelta = wasBot ? detectionConfidence : -detectionConfidence;

        var sql = @"
            INSERT INTO learned_weights (signature_type, signature, weight, ...)
            VALUES (@type, @sig, @delta, ...)
            ON CONFLICT(signature_type, signature) DO UPDATE SET
                weight = weight * (1 - @alpha) + @delta * @alpha,
                confidence = MIN(1.0, confidence + @conf * 0.01),
                observation_count = observation_count + 1,
                last_seen = @now
        ";

        await ExecuteAsync(sql, ...);
    }
}

这是 通过观测突变@._ 每一次检测都教给这个系统什么的\ . 随着时间的推移#,}这些重量会趋同到适合你特定交通模式的最佳值@.

幻觉如变异

在 DISE ,LLM幻觉中, LLM 幻觉是 @'} 一个错误的 mSSK2 It' 是进化基因基数_.

高端 - 热度 LLM 提出检测规则的十种变体是 @ MS K1 @ t @ I" @ hallucinting@ "} @ MPK4 it'#s 突变基因组 :

public async Task<List<DetectionRule>> GenerateMutationsAsync(DetectionContext context)
{
    var prompt = $"""
        Given this traffic pattern:
        {JsonSerializer.Serialize(context)}

        Generate 5 variant detection rules that might catch similar patterns.
        Return JSON array of rules with: pattern, weight, confidence.
        Be creative. Some variants should be strict, some lenient.
        """;

    var response = await _ollama.GenerateAsync(new GenerateRequest
    {
        Model = "gemma3:1b",
        Prompt = prompt,
        Options = new RequestOptions { Temperature = 0.9 } // High creativity
    });

    return ParseRules(response.Response);
}

然后根据历史数据对突变进行评估 :

public async Task<DetectionRule?> SelectFittestAsync(
    List<DetectionRule> mutations,
    List<LabeledRequest> testData)
{
    var results = new List<(DetectionRule Rule, double Fitness)>();

    foreach (var rule in mutations)
    {
        var tp = testData.Count(r => rule.Matches(r) && r.IsBot);
        var fp = testData.Count(r => rule.Matches(r) && !r.IsBot);
        var fn = testData.Count(r => !rule.Matches(r) && r.IsBot);

        // F1 score as fitness
        var precision = tp / (double)(tp + fp);
        var recall = tp / (double)(tp + fn);
        var f1 = 2 * (precision * recall) / (precision + recall);

        results.Add((rule, f1));
    }

    return results.OrderByDescending(r => r.Fitness).First().Rule;
}

只有适配者才能幸存到生产..."MSMK0" 这把LLMs从易碎的聊天机变成 演进操作者.

基于配置的基因组Name

在DISE的中心是 政策系统 @ -_ 命名的配置, 可以定义检测行为@ MS K1\ {

{
  "Policies": {
    "fastpath": {
      "Description": "Fast path + Heuristic for sync decisions",
      "FastPath": ["UserAgent", "Header", "Ip", "Behavioral", "ClientSide", "Inconsistency", "VersionAge"],
      "AiPath": ["Heuristic"],
      "EscalateToAi": true,
      "EarlyExitThreshold": 0.15,
      "ImmediateBlockThreshold": 0.90,
      "Weights": {
        "ClientSide": 0.2,
        "Heuristic": 1.5
      },
      "Transitions": [
        { "WhenRiskExceeds": 0.5, "WhenRiskBelow": 0.85, "GoTo": "demo" }
      ]
    },
    "demo": {
      "Description": "Full pipeline sync for demonstration",
      "FastPath": [],
      "AiPath": [],
      "BypassTriggerConditions": true,
      "ForceSlowPath": true
    }
  }
}

政策定义#:

  • 快速帕式探测器 @ - @ 运行在平行@ MS K1 @ sub * -10 @ ms
  • AI 路径 和/或LLM (500 ms @+)
  • 阈下限 @ - 何时提前退出@ MS K1 何时屏蔽
  • 过渡 在不确定时自动升级到其他政策
  • 政策权重 - 音频检测器的重要性

该系统可以 政策之间的过渡不确定的快路结果升级为全输油管 适应性路线安排 基因组对真实证据的反应

您没有' t 船舶静态配置}. 行为物种 适应交通量的

健康功能=:}什么生存者

每个 DiSE 系统对健身环境的选择性

public class FitnessEvaluator
{
    public double Evaluate(GenomeConfig genome, EvaluationData data)
    {
        var fpRate = data.FalsePositives / (double)data.TotalHumans;
        var fnRate = data.FalseNegatives / (double)data.TotalBots;
        var latency = data.P99LatencyMs;
        var cost = data.AiCallsPerRequest * _config.CostPerAiCall;

        // Multi-objective fitness
        return 1.0
            - (fpRate * _config.FalsePositivePenalty)   // Don't block humans
            - (fnRate * _config.FalseNegativePenalty)   // Don't miss bots
            - (latency / _config.MaxLatencyMs)          // Stay fast
            - (cost / _config.MaxCostPerRequest);       // Stay cheap
    }
}

我们无法优化准确性 仅@. @ we @ '}我们无法优化 动态环境中的活性.

太多的AI → 高成本 , 对新式袭击的检测不足 愤怒的用户 @. 过于宽大 @→ @bot flood_.@%

系统必须找到稳定的平衡@. 压力驱动器进化 @.

AI 作为老师,不是工人

一个成熟的 DiSE 系统将AI从热道上移开

flowchart TB
    subgraph Early["Early Stage"]
        AI1[AI handles most cases]
    end

    subgraph Middle["Middle Stage"]
        AI2[AI handles edge cases]
        H1[Heuristics handle common cases]
    end

    subgraph Mature["Mature Stage"]
        AI3[AI teaches and mutates]
        H2[Heuristics handle almost everything]
        M[Memory provides context]
    end

    Early --> Middle --> Mature

    style Early stroke:#ef4444,stroke-width:2px
    style Middle stroke:#f59e0b,stroke-width:2px
    style Mature stroke:#10b981,stroke-width:2px

随着时间的推移,:

  • 静态探测器通过人工智能标签来改进“(” 。
  • 希力学得到更准确的(}通过健身选择)
  • 人工智能只处理新事物和突变

AY成为 :

  • 缩略 甲板 新行为
  • 缩略 发电机 突变
  • 缩略 漂流探测器
  • 缩略 师级教师 标为边际案例

适应性脚手架 . *

新类别

与 YARP 网关@,_% 此架构可促成新的@:}# 行为路线.

传统路由是静态的 @:路径\ →}后端@. 200)}行为路线是反射性的#:}交通特点 @MS K4}动态路由决定_.}

flowchart LR
    subgraph Gateway["YARP Gateway"]
        D[Detector Team]
        P[Policy Engine]
        R[Router]
    end

    Traffic[Traffic] --> D
    D --> P
    P --> R
    R -->|Human| App[Your App]
    R -->|Bot| Block[403]
    R -->|Uncertain| Challenge[Challenge]
    R -->|Learning| Queue[Async Analysis]

    style Gateway stroke:#10b981,stroke-width:2px

关键概念 @:

  • 探测器小组 “-” 一组可配置的探测器,它们一起工作“,” 可按政策调整。
  • 透明决定 “- ”每个路线决定都是可以解释的,“( ” 见捐款明细表$)
  • 弹性调整 该系统从其决定中学习,并随着时间的推移调整权重。
  • Edge- 级别保护 - bots never touch your backend@; 被路由器堵住

这不仅仅是在边缘的 "bot 检测... ...它是一个新的原始路线...

为何如此重要

多数工程文化都害怕#:

  • 非决定主义
  • 漂流
  • 变异
  • 幻觉
  • 新兴行为

DISE使用这些作为 建筑材料.

不断演变的系统生存下来 .

处理对手的每个行业 , 漂移}, 或者规模压力

  • Bot 检测
  • 欺诈引擎
  • 适应防火墙
  • LLM 生态系统
  • 自我- 优化微服务
  • 自动调试系统
  • 行为路由 根据学习模式塑造交通

什么是DISE 是'

让我说清楚,这是什么?

  • 不是"大LMS无处不在 " -=LMS 昂贵的 MSSK1}在战略上使用它们
  • 不是"" replace business 逻辑与 AY""的替代 {\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}
  • 不是",而是"系统运行" “- 进化方向”是“, 受约束的 , 受监管的 @. ”。
  • 在类固醇上不是"AUTML=" 这和行为有关 不只是模范调试

DISE 受控@, @ 解释进化@ : @

  • 受制约
  • 由明确的健身功能管理
  • 记忆@-aaware
  • 已版本
  • 安全部署

{\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF 定向 正在进化\ -\ 引导\ I,}不是随机的\ O.

试试

多数是卢希德.}(机器人检测) * 执行这些原则*

dotnet add package Mostlylucid.BotDetection
builder.Services.AddBotDetection();
app.UseBotDetection();

具有学习功能的编译配置@: @%

{
  "BotDetection": {
    "BotThreshold": 0.7,
    "Policies": {
      "default": {
        "FastPath": ["UserAgent", "Header", "Ip", "Behavioral", "ClientSide", "Inconsistency", "VersionAge"],
        "AiPath": ["Heuristic", "Llm"],
        "EscalateToAi": true,
        "EarlyExitThreshold": 0.85
      }
    },
    "AiDetection": {
      "Provider": "Heuristic",
      "Heuristic": {
        "Enabled": true,
        "LoadLearnedWeights": true,
        "EnableWeightLearning": true,
        "LearningRate": 0.01
      }
    }
  }
}

观察它的进化 . 超常检测器从每一个请求中 学习, 更新其重量以适应你的交通模式+.

结论结论

DISE 建筑是从软件作为机器向软件作为有机体的转变

这是:的架构

  • 可适应性
  • 复原力
  • 控制演变
  • 层数值
  • 记忆M-驱动的学习
  • 静音@ + @% 选中
  • 战略行为

静态结构无法跟上动态环境 @. 攻击者进化@. 用户进化. 要求进化_.

系统必须进化太快,.

如果您想要仅仅运行“,” 的系统, 请用旧的方式构建这些系统@ . @ 如果您想要系统 活下来 和Dise一起建造它们

logo

© 2026 Scott Galloway — Unlicense — All content and source code on this site is free to use, copy, modify, and sell.