<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 侯惠阳</title>
    <description>The latest articles on DEV Community by 侯惠阳 (@_b6417cbb54ddfef4c4fd0).</description>
    <link>https://dev.to/_b6417cbb54ddfef4c4fd0</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4081081%2F7983cfcd-eb29-49e0-9ea3-bae6ad7c797a.png</url>
      <title>DEV Community: 侯惠阳</title>
      <link>https://dev.to/_b6417cbb54ddfef4c4fd0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/_b6417cbb54ddfef4c4fd0"/>
    <language>en</language>
    <item>
      <title>Building Production Intelligent Risk Control: Streaming, Lakehouse, Rules, and Models</title>
      <dc:creator>侯惠阳</dc:creator>
      <pubDate>Sun, 23 Aug 2026 01:30:00 +0000</pubDate>
      <link>https://dev.to/_b6417cbb54ddfef4c4fd0/building-production-intelligent-risk-control-streaming-lakehouse-rules-and-models-2e9i</link>
      <guid>https://dev.to/_b6417cbb54ddfef4c4fd0/building-production-intelligent-risk-control-streaming-lakehouse-rules-and-models-2e9i</guid>
      <description>&lt;p&gt;The hardest part of risk control is not expressing a rule such as “five failed logins from one device in ten minutes.” It is making a stable, explainable, and traceable decision when events arrive out of order, messages repeat, services fail, strategies change, and traffic peaks at the same time.&lt;/p&gt;

&lt;p&gt;A mature system must answer four questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Should this request proceed now?&lt;/strong&gt; Payments, logins, and withdrawals often need a response in milliseconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What has happened recently?&lt;/strong&gt; Has an account, device, or network shown a burst, cluster, or behavioral shift?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What does history tell us?&lt;/strong&gt; Can offline data produce reliable baselines, labels, profiles, and training examples?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why was this decision made?&lt;/strong&gt; Can we reconstruct the events, features, rules, and model versions used?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Production risk control is therefore neither one Spark job nor one rule repository. It is a decision system composed of synchronous serving, asynchronous stream processing, an offline lakehouse, strategy operations, and a feedback loop.&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture: two paths, one fact history, full replay
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fproduction-risk-control-system%2Farchitecture-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fproduction-risk-control-system%2Farchitecture-en.svg" alt="Production real-time and offline risk architecture" width="1200" height="720"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The key separation is between synchronous interception and real-time computation:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Synchronous online path:&lt;/strong&gt; a Risk API reads online features, evaluates rules and models, and returns allow, deny, or review within a strict latency budget.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Asynchronous streaming path:&lt;/strong&gt; business events enter Kafka; Spark Structured Streaming performs event-time deduplication, sliding windows, stateful aggregation, and feature updates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Offline batch path:&lt;/strong&gt; immutable facts land in a lakehouse on HDFS or object storage; Spark Batch handles replay, reconciliation, backfill, rule simulation, and model datasets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unified strategy and audit:&lt;/strong&gt; features, rules, models, and decision records are versioned so an online outcome can be reproduced offline.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is safer than blocking every business request on Spark. Structured Streaming normally executes in micro-batches and is well suited to second-level state updates. A transaction requiring consistently low tens-of-milliseconds latency needs an independently deployed serving path so scheduler delays, backpressure, or checkpoint pauses cannot enter the critical request path.&lt;/p&gt;

&lt;h2&gt;
  
  
  Establish an immutable risk fact stream
&lt;/h2&gt;

&lt;p&gt;Kafka should be treated as a durable risk event log, not temporary plumbing. Payments, logins, devices, account changes, list updates, and investigation outcomes become governed events.&lt;/p&gt;

&lt;p&gt;Every event should contain at least:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;event_id          globally unique identity for deduplication and tracing
event_type        business meaning and semantic version
event_time        when the business event actually occurred
ingest_time       when the platform received it
entity_keys       user_id / account_id / device_id / ip
payload           facts rather than transient computed judgments
trace_id          correlation across request, stream, and decision
schema_version    compatible evolution
source            producing system and environment
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Design topics around business facts and retention requirements, not one topic per rule. A partition key should match the stateful computation: &lt;code&gt;account_id&lt;/code&gt; preserves account order, while network detection may require &lt;code&gt;device_id&lt;/code&gt;. Derive separately keyed streams rather than expecting one key to serve every use case.&lt;/p&gt;

&lt;p&gt;Use idempotent producers, strong acknowledgements, and governed Avro, Protobuf, or JSON Schema. Consumers still require idempotency because end-to-end exactly-once behavior depends on the external sink. A practical system target is &lt;strong&gt;at-least-once transport + business-key deduplication + idempotent writes + reconciliation and replay&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Do not poll operational databases aggressively. Capture account state, lists, and merchant reference data through log-based CDC. When a database update and a domain event must agree, use a Transactional Outbox to avoid the dual-write gap between committing data and publishing a message.&lt;/p&gt;

&lt;h2&gt;
  
  
  Define sliding windows in event time
&lt;/h2&gt;

&lt;p&gt;Risk windows must use &lt;code&gt;event_time&lt;/code&gt;, not the time Spark happens to process a record. Mobile disconnection, network delay, and Kafka backlog cause disorder; processing-time logic can produce different outcomes for the same facts after a restart.&lt;/p&gt;

&lt;p&gt;Common windows include:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1-minute window sliding every 10 seconds: transaction burst
10-minute window sliding every minute: failures and amount velocity
24-hour window sliding every 15 minutes: accounts per device
7-day state: new beneficiary, familiar geography, behavioral baseline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Window length expresses observation range; slide interval expresses update frequency. Smaller slides increase state and compute cost. Derive them from the maximum acceptable detection delay rather than setting every feature to one second.&lt;/p&gt;

&lt;p&gt;A watermark says how long the system is willing to wait for late data and when it may clear state. It does not guarantee that all records arrive within that delay. Choose it from measured lateness—perhaps covering 99.9% of events—and route records beyond the threshold to a late-data path for backfill, audit, and monitoring rather than silently discarding them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;events&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;spark&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;readStream&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;kafka&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;option&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;subscribe&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;risk.payment.v1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;parse_and_validate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;withWatermark&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;event_time&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;10 minutes&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dropDuplicatesWithinWatermark&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;event_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;velocity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;events&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;groupBy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nf"&gt;window&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;event_time&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;10 minutes&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1 minute&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;account_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;agg&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nf"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tx_count_10m&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;amount&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tx_amount_10m&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This illustrates semantics, not a copy-ready production job. Real pipelines also need schema validation, quarantine, state bounds, isolated checkpoint locations, rate control, monitoring, and idempotent sinks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Streaming features must leave Spark memory
&lt;/h2&gt;

&lt;p&gt;Window results, recent entity sets, velocity metrics, and risk counters belong in a low-latency online store read by the synchronous decision service. Redis, Cassandra, HBase, or an existing highly available KV store can work, but first define a feature contract:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;feature_name + entity_key + value
event_time + computed_at
definition_version + producer_job_version
ttl + freshness_sla
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Writes must be idempotent. With &lt;code&gt;foreachBatch&lt;/code&gt;, use a query/batch identity or business window key, plus an upsert, transactional table, or commit log. Spark checkpoints can restore source offsets and computation state; they do not automatically make an arbitrary external database exactly-once.&lt;/p&gt;

&lt;p&gt;Define stale-feature behavior explicitly. When the store is unavailable or freshness exceeds its SLA, the engine must distinguish a true zero from missing data and choose a conservative rule set, fallback model, manual review, or constrained approval according to risk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rules and models are complementary
&lt;/h2&gt;

&lt;p&gt;A mature decision combines several mechanisms:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hard rules: regulation, deny lists, unambiguous prohibitions
Velocity rules: counts, amounts, linked entities, time windows
Model scores: fraud, anomaly, account-takeover probability
Policy orchestration: matches + scores + business cost → action
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rules fit deterministic, explainable, rapidly changing constraints. Models fit multivariate patterns that are difficult to hand-code. The final action should incorporate exposure, customer value, false-positive cost, and available review capacity—not only one score.&lt;/p&gt;

&lt;p&gt;A rule platform needs version, state, priority, audience, effective interval, author, approver, and rationale. The release path should be draft → tests → historical replay → shadow → canary → full rollout. Record the rule version and input snapshot for every match, but avoid synchronous heavy audit writes in the high-QPS path; publish a reliable decision event and persist it asynchronously.&lt;/p&gt;

&lt;p&gt;Keep the rule DSL constrained and analyzable. Arbitrary scripts should not access the network or query production databases per transaction. Reference data should arrive through governed interfaces or preloaded snapshots.&lt;/p&gt;

&lt;h2&gt;
  
  
  Modernize the Hadoop layer into a governed lakehouse
&lt;/h2&gt;

&lt;p&gt;HDFS remains appropriate for distributed storage in on-premises Hadoop deployments; cloud systems commonly use object storage. In either case, bare Parquet directories are a weak sole data-management layer. An open table format such as Iceberg adds atomic commits, schema and partition evolution, snapshots, and time travel—strong foundations for replay and audit.&lt;/p&gt;

&lt;p&gt;Use at least three layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Raw facts:&lt;/strong&gt; append-only Kafka and CDC archives with original schema versions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Conformed detail:&lt;/strong&gt; deduplication, master-data mapping, privacy treatment, and consistent time semantics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Features and labels:&lt;/strong&gt; datasets for rule replay, training, cases, and analytics.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Spark Batch performs reconciliation, historical windows, feature backfills, fraud labels, and strategy evaluation. Batch and streaming should share feature definitions or be generated from the same declarative logic. Training datasets require point-in-time joins that use only information available at decision time, preventing future leakage.&lt;/p&gt;

&lt;p&gt;Streaming into Iceberg creates frequent snapshots and small files. Run separate maintenance for compaction, manifest rewriting, snapshot expiration, and metadata monitoring. Retention is also a product decision: raw facts, features, decisions, and sensitive identifiers need distinct retention and deletion policies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Every decision must be replayable
&lt;/h2&gt;

&lt;p&gt;Persist a Decision Record containing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;decision_id / request_id / trace_id
event_id and raw-fact location
feature values, event times, and definition versions
matched rules and versions
model name, version, score, and threshold
final action, reason code, and human override
decision time, latency, and degradation state
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Audit supports compliance and operations. It lets the team explain why a customer passed yesterday and failed today, whether a rule caused false positives, and whether model deterioration came from drift, stale features, or a business distribution shift.&lt;/p&gt;

&lt;p&gt;Use stable reason codes. Operational explanations and customer-facing explanations should be designed separately so staff can act on them without revealing exploitable strategy details.&lt;/p&gt;

&lt;h2&gt;
  
  
  Availability requires explicit degradation semantics
&lt;/h2&gt;

&lt;p&gt;Production design defines behavior under failure:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Failure&lt;/th&gt;
&lt;th&gt;Recommended behavior&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Kafka backlog&lt;/td&gt;
&lt;td&gt;Continue with timestamped recent features; monitor freshness and activate conservative policy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Online store unavailable&lt;/td&gt;
&lt;td&gt;Use local cache and core rules; send high-risk requests to review or deny&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Model timeout&lt;/td&gt;
&lt;td&gt;Circuit-break quickly; fall back to rules and the last stable model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bad rule release&lt;/td&gt;
&lt;td&gt;Roll back immediately; require dual approval and shadowing for high-impact rules&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Streaming job failure&lt;/td&gt;
&lt;td&gt;Recover from durable checkpoints; replay from Kafka and the archived facts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data-quality incident&lt;/td&gt;
&lt;td&gt;Quarantine bad events, freeze affected features, alert ownership, and stop propagation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Deploy the decision service across failure domains and assign an end-to-end latency budget plus dependency timeouts. Kafka, checkpoints, online stores, and lakehouse each need RPO/RTO. Disaster recovery is not “the process restarted”; periodically prove recovery from offsets, checkpoints, and immutable history.&lt;/p&gt;

&lt;h2&gt;
  
  
  Observe systems, data, and decisions
&lt;/h2&gt;

&lt;p&gt;CPU and latency are insufficient. Operate three metric families:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;System:&lt;/strong&gt; QPS, p95/p99 latency, errors, Kafka lag, batch duration, state size, checkpoint failures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data:&lt;/strong&gt; volume, schema failures, duplicates, lateness, nulls, feature freshness, online/offline consistency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Risk:&lt;/strong&gt; allow/deny/review rate, rule hits, score distribution, false positives, fraud loss, queue depth, policy value.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alerts should describe impact. Rising lag matters because particular features crossed their SLA and a number of decisions entered degradation—not simply because a threshold turned red.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical delivery sequence
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Facts and the minimum decision loop
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Standardize event schemas, IDs, event time, and reason codes.&lt;/li&gt;
&lt;li&gt;Ingest one critical event through Kafka and archive it unchanged.&lt;/li&gt;
&lt;li&gt;Deploy a decision API with a small hard-rule set and complete Decision Records.&lt;/li&gt;
&lt;li&gt;Establish baselines for latency, errors, lag, and decision distribution.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Real-time state
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Implement two or three high-value windows in Structured Streaming.&lt;/li&gt;
&lt;li&gt;Add watermarks, late-data routing, deduplication, and idempotent sinks.&lt;/li&gt;
&lt;li&gt;Introduce an online feature store and freshness SLAs.&lt;/li&gt;
&lt;li&gt;Exercise restart, backlog, and online-store degradation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Rule operations and replay
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Add rule versioning, approval, shadowing, canary, and rollback.&lt;/li&gt;
&lt;li&gt;Build Iceberg fact, feature, label, and decision tables.&lt;/li&gt;
&lt;li&gt;Backtest strategies and validate online/offline feature consistency.&lt;/li&gt;
&lt;li&gt;Close the loop with investigator outcomes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Models and continuous optimization
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Build leakage-free datasets with point-in-time joins.&lt;/li&gt;
&lt;li&gt;Add model registry, explanation, shadowing, canary, and drift monitoring.&lt;/li&gt;
&lt;li&gt;Optimize thresholds across loss, false positives, and operating cost.&lt;/li&gt;
&lt;li&gt;Review overlapping rules, unused features, technical debt, and recovery readiness.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The standard for production maturity
&lt;/h2&gt;

&lt;p&gt;A production risk system should demonstrate that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;synchronous latency is bounded and streaming cannot stall the transaction path;&lt;/li&gt;
&lt;li&gt;Kafka holds replayable facts, with explicit duplicate, disorder, and lateness semantics;&lt;/li&gt;
&lt;li&gt;online and offline features share definitions, while rules and models are versioned;&lt;/li&gt;
&lt;li&gt;every decision is explainable, auditable, and reproducible;&lt;/li&gt;
&lt;li&gt;each dependency has a deliberate degradation policy;&lt;/li&gt;
&lt;li&gt;success is measured through loss prevented, false-positive cost, and customer experience.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Risk control is not the pursuit of maximum rejection. It is the discipline of making cost-aware, evidence-based, accountable decisions from changing information under time pressure. Kafka, Spark, Hadoop, and a rule engine are infrastructure. The real system is the learning loop that joins live facts, historical evidence, and business judgment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://spark.apache.org/docs/latest/streaming/getting-started.html" rel="noopener noreferrer"&gt;Apache Spark Structured Streaming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kafka.apache.org/40/configuration/producer-configs/" rel="noopener noreferrer"&gt;Apache Kafka producer idempotence and transactions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://debezium.io/documentation/reference/stable/transformations/outbox-event-router.html" rel="noopener noreferrer"&gt;Debezium Outbox Event Router&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://iceberg.apache.org/docs/latest/spark-structured-streaming/" rel="noopener noreferrer"&gt;Apache Iceberg with Structured Streaming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hadoop.apache.org/docs/r3.4.0/hadoop-project-dist/hadoop-hdfs/HdfsUserGuide.html" rel="noopener noreferrer"&gt;Apache Hadoop HDFS User Guide&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>productivity</category>
    </item>
    <item>
      <title>From Query Understanding to Knowledge-Driven Recommendations</title>
      <dc:creator>侯惠阳</dc:creator>
      <pubDate>Sat, 22 Aug 2026 09:30:00 +0000</pubDate>
      <link>https://dev.to/_b6417cbb54ddfef4c4fd0/from-query-understanding-to-knowledge-driven-recommendations-32gp</link>
      <guid>https://dev.to/_b6417cbb54ddfef4c4fd0/from-query-understanding-to-knowledge-driven-recommendations-32gp</guid>
      <description>&lt;p&gt;In 2022, I wrote a technical proposal for a new tax and finance product. It covered query understanding, recommendation systems, and the fragmentation of domain knowledge. Like many architecture documents of its time, it also contained a long inventory of techniques: tokenization, intent classification, collaborative filtering, ranking models, entity extraction, and knowledge graphs.&lt;/p&gt;

&lt;p&gt;Most of those model names are no longer the interesting part. What has survived is a priority decision I made at the beginning:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Structured domain knowledge &amp;gt; query understanding &amp;gt; recommendation ranking.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ranking is not unimportant. The point is that in a regulated, time-sensitive domain, a system's ceiling is first determined by whether it can represent the knowledge correctly, then by whether it can understand the user's actual situation, and only then by how well it orders the candidates.&lt;/p&gt;

&lt;p&gt;If the knowledge base is incomplete, perfect query understanding still retrieves incomplete answers. If the system misses jurisdiction, entity type, or effective date, a more confident model can become more dangerous. If those foundations are weak, a sophisticated ranker merely amplifies errors with greater precision.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fknowledge-driven-tax-search%2Ftax-search-evolution-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fknowledge-driven-tax-search%2Ftax-search-evolution-en.svg" alt="The evolution from a 2022 algorithm pipeline to a knowledge-driven retrieval system" width="1200" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why tax and finance search is unusually difficult
&lt;/h2&gt;

&lt;p&gt;General search often competes on relevance. Tax and finance search must satisfy several constraints at once.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Queries are underspecified.&lt;/strong&gt; “Can a small business deduct this?” is not a complete business question. The legal entity, jurisdiction, transaction type, invoice type, and effective date may all change the answer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Domain language is dense.&lt;/strong&gt; A concept may have a statutory name, a professional abbreviation, an old name, and several everyday expressions. Words that look similar in general language may carry sharply different accounting or legal meanings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answers expire.&lt;/strong&gt; Tax knowledge is not a static encyclopedia. Rules are issued, amended, superseded, and interpreted differently across jurisdictions. A relevant but expired result is not merely low quality; it is wrong.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ranking is multi-objective.&lt;/strong&gt; Users need authoritative source material, understandable explanations, and actionable guidance. The system must balance authority, relevance, readability, recency, and context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Every conclusion needs provenance.&lt;/strong&gt; A useful system may say that it lacks enough information. It should not produce a definitive answer that cannot identify its evidence and scope.&lt;/p&gt;

&lt;p&gt;This is why a domain search product is not simply a vector database with an LLM on top. It is a decision system spanning knowledge governance, query interpretation, retrieval, ranking, and risk control.&lt;/p&gt;

&lt;h2&gt;
  
  
  Query understanding should produce a contract
&lt;/h2&gt;

&lt;p&gt;Query understanding is traditionally divided into normalization, tokenization, correction, expansion, entity recognition, and intent classification. These capabilities still matter, but a production system needs a stable, auditable output that every downstream component can consume.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"rawQuery"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"How does a small business in Chongqing file VAT this year?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"normalizedQuery"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Chongqing small business 2026 VAT filing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"intent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"tax_policy_and_procedure"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"entities"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"region"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Chongqing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"taxType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"VAT"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"businessType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"small_business"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"constraints"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"effectiveAt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-08-06"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"authorityLevel"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"national"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"municipal"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"rewrites"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"Chongqing VAT relief for small businesses"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"Chongqing VAT filing procedure for small businesses"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"confidence"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.91&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"needsClarification"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This object is more useful than an isolated label such as &lt;code&gt;policy_lookup&lt;/code&gt;. Retrieval, filters, rerankers, answer generation, logging, and evaluation can share the same contract. When the system fails, the contract also helps reveal where it failed.&lt;/p&gt;

&lt;p&gt;If a decisive constraint is missing, the right behavior is not to guess. A question about deducting the tax on a company vehicle may require the entity type, business purpose, invoice type, and transaction date. Asking one good clarifying question is safer than generating a polished answer to the wrong problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Replace algorithm inventories with an observable pipeline
&lt;/h2&gt;

&lt;p&gt;My 2022 design used a Pipe-Filter architecture: a stable core moved data through plug-in algorithm components. The idea remains useful, but each stage now needs an explicit contract, evaluation method, trace, and fallback.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fknowledge-driven-tax-search%2Ftax-query-pipeline-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fknowledge-driven-tax-search%2Ftax-query-pipeline-en.svg" alt="A production query pipeline for tax and finance search" width="1200" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A production pipeline can be organized as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Normalize input:&lt;/strong&gt; characters, units, dates, regulation identifiers, jurisdiction aliases, and entity types.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Detect safety and scope:&lt;/strong&gt; sensitive input, unauthorized requests, and questions the product cannot answer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parse intent and entities:&lt;/strong&gt; task, business entities, temporal constraints, and jurisdiction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rewrite and decompose:&lt;/strong&gt; correct errors, map terminology, and split complex questions into verifiable subqueries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retrieve through multiple channels:&lt;/strong&gt; lexical, semantic, rule-based, graph-based, and behavioral retrieval.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fuse and deduplicate:&lt;/strong&gt; combine channels without letting one scoring system dominate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rerank under business constraints:&lt;/strong&gt; semantic relevance, authority, validity, and user context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validate confidence:&lt;/strong&gt; evidence coverage, policy status, citation consistency, and conflicting sources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Present the result:&lt;/strong&gt; answer, evidence, applicable scope, uncertainty, and next action.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Every stage should record its version, latency, input and output summaries, and failure reason. When a model times out, the system should degrade to lexical search and deterministic filters rather than taking the entire experience down.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do not choose between lexical and vector retrieval
&lt;/h2&gt;

&lt;p&gt;Domain search is naturally hybrid.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lexical retrieval&lt;/strong&gt; is excellent for regulation identifiers, technical terms, exact phrases, and numeric conditions. BM25 remains a strong baseline; embeddings do not make exact matching obsolete.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vector retrieval&lt;/strong&gt; handles conversational language and semantic similarity. A user may ask whether a hotel invoice from an employee trip is deductible while the source document discusses “input VAT deduction for accommodation services.” The expressions differ, but the underlying intent is close.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rule-based retrieval&lt;/strong&gt; enforces constraints that must not be approximated: jurisdiction, effective date, entity eligibility, and policy status.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Knowledge-relation retrieval&lt;/strong&gt; follows connections such as policy, tax type, legal entity, transaction, required document, and filing procedure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Behavioral retrieval&lt;/strong&gt; becomes valuable only after sufficient, compliant, and de-biased feedback exists. Clicks are not proof of correctness; long dwell time may simply mean that the content is hard to understand.&lt;/p&gt;

&lt;p&gt;The channels should not be concatenated blindly. A stable rank-fusion method can combine candidates before a reranker handles the top set. Fusion optimizes for coverage, reranking for order, and deterministic business rules protect boundaries that relevance must never override.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recommendation is a decision process, not a model
&lt;/h2&gt;

&lt;p&gt;The older proposal summarized industrial recommendation as “algorithm + recall + rank.” I would now make the stages explicit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Candidate generation
  → eligibility filtering
  → deduplication and diversity
  → coarse ranking
  → fine reranking
  → policy constraints
  → explanation and presentation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Candidate generation answers “what might apply?” Filtering answers “what definitely does not apply?” Ranking decides “what should the user see first?” Explanation answers “why is this being shown?”&lt;/p&gt;

&lt;p&gt;For tax and finance content, a conceptual score should include more than semantic relevance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FinalScore =
  SemanticRelevance
  + AuthorityWeight
  + FreshnessWeight
  + ContextMatch
  + EvidenceCoverage
  - ExpirationPenalty
  - ConflictPenalty
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is not a universal formula. It is a design reminder: a semantically perfect result must still be rejected if it is expired, inapplicable to the jurisdiction, or unsupported by an authoritative source.&lt;/p&gt;

&lt;h2&gt;
  
  
  The knowledge layer sets the long-term ceiling
&lt;/h2&gt;

&lt;p&gt;Knowledge fragmentation was the highest-priority problem in the original proposal. It matters even more now.&lt;/p&gt;

&lt;h3&gt;
  
  
  Acquire with provenance
&lt;/h3&gt;

&lt;p&gt;Ingest regulations, official interpretations, procedural guides, cases, and internal material while preserving the source, publisher, publication date, effective period, and canonical URL.&lt;/p&gt;

&lt;h3&gt;
  
  
  Structure only what affects decisions
&lt;/h3&gt;

&lt;p&gt;Do not begin with an enormous ontology. Start with the fields that determine applicability:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Policy → issuing authority
Policy → effective and expiration dates
Policy → jurisdiction
Policy → eligible entity
Policy → tax type
Policy → business event
Policy → supersedes or cites another policy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Resolve identity and conflict
&lt;/h3&gt;

&lt;p&gt;The same policy may be mirrored, summarized, or incorrectly interpreted by multiple sources. The system must align entities, merge versions, apply authority rules, and expose conflicts instead of passing duplicate text to a model and hoping it decides correctly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Evaluate and update incrementally
&lt;/h3&gt;

&lt;p&gt;Knowledge needs a computable health state: source authority, current validity, field completeness, conflicts, and last review time. A policy update should trigger incremental ingestion and reevaluation of affected answers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where LLMs belong
&lt;/h2&gt;

&lt;p&gt;LLMs have dramatically improved query interpretation, semantic rewriting, decomposition, and answer composition. They should not become an unconstrained center of the architecture.&lt;/p&gt;

&lt;p&gt;Good uses include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;extracting structured intent and entities from conversational queries;&lt;/li&gt;
&lt;li&gt;generating alternative retrieval expressions;&lt;/li&gt;
&lt;li&gt;decomposing complex questions into verifiable subproblems;&lt;/li&gt;
&lt;li&gt;semantically reranking retrieved evidence;&lt;/li&gt;
&lt;li&gt;composing an answer from confirmed sources;&lt;/li&gt;
&lt;li&gt;identifying conflicts and escalating them for review.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;LLMs should not be the sole mechanism for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;determining whether a regulation is currently valid;&lt;/li&gt;
&lt;li&gt;enforcing access control and data isolation;&lt;/li&gt;
&lt;li&gt;authorizing high-risk business actions;&lt;/li&gt;
&lt;li&gt;inventing missing facts when evidence is absent;&lt;/li&gt;
&lt;li&gt;replacing deterministic jurisdiction, date, and eligibility filters.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The working rule is simple: let models handle ambiguity and systems handle certainty. Let models propose judgments, and let evidence and rules constrain them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Evaluation compounds faster than model selection
&lt;/h2&gt;

&lt;p&gt;Without an evaluation set, architecture work eventually becomes subjective tuning against a few impressive demo queries.&lt;/p&gt;

&lt;p&gt;Build a layered evaluation set from real user questions:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Primary metrics&lt;/th&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Query understanding&lt;/td&gt;
&lt;td&gt;Intent Accuracy, Entity F1&lt;/td&gt;
&lt;td&gt;Did the system understand the task?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Retrieval&lt;/td&gt;
&lt;td&gt;Recall@K&lt;/td&gt;
&lt;td&gt;Did the correct evidence enter the candidate set?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ranking&lt;/td&gt;
&lt;td&gt;NDCG@K, MRR&lt;/td&gt;
&lt;td&gt;Did the best result appear early enough?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Answer&lt;/td&gt;
&lt;td&gt;Evidence coverage, citation accuracy&lt;/td&gt;
&lt;td&gt;Is every claim supported?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Business&lt;/td&gt;
&lt;td&gt;Resolution rate, reformulation rate, escalation rate&lt;/td&gt;
&lt;td&gt;Was the problem actually solved?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Risk&lt;/td&gt;
&lt;td&gt;Expired citation rate, unauthorized access, unsupported claims&lt;/td&gt;
&lt;td&gt;Did the system respect its boundaries?&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fknowledge-driven-tax-search%2Frelevance-flywheel-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fknowledge-driven-tax-search%2Frelevance-flywheel-en.svg" alt="The relevance flywheel from real queries to continuous improvement" width="1200" height="540"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The set must include ambiguous language, typos, multiple intents, cross-jurisdiction conflicts, expired rules, and contradictory sources. These cases—not the clean demos—determine whether a system is ready for production.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I would start today
&lt;/h2&gt;

&lt;p&gt;I would not begin by training a model or drawing an architecture with every known algorithm. I would proceed in this order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select one bounded tax task and define correct outcomes and unacceptable errors.&lt;/li&gt;
&lt;li&gt;Build a minimal knowledge model around provenance, time, jurisdiction, entity, and policy relationships.&lt;/li&gt;
&lt;li&gt;Establish a hybrid BM25 and vector retrieval baseline.&lt;/li&gt;
&lt;li&gt;parse each query into a stable contract and clarify low-confidence cases.&lt;/li&gt;
&lt;li&gt;Add reranking, citations, and deterministic validation.&lt;/li&gt;
&lt;li&gt;Turn real failures into an evaluation set with weekly regression runs.&lt;/li&gt;
&lt;li&gt;Add knowledge graphs, personalization, or multi-agent orchestration only when the baseline reveals a concrete bottleneck.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Looking back at the 2022 design, my conclusion is not that the old algorithms became useless. It is that architecture decisions should outlive model names.&lt;/p&gt;

&lt;p&gt;A trustworthy domain system knows where its knowledge came from, to whom it applies, and when it is valid. It understands the problem the user is trying to solve. And when the evidence is insufficient, it knows when to stop.&lt;/p&gt;

&lt;p&gt;Those properties still matter more than the name of the model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.elastic.co/elasticsearch/hybrid-search" rel="noopener noreferrer"&gt;Elasticsearch: Hybrid Search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/vector-search/about-hybrid-search" rel="noopener noreferrer"&gt;Google Cloud: About hybrid search&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How to Build an AI-Native Team</title>
      <dc:creator>侯惠阳</dc:creator>
      <pubDate>Sat, 22 Aug 2026 05:30:00 +0000</pubDate>
      <link>https://dev.to/_b6417cbb54ddfef4c4fd0/how-to-build-an-ai-native-team-3p27</link>
      <guid>https://dev.to/_b6417cbb54ddfef4c4fd0/how-to-build-an-ai-native-team-3p27</guid>
      <description>&lt;p&gt;Whenever I set up a new computer, I restore the development environment first: GoLand, IntelliJ IDEA, VS Code, multiple JDKs, Python, Node.js, MySQL, Redis, Docker, Postman. For years, that ritual took two or three days and felt like part of being an engineer.&lt;/p&gt;

&lt;p&gt;This time I stopped halfway through.&lt;/p&gt;

&lt;p&gt;When had I last opened GoLand? Or IntelliJ? I was still building software, so why had the tools that once defined my productivity stopped being my primary entry point?&lt;/p&gt;

&lt;p&gt;The answer was not that coding had disappeared. The structure of the work had changed. I increasingly described the outcome, supplied context, reviewed a plan, and verified the result. An agent explored the repository, changed the code, ran the tests, and handled repetitive execution. Languages and frameworks still mattered, but they were moving from tools I had to operate personally to environments I had to understand and judge.&lt;/p&gt;

&lt;p&gt;The change was not the IDE. It was the basic unit of work.&lt;/p&gt;

&lt;p&gt;The same shift will not remain confined to engineering. Once AI can interpret context, use tools, execute multi-step tasks, and revise a plan based on results, the organizational question is no longer “Should we give employees an AI assistant?” It becomes:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How should we redesign a team when AI can participate as an execution unit?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  AI-enabled is not AI-native
&lt;/h2&gt;

&lt;p&gt;Many AI transformations begin with software procurement and end there. Meeting notes are summarized, marketing copy is generated, developers receive code completions, and leadership sees adoption numbers rise. The company declares itself AI-powered.&lt;/p&gt;

&lt;p&gt;Yet the operating system remains unchanged. Tasks still move through layers of handoffs. Context remains trapped in chat threads. Decisions still wait for meetings. People remain the transport layer between every step, while AI merely makes a few local steps faster.&lt;/p&gt;

&lt;p&gt;An AI-native team is designed with AI as a first-class participant from the beginning.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;AI-enabled&lt;/th&gt;
&lt;th&gt;AI-native&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Adds an assistant to the old process&lt;/td&gt;
&lt;td&gt;Redesigns the process around the outcome&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AI drafts; people keep moving the work&lt;/td&gt;
&lt;td&gt;AI executes within explicit authority&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prompts are personal tricks&lt;/td&gt;
&lt;td&gt;Context is an organizational asset&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Measures users and calls&lt;/td&gt;
&lt;td&gt;Measures quality, cycle time, cost, and outcomes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Humans repair errors after the fact&lt;/td&gt;
&lt;td&gt;Evaluation, permissions, and escalation are designed upfront&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Knowledge lives in documents and heads&lt;/td&gt;
&lt;td&gt;Knowledge is retrievable, versioned, and reusable&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A useful test is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If AI disappeared from a core workflow tomorrow, would the process become slower, or would it have to be redesigned?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If it only becomes slower, the organization is probably AI-enabled. If the process can no longer operate in the same way, AI has entered the organizational architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  A new operating system for work
&lt;/h2&gt;

&lt;p&gt;AI-native transformation is not a single tool project. Five layers must evolve together.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fbuilding-an-ai-native-team%2Fai-native-operating-system-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fbuilding-an-ai-native-team%2Fai-native-operating-system-en.svg" alt="The five-layer operating system of an AI-native team" width="1200" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Goals
&lt;/h3&gt;

&lt;p&gt;Agents can execute the wrong objective with remarkable efficiency. Clear objectives therefore matter more, not less. Every task needs a problem, an intended beneficiary, constraints, and an acceptance test.&lt;/p&gt;

&lt;p&gt;“Research our competitors” is not an executable goal. “Compare the pricing, core workflow, and recurring customer complaints of three competitors; recommend two differentiated hypotheses for next quarter; cite the evidence behind every conclusion” is much closer.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Workflows
&lt;/h3&gt;

&lt;p&gt;Do not insert AI into one step of an inherited process. Work backward from the result. Which steps can run in parallel? Which information can be collected automatically? Which judgments must remain human? How does the process degrade? Where does the output go next?&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Human-agent responsibilities
&lt;/h3&gt;

&lt;p&gt;The useful question is not “Which job will AI replace?” It is “How should judgment and execution be divided inside each job?”&lt;/p&gt;

&lt;p&gt;People are better positioned to own goals, taste, priorities, responsibility, relationships, and high-risk exceptions. Agents are well suited to search, synthesis, generation, batch execution, state synchronization, and work with clear verification.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Organizational context
&lt;/h3&gt;

&lt;p&gt;If every new session requires an explanation of the company, product, vocabulary, and past decisions, the organization has hired an intern who loses all memory every morning. Principles, domain language, processes, decisions, examples, counterexamples, and permissions must become retrievable and maintainable context.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Evaluation and governance
&lt;/h3&gt;

&lt;p&gt;Without evaluation, the team can only say that work “feels faster.” Without governance, greater speed merely spreads errors faster. Evaluation, authorization, audit, fallback, and human escalation must be designed with the workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  The new unit of work: a person with agents
&lt;/h2&gt;

&lt;p&gt;Traditional organizations expand execution capacity by adding people and layers. Information moves through managers, and coordination cost rises with headcount.&lt;/p&gt;

&lt;p&gt;An AI-native organization increasingly consists of small human-agent units. A product leader may coordinate research, data, prototyping, and writing agents. A developer may delegate repository exploration, implementation, testing, and documentation. The person retains ownership of the objective while agents multiply execution bandwidth.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fbuilding-an-ai-native-team%2Fhuman-agent-loop-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fbuilding-an-ai-native-team%2Fhuman-agent-loop-en.svg" alt="The goal, execution, verification, and learning loop between people and agents" width="1200" height="540"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The important variable is not the number of agents. It is clarity of responsibility:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Human: define goals → set boundaries → review critical judgment → own the outcome
Agent: plan → use tools → execute → submit evidence
System: record → evaluate → enforce permissions → trigger escalation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Teams often build a complex multi-agent network too early. A deterministic workflow is usually more reliable when the task is well understood. A single agent should remain a single agent unless the work genuinely benefits from parallel specialization, context isolation, or independent verification.&lt;/p&gt;

&lt;p&gt;Complexity should be pulled by the problem, not pushed by enthusiasm for the technology.&lt;/p&gt;

&lt;h2&gt;
  
  
  Six principles for AI-native workflows
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Begin with acceptance criteria
&lt;/h3&gt;

&lt;p&gt;Define “done” before choosing a model. Tasks with objective checks are strong candidates for agentic execution: tests pass, accounts reconcile, required fields exist, citations resolve, or outputs match a schema.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Treat context as capital
&lt;/h3&gt;

&lt;p&gt;Better output comes not only from better models but from better context. Context should be managed like code: sourced, versioned, owned, reviewed, and retired when stale.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Prefer simple, composable patterns
&lt;/h3&gt;

&lt;p&gt;Use deterministic code for deterministic work. Invoke models where ambiguity requires judgment. Give an agent control of the path only when the path cannot be known in advance. Simpler systems are easier to evaluate, debug, and operate economically.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Match autonomy to risk
&lt;/h3&gt;

&lt;p&gt;Low-risk, reversible, verifiable actions can run automatically. High-risk, externally visible, or irreversible actions require approval. Drafting an internal summary and sending a contract to a customer should not share the same autonomy level.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Make every step observable
&lt;/h3&gt;

&lt;p&gt;At minimum, record the objective, context used, model and tool versions, critical decisions, result, human intervention, latency, and cost. Without traces, every production failure becomes guesswork.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Turn failure into system memory
&lt;/h3&gt;

&lt;p&gt;If a human correction does not become a rule, example, or evaluation case, the same failure will return. Organizational learning begins when an individual correction becomes a reusable system capability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do not begin with an isolated “AI department”
&lt;/h2&gt;

&lt;p&gt;When transformation is delegated entirely to an innovation unit, one of two things usually happens. The innovation team builds impressive demos without understanding operational constraints, or business teams treat AI as somebody else's project and refuse ownership of the outcome.&lt;/p&gt;

&lt;p&gt;A healthier structure has four sources of accountability.&lt;/p&gt;

&lt;h3&gt;
  
  
  Leadership owns direction and boundaries
&lt;/h3&gt;

&lt;p&gt;Leadership defines why the organization is changing, which workflows matter, what risks are acceptable, and how much capacity will be committed. Leaders also need to use the new operating model themselves. A company notices quickly when executives demand AI adoption while continuing to manage through meetings and cascading status reports.&lt;/p&gt;

&lt;h3&gt;
  
  
  A platform team owns shared infrastructure
&lt;/h3&gt;

&lt;p&gt;This team provides model access, tools, identity, permissions, knowledge, evaluation, cost controls, and safety foundations. It does not own every business use case. Its job is to eliminate duplicated infrastructure work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Business teams own outcomes
&lt;/h3&gt;

&lt;p&gt;The people closest to a process understand its decisions and edge cases. Business owners need authority to redesign the process and accountability for quality. Responsibility cannot be transferred to a model vendor or platform team.&lt;/p&gt;

&lt;h3&gt;
  
  
  AI champions accelerate learning
&lt;/h3&gt;

&lt;p&gt;Practitioners inside real teams help colleagues cross the initial barrier, share successful and failed patterns, and connect business needs with platform capabilities. Champions are catalysts, not a new approval layer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choose the first workflow carefully
&lt;/h2&gt;

&lt;p&gt;Do not begin with a company-wide mandate. Begin with a real workflow that is valuable and safe enough to learn from.&lt;/p&gt;

&lt;p&gt;Prioritize work that is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Frequent:&lt;/strong&gt; it occurs every day or week;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Time-consuming:&lt;/strong&gt; much of the effort is search, synthesis, copying, or coordination;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verifiable:&lt;/strong&gt; output quality has a reasonably clear standard;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Controllable:&lt;/strong&gt; failure is inexpensive or can be intercepted before action.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A rough prioritization model is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Opportunity = frequency × time per task × verifiability × reuse ÷ risk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Do not measure only minutes saved. Track first-pass acceptance, rework, escalation, total cost per accepted result, and end-to-end cycle time. Doubling generation speed while tripling review effort is not a win.&lt;/p&gt;

&lt;h2&gt;
  
  
  Move beyond a prompt library
&lt;/h2&gt;

&lt;p&gt;Prompt templates are useful, but they are only the shallowest layer of organizational context. A mature context system includes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Principles: how we make tradeoffs and what is prohibited
Domain language: products, customers, metrics, and terminology
Processes: steps, inputs, outputs, and owners
Decision history: what was chosen, rejected, and why
Examples: strong outputs and known failure modes
Tools and permissions: what an agent may read or change
Evaluation sets: real tasks, expected outcomes, and boundaries
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This material requires maintenance. Stale context is often more dangerous than missing context because it creates consistently wrong behavior.&lt;/p&gt;

&lt;p&gt;Organizational memory is also not equivalent to putting every file into a vector database. Different knowledge has different lifecycles and access levels. Product metrics may change daily, policies monthly, architecture decisions require version history, and personnel data requires strict isolation. Retrieval is the entry point; governance is the system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Governance is a prerequisite for scale
&lt;/h2&gt;

&lt;p&gt;When an agent can only draft text, the primary risk is content quality. When it can send messages, change production systems, move money, or update customer records, the risk becomes action.&lt;/p&gt;

&lt;p&gt;Design permissions around actions rather than around tools:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Permission&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Behavior&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Automatically allowed&lt;/td&gt;
&lt;td&gt;Read public sources, draft, run read-only analysis&lt;/td&gt;
&lt;td&gt;Execute and log&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Conditionally allowed&lt;/td&gt;
&lt;td&gt;Edit internal docs, run tests, create tickets&lt;/td&gt;
&lt;td&gt;Execute when rules pass&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Approval required&lt;/td&gt;
&lt;td&gt;External communication, production changes, financial or contractual actions&lt;/td&gt;
&lt;td&gt;Review plan and impact first&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prohibited&lt;/td&gt;
&lt;td&gt;Bypass audit, expand its own access, read unrelated sensitive data&lt;/td&gt;
&lt;td&gt;Hard block&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every consequential workflow also needs least privilege, complete auditability, an immediate stop mechanism, and a path back to a safe state.&lt;/p&gt;

&lt;p&gt;Human escalation is not failure. The dangerous system is the one that does not know when to ask for help. When goals are ambiguous, evidence conflicts, authority is missing, risk rises, or verification fails repeatedly, the agent should pause and hand over completed work, evidence, and the unresolved decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical 90-day path
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fbuilding-an-ai-native-team%2Fai-native-90-day-roadmap-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fbuilding-an-ai-native-team%2Fai-native-90-day-roadmap-en.svg" alt="A 90-day roadmap for an AI-native team" width="1200" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Days 1–30: diagnose and ignite
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Start with one business team, not the entire company.&lt;/li&gt;
&lt;li&gt;Map three frequent workflows and record current quality, time, and cost baselines.&lt;/li&gt;
&lt;li&gt;Standardize two or three tools and publish clear data boundaries.&lt;/li&gt;
&lt;li&gt;Name a business owner, platform partner, and AI champion.&lt;/li&gt;
&lt;li&gt;Redesign one low-risk, frequent, verifiable workflow.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Deliverables: baseline, use-case priorities, tool and data rules, and one working workflow.&lt;/p&gt;

&lt;h3&gt;
  
  
  Days 31–60: redesign process and context
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Expand to three production workflows.&lt;/li&gt;
&lt;li&gt;Define objectives, inputs, outputs, permissions, and escalation for each.&lt;/li&gt;
&lt;li&gt;Build the minimum organizational context and a library of validated examples.&lt;/li&gt;
&lt;li&gt;Convert real failures into the first evaluation set.&lt;/li&gt;
&lt;li&gt;Review failures as openly as successes each week.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Deliverables: three workflow specifications, context v1, evaluation set v1, and a weekly quality report.&lt;/p&gt;

&lt;h3&gt;
  
  
  Days 61–90: institutionalize and expand
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Run evaluations whenever models, prompts, tools, or workflows change.&lt;/li&gt;
&lt;li&gt;Establish approvals, audits, cost controls, and incident response.&lt;/li&gt;
&lt;li&gt;Compare cycle time, quality, cost, and escalation against the original baseline.&lt;/li&gt;
&lt;li&gt;Extract reusable components instead of copying entire workflows.&lt;/li&gt;
&lt;li&gt;Use evidence to expand, redesign, or stop each use case.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Deliverables: evaluation dashboard, governance mechanism, quarterly review, and the next roadmap.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measure outcomes, not AI activity
&lt;/h2&gt;

&lt;p&gt;The number of AI users and tokens consumed are adoption metrics, not value metrics.&lt;/p&gt;

&lt;p&gt;More useful measures include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cycle time:&lt;/strong&gt; from request to accepted outcome;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;First-pass acceptance:&lt;/strong&gt; results approved without rework;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost per accepted result:&lt;/strong&gt; model, infrastructure, and human review combined;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Escalation rate:&lt;/strong&gt; where people repeatedly need to intervene and why;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recovery time:&lt;/strong&gt; how quickly the workflow returns to a safe state;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reuse:&lt;/strong&gt; how often another team can adopt an existing capability;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Business outcome:&lt;/strong&gt; revenue, conversion, quality, customer satisfaction, or risk reduction.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Metrics should not be used to prove that AI was the right decision. They should help the organization continuously decide what to automate, what to keep human, and what not to do at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  AI-native organizations still amplify human judgment
&lt;/h2&gt;

&lt;p&gt;AI will continue to reduce the cost of execution. It will not make the objective correct, create taste, or absorb accountability.&lt;/p&gt;

&lt;p&gt;The best teams may not be those with the most agents. They will be the teams that define problems clearly, provide dense and accurate context, verify outcomes quickly, and convert failures into organizational memory.&lt;/p&gt;

&lt;p&gt;An AI-native team is therefore not simply a team with fewer people.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is a way to execute human judgment at greater scale while keeping the system controllable, verifiable, and accountable.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I did not install every old tool on that new computer. They had not become worthless. My role had moved from operating each tool to designing a system in which people and AI could work together.&lt;/p&gt;

&lt;p&gt;For an organization, becoming AI-native begins with the same shift.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/engineering/building-effective-agents" rel="noopener noreferrer"&gt;Anthropic: Building effective agents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents" rel="noopener noreferrer"&gt;Anthropic: Demystifying evals for AI agents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openai.com/business/guides-and-resources/a-practical-guide-to-building-ai-agents/" rel="noopener noreferrer"&gt;OpenAI: A practical guide to building AI agents&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
    </item>
    <item>
      <title>My AI Programming Workbench: Orchestrating Models Instead of Hunting for One Best Tool</title>
      <dc:creator>侯惠阳</dc:creator>
      <pubDate>Sat, 22 Aug 2026 01:30:00 +0000</pubDate>
      <link>https://dev.to/_b6417cbb54ddfef4c4fd0/my-ai-programming-workbench-orchestrating-models-instead-of-hunting-for-one-best-tool-4kdk</link>
      <guid>https://dev.to/_b6417cbb54ddfef4c4fd0/my-ai-programming-workbench-orchestrating-models-instead-of-hunting-for-one-best-tool-4kdk</guid>
      <description>&lt;p&gt;My programming toolbox is no longer a single product.&lt;/p&gt;

&lt;p&gt;Locally, I run &lt;strong&gt;Ollama with Qwen3.5:9B&lt;/strong&gt;. In the terminal I use &lt;strong&gt;OpenCode, Claude Code, and Codex&lt;/strong&gt;, and I also route &lt;strong&gt;Kimi K3&lt;/strong&gt; through OpenCode. For complex desktop work, I use the desktop version of GPT. These tools differ in capability, cost, privacy, and interaction style, but I have become convinced that output quality depends less on finding one “best model” than on organizing several models well.&lt;/p&gt;

&lt;p&gt;I do not want one agent to receive an ambiguous request and independently design, implement, and approve the result. My workflow resembles a small engineering team. I establish shared project context, ask a strong model to develop an architecture, and personally review the critical decisions. I then divide the work into bounded tasks, assign them to different tools, ask other tools to review the implementation, and close the loop with tests, type checks, static analysis, and observed behavior.&lt;/p&gt;

&lt;p&gt;The point is not to open more terminals. It is to build an auditable delivery pipeline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Requirements and constraints
          ↓
Project context (AGENTS.md / CLAUDE.md / documentation)
          ↓
Design (architecture, domain boundaries, risks, acceptance criteria)
          ↓
Human review and decision
          ↓
Task decomposition → execution → independent cross-review
          ↓
Automated checks + scenario validation
          ↓
Corrections become durable project context
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A layered workbench, not a list of tools
&lt;/h2&gt;

&lt;p&gt;Different models belong at different points in the workflow. Sending every task to the most expensive model wastes resources. Giving a high-risk design decision to a small local model can make the team move quickly in the wrong direction.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Tools I use&lt;/th&gt;
&lt;th&gt;Best suited to&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Local exploration&lt;/td&gt;
&lt;td&gt;Ollama + Qwen3.5:9B&lt;/td&gt;
&lt;td&gt;Code explanation, local search, drafts, low-risk edits, and assistance with sensitive context&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Open orchestration&lt;/td&gt;
&lt;td&gt;OpenCode + Qwen / Kimi K3&lt;/td&gt;
&lt;td&gt;Model switching, experiments, cost-capability comparisons, and replaceable terminal workflows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deep design&lt;/td&gt;
&lt;td&gt;Claude Code&lt;/td&gt;
&lt;td&gt;Broad repository comprehension, architecture proposals, domain modeling, and migration planning&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Engineering execution&lt;/td&gt;
&lt;td&gt;Codex / Claude Code / OpenCode&lt;/td&gt;
&lt;td&gt;Repository exploration, implementation, refactoring, testing, repair, and review&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Desktop collaboration&lt;/td&gt;
&lt;td&gt;Desktop GPT&lt;/td&gt;
&lt;td&gt;Cross-file and visual reasoning, research synthesis, long-running collaboration, and editorial refinement&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This is not a permanent ranking. Models and products will change. The stable rule is to route work according to &lt;strong&gt;risk, context size, verifiability, cost, and privacy requirements&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Low-risk, reversible tasks should usually start with a local or lower-cost model. Cross-module reasoning deserves a stronger model. Architecture, data migration, security, and production changes require a human decision. No model output substitutes for acceptance evidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with project context, not a clever prompt
&lt;/h2&gt;

&lt;p&gt;When I initialize a project, I create project-level instructions such as &lt;code&gt;AGENTS.md&lt;/code&gt; and &lt;code&gt;CLAUDE.md&lt;/code&gt;. They describe the stack, repository structure, operating commands, architecture, and engineering constraints. This preparation looks like documentation, but it establishes the ceiling for every agent that follows.&lt;/p&gt;

&lt;p&gt;Without shared context, every tool rescans the repository, guesses conventions, and may invent a different implementation style. Useful project context should answer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Purpose: the problem, users, and current stage
Stack: languages, frameworks, versions, and major dependencies
Architecture: module responsibilities, dependency direction, hard boundaries
Domain language: core concepts, terms, and invariants
Commands: install, start, test, type-check, and build
Conventions: naming, errors, logging, tests, and commits
Safety: sensitive data, secrets, external calls, and prohibited actions
Definition of done: mandatory quality gates for every change
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Context files should not become thousand-line dumping grounds. &lt;code&gt;AGENTS.md&lt;/code&gt; is a good home for stable, executable, cross-tool rules. &lt;code&gt;CLAUDE.md&lt;/code&gt; can contain Claude-specific interaction guidance. Detailed architecture belongs in focused documents linked from the entry point. Rules should be concise, testable, and updated with the code.&lt;/p&gt;

&lt;p&gt;One principle matters greatly: &lt;strong&gt;do not duplicate the same rule across several files&lt;/strong&gt;. Duplication eventually becomes contradiction. Shared facts need one canonical source; tool-specific files should contain only the differences.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let a strong model design, but keep architecture accountable to people
&lt;/h2&gt;

&lt;p&gt;For medium and large changes, I often ask Claude to propose the architecture, domain boundaries, DDD model, and implementation path. AI is excellent at expanding the problem space quickly: identifying affected modules, proposing alternatives, finding failure paths, exposing hidden dependencies, and turning vague requirements into a structure that can be debated.&lt;/p&gt;

&lt;p&gt;A polished design document is not automatically a correct design. I review five things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Does it solve the real problem?&lt;/strong&gt; Or has it added complexity to display architectural sophistication?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Are the boundaries natural?&lt;/strong&gt; Do they follow business change, or merely apply DDD vocabulary?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Are dependencies controlled?&lt;/strong&gt; Are data flow, transactions, recovery, and compatibility explicit?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Can it ship incrementally?&lt;/strong&gt; Or does it require a high-risk big-bang rewrite?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How will we know it works?&lt;/strong&gt; Are test, performance, migration, and business acceptance criteria defined before implementation?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;DDD is a way to organize complex business knowledge, not a decorative default. A short-lived module with straightforward CRUD does not need aggregates, repositories, and extra layers for their own sake. DDD earns its cost when rules are complex, language is contested, and boundaries must evolve over time.&lt;/p&gt;

&lt;p&gt;I therefore ask the model to explain why the design fits, what alternatives exist, and when the recommendation should not be used. Good architecture is not an impressive diagram. It is a set of decisions that can be challenged, traded off, and verified.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decompose work around boundaries and evidence
&lt;/h2&gt;

&lt;p&gt;Once the design passes review, I do not send another agent a one-line request to “implement the whole feature.” I create task packets that are independently understandable and verifiable, with as little overlapping write scope as possible.&lt;/p&gt;

&lt;p&gt;A useful task packet includes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Objective: the user or system behavior that must change
Scope: permitted modules and explicit non-goals
Context: relevant decisions, interfaces, and conventions
Acceptance: tests, examples, performance, or observable behavior
Risk: compatibility, data, security, and rollback requirements
Delivery: code, tests, documentation, and unresolved questions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tasks should be split by domain boundary, module, read/write responsibility, or verification concern—not mechanically by file. When multiple agents edit the same central file, time saved in generation is often lost to conflict resolution and context synchronization. Parallelism pays only when boundaries are clear and write scopes barely overlap.&lt;/p&gt;

&lt;p&gt;I also control how much context each task receives. Giving an agent the entire repository is not always helpful. Irrelevant information dilutes constraints and increases accidental associations. Stable project rules should be shared, while each task receives only the local context necessary for its objective.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cross-review: different tools should search for different failures
&lt;/h2&gt;

&lt;p&gt;I ask other tools to cross-review the implementation. The value is not that two models can vote. It is that an independent reviewer can challenge the implementer's assumptions.&lt;/p&gt;

&lt;p&gt;An effective review is more specific than “look over this code.” I ask reviewers to check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;conformance with the requirement and acceptance criteria;&lt;/li&gt;
&lt;li&gt;architecture boundaries and hidden coupling;&lt;/li&gt;
&lt;li&gt;error paths, concurrency, idempotency, and resource cleanup;&lt;/li&gt;
&lt;li&gt;security, privacy, permissions, and dependency risk;&lt;/li&gt;
&lt;li&gt;whether tests verify behavior instead of mirroring implementation;&lt;/li&gt;
&lt;li&gt;whether a simpler and more maintainable solution exists.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The reviewer should provide evidence: a file and location, trigger condition, impact, reproduction path, and suggested correction. The implementation tool can then address the finding and rerun validation. When models disagree, I do not decide by brand. I return to requirements, code, tests, and reproducible facts.&lt;/p&gt;

&lt;p&gt;There is also a danger of agents endorsing one another. If several tools inherit the same faulty assumption, they can confidently agree on the wrong result. Independent verification should change either the information source or the validation method: one model performs static review, another runs tests and scenarios, and a person reviews the critical business judgment.&lt;/p&gt;

&lt;h2&gt;
  
  
  The final judge is a quality gate, not a model
&lt;/h2&gt;

&lt;p&gt;Code that looks plausible is not evidence that the system behaves correctly. My validation ladder usually looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Formatting / linting
        ↓
Type checking / compilation
        ↓
Unit and integration tests
        ↓
Critical user journey or API scenario checks
        ↓
Diff and architecture consistency review
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Automatable checks belong in project commands and CI, not in an agent's memory. An agent must report which commands it actually ran, their results, and which checks could not run because of environmental limits. An unexecuted test is not “probably passing,” and a prediction is not evidence.&lt;/p&gt;

&lt;p&gt;High-risk actions need separate governance. Production deployment, database migration, destructive changes, permission updates, and external communication require explicit approval and a recovery plan. Local inference can improve privacy, but it is not automatically secure. Model provenance, tool permissions, secrets in prompts, logs, and external plugins still require control.&lt;/p&gt;

&lt;h2&gt;
  
  
  Turn every correction into default capability
&lt;/h2&gt;

&lt;p&gt;The lasting value of this workflow is not that one change ships faster. It is the learning loop.&lt;/p&gt;

&lt;p&gt;When review exposes a recurring problem, I decide which layer should absorb it. Stable engineering constraints go into &lt;code&gt;AGENTS.md&lt;/code&gt;. Architectural trade-offs become ADRs. Domain facts enter domain documentation. Mechanical errors become lint rules or tests. High-value failures become regression cases. The next task should not depend on me remembering the same warning again.&lt;/p&gt;

&lt;p&gt;I can then track cycle time from request to merge, first-pass validation rate, review findings, human rework, rollback count, and the cost of comparable tasks across models. Generation speed alone is a poor evaluation metric. A fast model that creates hours of review work may be the slower system.&lt;/p&gt;

&lt;h2&gt;
  
  
  My conclusion: the developer becomes the designer of the work system
&lt;/h2&gt;

&lt;p&gt;Ollama, Qwen, OpenCode, Kimi, Claude Code, Codex, and desktop GPT will all continue to evolve. Today's strongest model may become an ordinary component tomorrow.&lt;/p&gt;

&lt;p&gt;What compounds is model-independent: clarifying the objective, encoding context in the project, turning architecture into reviewable decisions, decomposing work into verifiable units, assigning execution and review independently, and closing the loop with automated evidence.&lt;/p&gt;

&lt;p&gt;AI lowers the cost of coding and exploration, but it does not take ownership of judgment or responsibility. My role is no longer limited to typing every line. It is to design an engineering system in which the right context enters, different capabilities cooperate, errors surface early, and experience becomes durable memory.&lt;/p&gt;

&lt;p&gt;That may be the deepest change AI programming brings: &lt;strong&gt;we are no longer only designing software; we are also designing the way software gets produced.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Agent Architecture for SMBs: A 90-Day Path to Production</title>
      <dc:creator>侯惠阳</dc:creator>
      <pubDate>Fri, 21 Aug 2026 09:30:00 +0000</pubDate>
      <link>https://dev.to/_b6417cbb54ddfef4c4fd0/agent-architecture-for-smbs-a-90-day-path-to-production-1k09</link>
      <guid>https://dev.to/_b6417cbb54ddfef4c4fd0/agent-architecture-for-smbs-a-90-day-path-to-production-1k09</guid>
      <description>&lt;p&gt;An enterprise agent should not be designed as “a chatbot plus a few APIs.” But a small or midsize business should not copy a global company's central agent platform, marketplace, and knowledge infrastructure either. The former can answer but cannot execute reliably; the latter exhausts budget before it creates business value.&lt;/p&gt;

&lt;p&gt;An SMB needs a minimum production architecture: an agent that completes one bounded business loop—understanding an objective, acquiring context, using tools, verifying the result, and returning control to a person when uncertainty or risk is too high.&lt;/p&gt;

&lt;p&gt;This article answers four practical questions: which use cases deserve an agent, how to structure the production system, how to deploy it in 90 days, and how to measure the outcome honestly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does the problem need an agent?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task shape&lt;/th&gt;
&lt;th&gt;Default solution&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Fixed rules, structured input, known path&lt;/td&gt;
&lt;td&gt;Conventional code, RPA, or workflow engine&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Generation, summarization, classification, extraction&lt;/td&gt;
&lt;td&gt;One LLM call with structured output&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Known sequence with a few semantic decisions&lt;/td&gt;
&lt;td&gt;LLM workflow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unknown path requiring tool selection and adaptation&lt;/td&gt;
&lt;td&gt;Agent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Independent specialization, real parallelism, or permission isolation&lt;/td&gt;
&lt;td&gt;A small multi-agent system&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;OpenAI describes an agent's foundation as model, tools, and instructions, and recommends use cases involving complex judgment, unmanageable rules, or substantial unstructured data. Anthropic reaches a similar conclusion from production work: begin with simple, composable patterns and add autonomy only when its value covers the extra latency, cost, and failure surface.&lt;/p&gt;

&lt;p&gt;If a few deterministic branches solve the task reliably, do not build an agent yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adapt enterprise layers to SMB constraints
&lt;/h2&gt;

&lt;p&gt;Gateway, orchestration, tools, knowledge, policy, and evaluation remain useful ideas from enterprise architectures. The difference is that an SMB should combine them and split only under proven load.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Enterprise pattern&lt;/th&gt;
&lt;th&gt;SMB default&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Central platform and agent marketplace&lt;/td&gt;
&lt;td&gt;One task service with scenario-specific skills&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Many domain agents&lt;/td&gt;
&lt;td&gt;One agent first; split only with evidence&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Enterprise knowledge platform&lt;/td&gt;
&lt;td&gt;Govern authoritative data for the current workflow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;General tool hub&lt;/td&gt;
&lt;td&gt;Start with three to five narrow tools&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Broad multi-model routing&lt;/td&gt;
&lt;td&gt;Small model for extraction; strong model for key judgment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dedicated governance organization&lt;/td&gt;
&lt;td&gt;Policy as code, a business owner, and explicit approvers&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;An SMB may have only two to five people operating the entire system. Its architecture must remain simple, replaceable, observable, reversible, and economically tied to accepted results.&lt;/p&gt;

&lt;h2&gt;
  
  
  The minimum production architecture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fagent-architecture-for-smb%2Farchitecture-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fagent-architecture-for-smb%2Farchitecture-en.svg" alt="Production agent architecture for an SMB" width="1200" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The architecture separates model judgment from real execution. An LLM may propose a plan or tool call; a deterministic policy engine decides whether it is allowed. Tools expose narrow business operations—not database administration or an unrestricted shell.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Interaction and gateway
&lt;/h3&gt;

&lt;p&gt;Requests can arrive through a web app, messaging platform, email, CRM button, API, or event. The gateway handles identity, tenancy, rate limits, and normalization into a task envelope containing task type, actor, input, risk, budget, and acceptance criteria. Authorization, cost, and evaluation then belong to a business action rather than an untraceable conversation.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Deterministic orchestration first
&lt;/h3&gt;

&lt;p&gt;Code controls known flows: load a lead, enrich it, score it, draft a response, request approval, and update CRM. Let the agent choose a tool only when the next step genuinely depends on its findings.&lt;/p&gt;

&lt;p&gt;Production states include &lt;code&gt;queued&lt;/code&gt;, &lt;code&gt;running&lt;/code&gt;, &lt;code&gt;waiting_approval&lt;/code&gt;, &lt;code&gt;succeeded&lt;/code&gt;, &lt;code&gt;failed&lt;/code&gt;, and &lt;code&gt;cancelled&lt;/code&gt;. Every step needs a timeout, retry ceiling, idempotency key, and checkpoint. Long work belongs on a queue, not inside one open HTTP request.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Agent runtime and model gateway
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Agent = Instructions + Tools + Task State + Policies + Evaluation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Treat models as replaceable dependencies. Small models classify, extract, and route; stronger models plan and synthesize. Set token, tool-call, time, and cost ceilings per task. Validate output against a schema before it becomes an action. Failed validation receives a bounded repair attempt or human escalation.&lt;/p&gt;

&lt;p&gt;Keep vendor SDK calls out of business logic. Model and prompt changes pass regression evaluations before gradual rollout.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Separate state, facts, knowledge, and preferences
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Task state:&lt;/strong&gt; progress, tool results, and unresolved questions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Business facts:&lt;/strong&gt; CRM, ERP, and order systems remain sources of truth.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Knowledge:&lt;/strong&gt; manuals, policies, and templates are retrieved with citations and access control.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Long-term preferences:&lt;/strong&gt; store only with a purpose, consent, expiry, and deletion path.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Webpages, emails, and documents are untrusted inputs. Their instructions cannot become system commands. Retrieval must enforce tenant isolation, data classification, source, version, and permission filters.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Narrow tools and least privilege
&lt;/h3&gt;

&lt;p&gt;Avoid a universal “operate CRM” tool. Prefer &lt;code&gt;get_customer&lt;/code&gt;, &lt;code&gt;list_recent_orders&lt;/code&gt;, &lt;code&gt;draft_followup&lt;/code&gt;, and &lt;code&gt;update_lead_status&lt;/code&gt;, with typed parameters and business-rule validation.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Level&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Default control&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;L0 read&lt;/td&gt;
&lt;td&gt;Search products or approved customer facts&lt;/td&gt;
&lt;td&gt;Execute and log&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;L1 reversible write&lt;/td&gt;
&lt;td&gt;Create a draft or internal label&lt;/td&gt;
&lt;td&gt;Automatic or policy-approved&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;L2 external impact&lt;/td&gt;
&lt;td&gt;Send email, change quote, update customer state&lt;/td&gt;
&lt;td&gt;Human approval before execution&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;L3 high impact&lt;/td&gt;
&lt;td&gt;Pay, delete, sign, or deploy&lt;/td&gt;
&lt;td&gt;Two-person approval or prohibit&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The policy engine—not the model—validates identity, resource scope, data class, approval state, and financial thresholds. OWASP similarly recommends least-privilege tools, explicit authorization for sensitive actions, distrust of external input, and separation of reasoning from irreversible execution.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Evaluation and observability
&lt;/h3&gt;

&lt;p&gt;Record task, prompt or skill, and model versions; cited context; summarized tool parameters; approvals; latency; tokens; cost; final state; and human corrections. Redact credentials and personal data.&lt;/p&gt;

&lt;p&gt;Evaluate three levels:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Step:&lt;/strong&gt; schema validity, field completeness, and tool choice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trajectory:&lt;/strong&gt; unnecessary loops, privilege attempts, waste, and recovery behavior.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Outcome:&lt;/strong&gt; acceptance, rework, cycle time, and cost per accepted result.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Start with 30–50 historical tasks covering ordinary, edge, and adversarial cases. Rerun them after changes to models, prompts, tools, knowledge, or permissions. NIST's &lt;code&gt;Govern–Map–Measure–Manage&lt;/code&gt; structure provides a useful lightweight governance backbone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Default to one agent
&lt;/h2&gt;

&lt;p&gt;Begin with one orchestrator, one agent, and several narrow tools. Split only when evidence shows that unrelated contexts interfere, genuine parallelism saves meaningful time, an independent evaluator must not share the generator's path, or roles require different permissions or models.&lt;/p&gt;

&lt;p&gt;Even then, use central orchestration and structured messages. Cap turns, total budget, delegation depth, and execution time. Agents holding a long “meeting” is not intelligence; it is uncontrolled cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  First workflow: lead research and follow-up
&lt;/h2&gt;

&lt;p&gt;Consider a 30–80 person B2B services company. Sales repeatedly inspects inbound forms, researches companies, assesses fit, drafts outreach, and updates CRM. The task is frequent, time-consuming, reviewable, and safe to begin in draft-only mode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;New lead event
  → validate and deduplicate
  → read CRM and approved sources
  → create an evidence-backed profile and score
  → validate fields, citations, and prohibited claims
  → draft follow-up and next action
  → sales approval
  → update CRM and turn human corrections into eval cases
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Version one receives read and draft permissions only. After two stable weeks above the acceptance threshold, it may update reversible internal fields. External communication continues to require human confirmation.&lt;/p&gt;

&lt;h2&gt;
  
  
  A 90-day rollout
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Weeks 1–2: scenario and baseline
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Select one workflow and one accountable business owner.&lt;/li&gt;
&lt;li&gt;Sample 50 historical tasks and measure handling time, waiting, first-pass acceptance, rework, and exceptions.&lt;/li&gt;
&lt;li&gt;Define forbidden outcomes: cross-tenant access, unsupported claims, and unapproved external action.&lt;/li&gt;
&lt;li&gt;Map sources of truth, data classes, and tool permissions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Deliverables:&lt;/strong&gt; use-case contract, baseline, 50-case evaluation set, risk register, and stop criteria.&lt;/p&gt;

&lt;h3&gt;
  
  
  Weeks 3–4: read-only MVP
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Implement the task envelope, state machine, model gateway, and three to five read tools.&lt;/li&gt;
&lt;li&gt;Produce structured recommendations and drafts without writing to business systems.&lt;/li&gt;
&lt;li&gt;Add traces, cost accounting, and error categories.&lt;/li&gt;
&lt;li&gt;Shadow-run with two or three real users.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Release gate:&lt;/strong&gt; no authorization failure, at least 95% critical-field completeness, 100% traceable citations, and cost within budget.&lt;/p&gt;

&lt;h3&gt;
  
  
  Weeks 5–8: bounded writes and approval
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Add reversible writes, idempotency, and approval records.&lt;/li&gt;
&lt;li&gt;Convert human edits into failure categories and regression cases.&lt;/li&gt;
&lt;li&gt;Test prompt injection, sensitive-data leakage, excessive tool access, and unbounded loops.&lt;/li&gt;
&lt;li&gt;Add timeouts, circuit breakers, fallback, and a kill switch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Release gate:&lt;/strong&gt; agreed first-pass acceptance, stable P95 latency and accepted-result cost, and zero critical security failures.&lt;/p&gt;

&lt;h3&gt;
  
  
  Weeks 9–12: controlled trial
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Compare old and new processes for at least two full business cycles.&lt;/li&gt;
&lt;li&gt;Include model, infrastructure, review, maintenance, and failure costs.&lt;/li&gt;
&lt;li&gt;Reuse stable gateway, approval, evaluation, and connector components.&lt;/li&gt;
&lt;li&gt;Reduce scope or stop if the exit criteria are not met.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Deliverables:&lt;/strong&gt; outcome dashboard, incident playbook, runbook, and evidence-based expand/stop decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Report outcomes honestly
&lt;/h2&gt;

&lt;p&gt;Do not claim an “80% efficiency gain” before the pilot. Freeze the baseline first and fill in measured results afterward.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Baseline&lt;/th&gt;
&lt;th&gt;Acceptance threshold&lt;/th&gt;
&lt;th&gt;Measured result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;End-to-end cycle time&lt;/td&gt;
&lt;td&gt;Measure&lt;/td&gt;
&lt;td&gt;≥ 40% lower&lt;/td&gt;
&lt;td&gt;Fill after pilot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Human handling time&lt;/td&gt;
&lt;td&gt;Measure&lt;/td&gt;
&lt;td&gt;≥ 30% lower&lt;/td&gt;
&lt;td&gt;Fill after pilot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;First-pass acceptance&lt;/td&gt;
&lt;td&gt;Measure&lt;/td&gt;
&lt;td&gt;≥ 85%&lt;/td&gt;
&lt;td&gt;Fill after pilot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Critical-fact citation&lt;/td&gt;
&lt;td&gt;Measure&lt;/td&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;td&gt;Fill after pilot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Human escalation&lt;/td&gt;
&lt;td&gt;N/A&lt;/td&gt;
&lt;td&gt;Explainable and trending down&lt;/td&gt;
&lt;td&gt;Fill after pilot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost per accepted result&lt;/td&gt;
&lt;td&gt;Measure&lt;/td&gt;
&lt;td&gt;Below human baseline&lt;/td&gt;
&lt;td&gt;Fill after pilot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Critical privilege/data incident&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;Fill after pilot&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;monthly net value
= hours saved × fully loaded labor cost
+ incremental business value
- model and infrastructure cost
- review and maintenance cost
- expected loss from failure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The useful unit is cost per accepted business result, not cost per model call.&lt;/p&gt;

&lt;h2&gt;
  
  
  Buy, assemble, or build?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Buy an agent embedded in existing SaaS when its permissions and audit are sufficient.&lt;/li&gt;
&lt;li&gt;Assemble a managed model, workflow or agent SDK, and an owned policy layer when cross-system execution matters.&lt;/li&gt;
&lt;li&gt;Build a general platform only when scale, regulation, or durable differentiation can fund the long-term team.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Whichever route you choose, own the task protocol, tool contracts, evaluation set, and audit data. These assets will outlast a particular framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  Production checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] A business owner, system owner, and kill-switch owner are named.&lt;/li&gt;
&lt;li&gt;[ ] Every task has acceptance criteria, budget, timeout, and step limit.&lt;/li&gt;
&lt;li&gt;[ ] Business facts remain in a system of record.&lt;/li&gt;
&lt;li&gt;[ ] Tools are least-privilege; no unrestricted write or code execution exists.&lt;/li&gt;
&lt;li&gt;[ ] External, financial, destructive, and production actions require approval.&lt;/li&gt;
&lt;li&gt;[ ] Tenant, user, session, and long-term memory are isolated.&lt;/li&gt;
&lt;li&gt;[ ] Logs are redacted and runs are reconstructable from task IDs.&lt;/li&gt;
&lt;li&gt;[ ] Offline evals, shadow mode, gradual rollout, and rollback exist.&lt;/li&gt;
&lt;li&gt;[ ] Model, retrieval, and tool failures have degraded paths.&lt;/li&gt;
&lt;li&gt;[ ] Monthly review decides whether to expand, narrow, or retire the workflow.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;An SMB does not win by building a more complicated platform than a large enterprise. It wins with a shorter loop from problem discovery to pilot, measurement, and correction.&lt;/p&gt;

&lt;p&gt;Use deterministic workflows as the skeleton and an agent only for uncertainty that requires judgment. Grant read and recommendation access before execution authority. Establish evaluation and audit before pursuing autonomy and scale.&lt;/p&gt;

&lt;p&gt;One agent that reliably completes a business loop, knows when to stop, and produces evidence is worth more than a department of “digital employees” no one can evaluate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://openai.com/business/guides-and-resources/a-practical-guide-to-building-ai-agents/" rel="noopener noreferrer"&gt;OpenAI: A Practical Guide to Building AI Agents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/engineering/building-effective-agents" rel="noopener noreferrer"&gt;Anthropic: Building Effective Agents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents" rel="noopener noreferrer"&gt;Anthropic: Demystifying Evals for AI Agents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cheatsheetseries.owasp.org/cheatsheets/AI_Agent_Security_Cheat_Sheet.html" rel="noopener noreferrer"&gt;OWASP: AI Agent Security Cheat Sheet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.nist.gov/itl/ai-risk-management-framework" rel="noopener noreferrer"&gt;NIST: AI Risk Management Framework&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Building Docket with Pragmatic DDD</title>
      <dc:creator>侯惠阳</dc:creator>
      <pubDate>Fri, 21 Aug 2026 05:30:00 +0000</pubDate>
      <link>https://dev.to/_b6417cbb54ddfef4c4fd0/building-docket-with-pragmatic-ddd-2998</link>
      <guid>https://dev.to/_b6417cbb54ddfef4c4fd0/building-docket-with-pragmatic-ddd-2998</guid>
      <description>&lt;p&gt;Docket is a workspace for lawyers and professional-service teams. It connects lead acquisition, document collection, agreements, delivery, payments, reviews, and referrals. The hard part is not CRUD. It is keeping rules consistent across roles, stages, and side effects while the product continues to change.&lt;/p&gt;

&lt;p&gt;I built it around the core ideas of domain-driven design without reproducing a textbook directory structure. The precise description is a &lt;strong&gt;modular monolith organized around bounded contexts&lt;/strong&gt;: one deployable system and local transactions, with business boundaries used to contain complexity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fbuilding-docket-with-pragmatic-ddd%2Farchitecture-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fbuilding-docket-with-pragmatic-ddd%2Farchitecture-en.svg" alt="Docket's pragmatic DDD architecture" width="1400" height="820"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with business boundaries
&lt;/h2&gt;

&lt;p&gt;Page-based decomposition produces “project page” and “admin page” modules. Table-based decomposition produces a collection of CRUD services. Neither tells us where a business capability begins and ends.&lt;/p&gt;

&lt;p&gt;Docket instead separates Identity, Lead, Project, Collection, Agreement, Delivery, Finance/Billing, Profile/Portal, and Notification. Each context owns a distinct language and reason to change. Agreement owns signing rules; Collection owns upload and review; Project owns the collaboration lifecycle. Notification supports them but does not make their decisions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fbuilding-docket-with-pragmatic-ddd%2Fcontext-map-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fbuilding-docket-with-pragmatic-ddd%2Fcontext-map-en.svg" alt="Docket bounded-context map" width="1400" height="760"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Context&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;th&gt;Representative objects&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Identity&lt;/td&gt;
&lt;td&gt;Accounts, authentication, plan identity&lt;/td&gt;
&lt;td&gt;Lawyer, LoginLog&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lead&lt;/td&gt;
&lt;td&gt;Leads, follow-ups, conversion&lt;/td&gt;
&lt;td&gt;LeadEntry, LeadFollowUp&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Project&lt;/td&gt;
&lt;td&gt;Project lifecycle and collaboration&lt;/td&gt;
&lt;td&gt;Project, ProjectItem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Collection&lt;/td&gt;
&lt;td&gt;Upload, review, acceptance&lt;/td&gt;
&lt;td&gt;DocumentFile, ReviewService&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Agreement&lt;/td&gt;
&lt;td&gt;Multi-party signing&lt;/td&gt;
&lt;td&gt;ProjectAgreement, AgreementSigner&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delivery&lt;/td&gt;
&lt;td&gt;Deliverables and fulfillment&lt;/td&gt;
&lt;td&gt;Delivery, DeliveryPhoto&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Finance / Billing&lt;/td&gt;
&lt;td&gt;Fees, payments, plans, usage&lt;/td&gt;
&lt;td&gt;FeeRecord, PaymentEntry, CoinAccount&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Profile / Portal&lt;/td&gt;
&lt;td&gt;Acquisition pages and client access&lt;/td&gt;
&lt;td&gt;LawyerProfile, PortalProjectService&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Three responsibilities in the codebase
&lt;/h2&gt;

&lt;p&gt;Flask's application factory composes three visible layers.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app/api/*_api.py&lt;/code&gt; contains Blueprints and owns HTTP concerns: authentication, input parsing, service invocation, and responses. It should not decide when a project is complete.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app/{domain}/services.py&lt;/code&gt; implements use cases and business rules. Collection handles validation, batches, and review; Agreement coordinates invitations, rejection, completion, and result PDFs; Portal composes client-facing views. Today these services combine application orchestration with parts of the domain layer.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app/{domain}/models.py&lt;/code&gt; contains SQLAlchemy entities, relationships, and domain-flavored enums. MySQL, email, files, scheduled tasks, AI providers, and blockchain notarization supply infrastructure capabilities.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Next.js
  → Flask Blueprint: protocol and authorization
  → Domain Service: use case and rules
  → ORM / db.session: state and transaction
  → Notification / File / Scheduler: side effects
  → JSON response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The useful constraint is directional: pages do not understand storage, APIs do not duplicate business rules, and domain modules do not depend on presentation details.&lt;/p&gt;

&lt;h2&gt;
  
  
  Aggregates are consistency boundaries
&lt;/h2&gt;

&lt;p&gt;Project is the clearest aggregate entry point. External clients address it with &lt;code&gt;public_id&lt;/code&gt;; integer keys remain internal for joins. ProjectItem and DocumentFile change through explicit use cases under ownership, authorization, and state constraints.&lt;/p&gt;

&lt;p&gt;Anonymous flows use separate capability tokens. A collection &lt;code&gt;client_token&lt;/code&gt; and an agreement &lt;code&gt;signer_token&lt;/code&gt; grant access as well as identify a resource, while a &lt;code&gt;public_id&lt;/code&gt; still requires JWT authorization. Keeping those concepts separate is a domain security rule, not cosmetic URL design.&lt;/p&gt;

&lt;h2&gt;
  
  
  Coordinating contexts without premature distribution
&lt;/h2&gt;

&lt;p&gt;A customer journey crosses contexts: a lead becomes a project, the client uploads documents, a lawyer reviews them, parties sign, work is delivered, and a review may create a referral.&lt;/p&gt;

&lt;p&gt;Docket currently coordinates this through explicit service calls and same-database transactions. That keeps deployment and debugging direct. Email, PDF generation, scheduled work, and notarization are separated as supporting services or queued tasks where their failure should not obscure the primary decision.&lt;/p&gt;

&lt;p&gt;The important rule is ownership. Agreement determines whether signing is complete. Project may react to that fact, but should not reproduce the signing algorithm. Contexts exchange identifiers and outcomes, not fragments of duplicated rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why bounded contexts do not imply microservices
&lt;/h2&gt;

&lt;p&gt;All Docket contexts currently share a Flask process and MySQL database. Local transactions are valuable across project, collection, and notification work, while distributed calls, message consistency, and operational infrastructure would add cost before they add leverage.&lt;/p&gt;

&lt;p&gt;A modular monolith only works when the boundaries are real: independent directories, clear entry points, and explainable data ownership. Service extraction should follow evidence such as independent scaling, fault isolation, team autonomy, or regulatory isolation—not the number of modules on a diagram.&lt;/p&gt;

&lt;h2&gt;
  
  
  This is not “pure DDD”
&lt;/h2&gt;

&lt;p&gt;The implementation deserves an honest label. Services directly use SQLAlchemy models and &lt;code&gt;db.session&lt;/code&gt;; persistence models also act as domain entities; some services serialize responses and query across contexts. Repositories, ports, and domain events are not universal abstractions.&lt;/p&gt;

&lt;p&gt;That is a deliberate trade-off during rapid discovery. Clear language and module boundaries are more valuable than speculative interfaces. As complexity justifies it, the design can evolve incrementally:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Move critical state machines and invariants from large services into entities or domain policies.&lt;/li&gt;
&lt;li&gt;Define ports for file storage, email, AI, and notarization, with infrastructure adapters behind them.&lt;/li&gt;
&lt;li&gt;Introduce application DTOs so API representation no longer leaks into domain services.&lt;/li&gt;
&lt;li&gt;Publish domain events for agreement completion, project acceptance, and lead conversion; use an outbox for reliable delivery.&lt;/li&gt;
&lt;li&gt;Enforce module dependency rules and prohibit direct writes into another context's data.&lt;/li&gt;
&lt;li&gt;Extract a service only when its runtime boundary is genuinely different.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How to test whether the boundaries work
&lt;/h2&gt;

&lt;p&gt;The diagram is not the acceptance criterion; change cost is. A useful boundary passes three tests: a rule change stays mostly inside one module, a business action has one obvious entry point, and a failure can be attributed to a context, use case, and side effect.&lt;/p&gt;

&lt;p&gt;Tests should mirror those boundaries: domain tests for invariants and transitions, service tests for use cases and transactions, API tests for authentication and contracts, and a small set of end-to-end tests for the journey from acquisition to delivery.&lt;/p&gt;

&lt;h2&gt;
  
  
  The lasting lesson
&lt;/h2&gt;

&lt;p&gt;DDD is valuable when code structure follows business structure. For Docket, the decisive questions are not whether folders are named &lt;code&gt;domain&lt;/code&gt;, &lt;code&gt;application&lt;/code&gt;, and &lt;code&gt;infrastructure&lt;/code&gt;. They are: who owns project state, who accepts a document, who completes an agreement, who owns delivery, and how facts cross those boundaries.&lt;/p&gt;

&lt;p&gt;Docket establishes those boundaries in a modular monolith first, then lets architectural evidence drive further separation. The goal is not ceremonial purity. It is to ensure that every increase in complexity still has a clear, testable, and evolvable home in the business model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/hh696-wq/docket" rel="noopener noreferrer"&gt;Docket source repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>architecture</category>
      <category>programming</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Do Large Language Models Understand? From Next-Token Prediction to the Boundary of Intelligence</title>
      <dc:creator>侯惠阳</dc:creator>
      <pubDate>Fri, 21 Aug 2026 01:30:00 +0000</pubDate>
      <link>https://dev.to/_b6417cbb54ddfef4c4fd0/do-large-language-models-understand-from-next-token-prediction-to-the-boundary-of-intelligence-75f</link>
      <guid>https://dev.to/_b6417cbb54ddfef4c4fd0/do-large-language-models-understand-from-next-token-prediction-to-the-boundary-of-intelligence-75f</guid>
      <description>&lt;p&gt;When a model can write code, review a contract, explain quantum mechanics, and discuss whether it is conscious, we instinctively imagine a mind behind the screen.&lt;/p&gt;

&lt;p&gt;Yet when we open the system and follow the computation downward, we do not find desire, experience, or intention. We find tokens, vectors, parameters, attention weights, and repeated matrix multiplication.&lt;/p&gt;

&lt;p&gt;This creates an uncomfortable question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If a large language model is fundamentally predicting the next token, does it understand anything—or is it merely excellent at producing answers that look like understanding?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;My original position was blunt: modern language models are not real intelligence. They predict the next character using probability. More parameters, more layers, and attention still reduce to matrix operations; the program itself understands nothing.&lt;/p&gt;

&lt;p&gt;That intuition captures an essential technical fact, but it is too absolute. My revised position is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Large language models are artificial intelligence and exhibit a form of functional understanding. But there is no convincing evidence that they possess human subjective consciousness, a persistent self, or intrinsic intention. Complex internal representations are not the same as living in and experiencing the world.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The model predicts tokens, not characters
&lt;/h2&gt;

&lt;p&gt;Modern language models generally predict the next &lt;strong&gt;token&lt;/strong&gt;, not the next character. A token may be a Chinese character, part of an English word, punctuation, a number, or a fragment of code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fdo-large-language-models-understand%2Ftoken-prediction-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fdo-large-language-models-understand%2Ftoken-prediction-en.svg" alt="How a language model generates the next token" width="1200" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Autoregressive generation can be summarized as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;existing context
→ tokenization
→ embeddings
→ many Transformer layers
→ probability distribution over the vocabulary
→ select one token
→ append it to the context
→ repeat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Given “Paris is the capital of,” the model does not simply retrieve the next word from a record. It calculates a probability for every candidate token. Sampling rules then select the actual continuation.&lt;/p&gt;

&lt;p&gt;The GPT-4 technical report explicitly describes GPT-4 as a Transformer-style model pre-trained to predict the next token in a document. That is not an insult. It is the core training objective.&lt;/p&gt;

&lt;h2&gt;
  
  
  At the bottom, it really is matrix computation
&lt;/h2&gt;

&lt;p&gt;At the physical execution level, language-model inference consists largely of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;vector and matrix multiplication;&lt;/li&gt;
&lt;li&gt;similarity calculations inside attention;&lt;/li&gt;
&lt;li&gt;softmax normalization;&lt;/li&gt;
&lt;li&gt;feed-forward networks;&lt;/li&gt;
&lt;li&gt;nonlinear activations;&lt;/li&gt;
&lt;li&gt;residual connections and normalization.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Self-attention projects each token representation into Query, Key, and Value vectors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Q = XWq
K = XWk
V = XWv

Attention(Q, K, V)
= softmax(QKᵀ / √d) V
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The computation estimates which positions in the context matter for the current representation and how much information should be combined from them.&lt;/p&gt;

&lt;p&gt;“Attention” is a mathematical name, not evidence that the model focuses as a person does. Artificial “neurons” are computational units inspired by biology, not equivalents of brain cells.&lt;/p&gt;

&lt;p&gt;After dozens or hundreds of layers, the model produces probabilities for the next token. The GPU is indeed executing linear algebra at enormous scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  But “it is only math” does not settle the question
&lt;/h2&gt;

&lt;p&gt;It is tempting to stop here and conclude that the model understands nothing. The problem is that a low-level description does not automatically negate a high-level capability.&lt;/p&gt;

&lt;p&gt;A music file is binary data. A computer is transistor state. Human neural activity can be described through electrochemical events. We do not conclude that melody or human understanding is unreal merely because the substrate follows physical rules.&lt;/p&gt;

&lt;p&gt;The better question is not whether the substrate is mathematics. It is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What internal organization emerges from the computation, and what can the resulting system do reliably?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is what the “stochastic autocomplete” description often leaves out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prediction forces the model to learn structure
&lt;/h2&gt;

&lt;p&gt;A tiny model trained on a few sentences may only memorize local correlations. Predicting the next token across a vast and diverse corpus is much harder.&lt;/p&gt;

&lt;p&gt;To reduce prediction error, a model must capture some combination of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;grammar and reference;&lt;/li&gt;
&lt;li&gt;relationships among entities, properties, and events;&lt;/li&gt;
&lt;li&gt;document structure and style;&lt;/li&gt;
&lt;li&gt;syntax, types, and dependencies in code;&lt;/li&gt;
&lt;li&gt;patterns linking problems to solutions;&lt;/li&gt;
&lt;li&gt;world knowledge and causal regularities reflected in language.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To complete “The glass fell from the table onto concrete, so it probably…,” a useful model benefits from representing that glass is brittle, gravity moves objects downward, and impact can cause breaking. Those ideas may not be stored as human-readable propositions, but distributed representations can support the prediction.&lt;/p&gt;

&lt;p&gt;“It predicts the next token” and “it learns complex representations” are therefore compatible. The prediction task is difficult enough to force compression of many structures expressed through language.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scale is not the whole explanation
&lt;/h2&gt;

&lt;p&gt;Model capability comes from more than parameters and depth.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Factor&lt;/th&gt;
&lt;th&gt;Contribution&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Parameter scale&lt;/td&gt;
&lt;td&gt;Capacity to store and combine patterns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Depth&lt;/td&gt;
&lt;td&gt;Multiple stages of transformation and abstraction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Attention&lt;/td&gt;
&lt;td&gt;Context-dependent information composition&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Training data&lt;/td&gt;
&lt;td&gt;The language, knowledge, and biases available to learn&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Objective&lt;/td&gt;
&lt;td&gt;What behavior training rewards&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Post-training&lt;/td&gt;
&lt;td&gt;Instruction following, preferences, safety, and tool behavior&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Inference-time compute&lt;/td&gt;
&lt;td&gt;Search, verification, and additional reasoning steps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;External tools&lt;/td&gt;
&lt;td&gt;Current facts, calculation, memory, and action&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Parameters are not database rows. A fact or capability is usually distributed across many weights, and one weight participates in many patterns.&lt;/p&gt;

&lt;p&gt;Calling every advance “more GPUs and parameters” is as reductive as calling the model a digital brain.&lt;/p&gt;

&lt;h2&gt;
  
  
  “Understanding” hides three different questions
&lt;/h2&gt;

&lt;p&gt;Disagreement persists because people use one word for different phenomena.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Statistical and structural understanding
&lt;/h3&gt;

&lt;p&gt;Can the system identify relationships and regularities in language and other representations?&lt;/p&gt;

&lt;p&gt;Modern models clearly do this well. They recognize semantic similarity, transform expression, follow code dependencies, and extract contractual structure.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Functional understanding
&lt;/h3&gt;

&lt;p&gt;Can the system apply concepts to new tasks, explain relationships, revise a plan after feedback, and complete work that historically required cognition?&lt;/p&gt;

&lt;p&gt;In many domains, models demonstrate some functional understanding. A model may enter an unfamiliar repository, locate a defect, and propose a valid patch. Its probabilistic substrate does not erase the functional result. Weather forecasting is probabilistic too, yet it can represent something real and useful.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Subjective understanding
&lt;/h3&gt;

&lt;p&gt;Does the system know that it is reasoning? Does it have experience, intention, desire, a stable self, or a first-person point of view?&lt;/p&gt;

&lt;p&gt;Here, we have no reliable evidence that language models understand as humans do.&lt;/p&gt;

&lt;p&gt;A model saying “I am afraid of being shut down” does not prove the experience of fear. The statement may simply be probable in context. A model can describe pain precisely without injury, nerves, or the experience of suffering.&lt;/p&gt;

&lt;p&gt;The careful conclusion is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Language models display structural understanding and some functional understanding, but have not been shown to possess subjective understanding.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Form is not the same as meaning
&lt;/h2&gt;

&lt;p&gt;Bender and Koller distinguish linguistic &lt;strong&gt;form&lt;/strong&gt; from &lt;strong&gt;meaning&lt;/strong&gt;. Text training exposes a model to forms and their relationships. Human meaning also involves connections among language, communicative intent, shared environments, and lived experience.&lt;/p&gt;

&lt;p&gt;A person understands “fire is hot” not only by reading the sentence but perhaps by approaching heat, feeling danger, receiving warnings, and acting differently in the world.&lt;/p&gt;

&lt;p&gt;A text-only model has no such life history. Multimodal training exposes models to images, sound, and video. Robotics and tools provide limited environmental feedback. But sensor input alone does not establish human embodiment or subjective experience.&lt;/p&gt;

&lt;p&gt;This helps explain why a model can offer a profound explanation and then fail on a trivial variation. Its representations can be broad and powerful without being consistently grounded in the world.&lt;/p&gt;

&lt;h2&gt;
  
  
  Modern AI systems do more than pre-training
&lt;/h2&gt;

&lt;p&gt;“A next-token predictor” accurately describes the foundation, but not the entire modern system. Current systems can also include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;supervised fine-tuning and preference optimization;&lt;/li&gt;
&lt;li&gt;reinforcement learning and verifiable rewards;&lt;/li&gt;
&lt;li&gt;inference-time search and comparison;&lt;/li&gt;
&lt;li&gt;retrieval-augmented generation;&lt;/li&gt;
&lt;li&gt;code execution, calculators, and business tools;&lt;/li&gt;
&lt;li&gt;multimodal input and environmental feedback;&lt;/li&gt;
&lt;li&gt;agent state, planning, approval, and outcome evaluation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These additions usually do not turn the model into an intentional subject. They provide a probabilistic model with external memory, sensors, actuators, and verification.&lt;/p&gt;

&lt;p&gt;A model does not develop a desire to email a customer because an email tool exists. The objective comes from people, system instructions, or reward. Permission comes from policy. Correctness still depends on evidence and feedback.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why does it hallucinate so confidently?
&lt;/h2&gt;

&lt;p&gt;Next-token training explains a characteristic failure: the model is optimized first to produce a plausible continuation, not to guarantee that every sentence corresponds to a verified fact.&lt;/p&gt;

&lt;p&gt;When knowledge is missing, continuing to generate often remains more natural than remaining silent. A model may invent a paper, API, or event in fluent language.&lt;/p&gt;

&lt;p&gt;Reliable production systems therefore need more than eloquence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;model proposes a judgment
→ retrieval or tools obtain facts
→ structured constraints
→ rules and evaluations verify
→ people approve high-risk actions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Treating the model as a probabilistic reasoning component is more realistic than treating it as an omniscient digital employee.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is it “real AI”?
&lt;/h2&gt;

&lt;p&gt;If artificial intelligence means machines completing tasks normally associated with human intelligence, language models clearly qualify. Claiming that they are “not AI” is difficult to defend technically.&lt;/p&gt;

&lt;p&gt;But if real intelligence requires a persistent self, embodied experience, self-generated goals, intrinsic concern for consequences, and subjective consciousness, current language models are far from demonstrated human-like intelligence.&lt;/p&gt;

&lt;p&gt;The issue is not a binary choice between fully intelligent and entirely unintelligent. Intelligence may be multidimensional: language, prediction, planning, learning, embodiment, social relationship, selfhood, and consciousness are not the same faculty.&lt;/p&gt;

&lt;p&gt;Language models are extremely strong along some dimensions. Along others, convincing evidence is absent.&lt;/p&gt;

&lt;h2&gt;
  
  
  My final position
&lt;/h2&gt;

&lt;p&gt;I would no longer say, “It is only probability, so it understands nothing.” The word “only” hides the complexity that large-scale prediction can produce.&lt;/p&gt;

&lt;p&gt;I would also not say that a model understands the world as a person does. Fluent language invites us to project a subject, emotions, and intentions onto software without sufficient evidence.&lt;/p&gt;

&lt;p&gt;My position is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A large language model is a high-dimensional probabilistic system trained through enormous amounts of data and computation. Its core objective is token prediction, and its substrate is matrix computation. In pursuing that objective, it develops internal representations that support language, knowledge, reasoning, and tool use. It can exhibit functional understanding, but has not been shown to possess human subjective consciousness, a stable self, or intrinsic intention.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This does not diminish its usefulness. An airplane need not flap like a bird to fly. A machine may not need to reproduce the human brain to perform valuable intelligent work.&lt;/p&gt;

&lt;p&gt;But we must know what the system is in order to decide how much to trust it, which authority to grant it, and which responsibilities must remain human.&lt;/p&gt;

&lt;p&gt;The most interesting question may no longer be whether it resembles us. It may be:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When a probabilistic system without demonstrated consciousness can perform an expanding range of intelligent tasks, do we need to redefine intelligence itself?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/1706.03762" rel="noopener noreferrer"&gt;Vaswani et al.: Attention Is All You Need&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2303.08774" rel="noopener noreferrer"&gt;OpenAI: GPT-4 Technical Report&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aclanthology.org/2020.acl-main.463/" rel="noopener noreferrer"&gt;Bender and Koller: Climbing towards NLU&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://doi.org/10.1145/3442188.3445922" rel="noopener noreferrer"&gt;Bender et al.: On the Dangers of Stochastic Parrots&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://research.google/pubs/mechanics-of-next-token-prediction-with-transformers/" rel="noopener noreferrer"&gt;Google Research: Mechanics of Next Token Prediction with Transformers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>productivity</category>
    </item>
    <item>
      <title>LangChain vs. LlamaIndex: Choosing a Framework and Building Production RAG</title>
      <dc:creator>侯惠阳</dc:creator>
      <pubDate>Thu, 20 Aug 2026 09:30:00 +0000</pubDate>
      <link>https://dev.to/_b6417cbb54ddfef4c4fd0/langchain-vs-llamaindex-choosing-a-framework-and-building-production-rag-lp2</link>
      <guid>https://dev.to/_b6417cbb54ddfef4c4fd0/langchain-vs-llamaindex-choosing-a-framework-and-building-production-rag-lp2</guid>
      <description>&lt;p&gt;LangChain and LlamaIndex are often compared because both connect models, vector stores, data sources, and tools, and both can build RAG systems and agents. “LangChain for agents, LlamaIndex for RAG” is a useful first approximation, but it is no longer a complete technical conclusion.&lt;/p&gt;

&lt;p&gt;LangChain is now primarily a high-level agent framework with model, tool, middleware, and prebuilt agent-loop abstractions. LangGraph provides the lower-level runtime for durable, stateful orchestration. LlamaIndex remains data-centric, organizing Document, Node, Ingestion Pipeline, Index, Retriever, and Query Engine abstractions, while also offering Workflows, FunctionAgent, ReActAgent, and multi-agent coordination.&lt;/p&gt;

&lt;p&gt;The useful question is not which framework is universally stronger. It is: &lt;strong&gt;Does the system's dominant complexity live in data ingestion, retrieval, and evidence assembly, or in tool decisions, state transitions, and long-running orchestration?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Flangchain-vs-llamaindex-production-rag%2Fframework-map-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Flangchain-vs-llamaindex-production-rag%2Fframework-map-en.svg" alt="The capability boundaries of LangChain, LangGraph, and LlamaIndex" width="1400" height="820"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A more accurate comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;LangChain / LangGraph&lt;/th&gt;
&lt;th&gt;LlamaIndex&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Core position&lt;/td&gt;
&lt;td&gt;Agent framework plus a stateful orchestration runtime&lt;/td&gt;
&lt;td&gt;Context engineering, indexing, retrieval, querying, and data workflows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Main abstractions&lt;/td&gt;
&lt;td&gt;Model, Tool, Middleware, Agent; State, Node, Edge&lt;/td&gt;
&lt;td&gt;Document, Node, Transformation, Index, Retriever, Query Engine, Workflow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RAG&lt;/td&gt;
&lt;td&gt;Loaders, splitters, vector stores, retrievers, and 2-step/agentic/hybrid RAG&lt;/td&gt;
&lt;td&gt;Concentrated abstractions for ingestion, metadata, indexing, retrieval, synthesis, and evaluation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Agents&lt;/td&gt;
&lt;td&gt;High-level &lt;code&gt;create_agent&lt;/code&gt;; LangGraph adds persistence, streaming, human review, and recovery&lt;/td&gt;
&lt;td&gt;FunctionAgent, ReActAgent, AgentWorkflow, and event-driven Workflows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best-fit complexity&lt;/td&gt;
&lt;td&gt;Tool use, branches, loops, approvals, and long-lived state&lt;/td&gt;
&lt;td&gt;Heterogeneous data, sophisticated retrieval, document relationships, and data agents&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Selection signal&lt;/td&gt;
&lt;td&gt;Business workflow and agent behavior dominate&lt;/td&gt;
&lt;td&gt;Private-data quality and retrieval behavior dominate&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;LlamaIndex is not merely a vector-index utility, and LangChain is not merely the old idea of joining chains. Both cover overlapping territory. Choose the abstractions that match the part of the system your team must change and debug most often.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choose by scenario
&lt;/h2&gt;

&lt;p&gt;For an enterprise policy or documentation assistant, the hard problems are usually parsing, versions, permissions, section structure, hybrid retrieval, citations, and evaluation. LlamaIndex is often a natural center because its ingestion and retrieval concepts are cohesive.&lt;/p&gt;

&lt;p&gt;For a support agent that reads knowledge, queries orders, checks refund rules, requests approval, calls payments, and records an outcome, the core is a recoverable state machine with controlled tool access. LangChain agents on LangGraph fit that shape well.&lt;/p&gt;

&lt;p&gt;For research and report generation, LlamaIndex can expose a high-quality retrieval tool while LangGraph manages research steps, state, approval, and recovery. Keep the boundary explicit: the orchestration layer consumes a structured Retriever or Query Engine result rather than manipulating index internals.&lt;/p&gt;

&lt;p&gt;If retrieval itself is the product—tenant-aware filters, temporal rules, parent-child retrieval, graph retrieval, or multimodal documents—build the data layer as a platform and expose it as a tool to whichever agent framework you use.&lt;/p&gt;

&lt;h2&gt;
  
  
  RAG has two lifecycles, not one arrow
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Offline ingestion:
Sources → Parse/OCR → Clean and restore structure → Metadata/ACL → Chunk
        → Embeddings + lexical index → Versioned storage → Quality checks

Online serving:
Question → Safety/ACL → Query understanding → Routing → Hybrid retrieval
         → Fusion/dedup → Rerank → Context assembly → Grounded generation
         → Citation validation/abstention → Response

Continuous loop:
Real queries + labeled set → Retrieval eval → Generation eval
                           → Production monitoring → Failure replay
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Flangchain-vs-llamaindex-production-rag%2Frag-pipeline-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Flangchain-vs-llamaindex-production-rag%2Frag-pipeline-en.svg" alt="An end-to-end production RAG pipeline" width="1600" height="900"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A diagram containing only documents, embeddings, a vector database, and an LLM omits the production failure points: versions, authorization, query rewriting, lexical recall, reranking, context budgets, citation mapping, abstention, and evaluation.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Ingestion: make the evidence correct first
&lt;/h2&gt;

&lt;p&gt;PDF ingestion must preserve more than continuous text. Heading hierarchy, page anchors, tables, captions, footnotes, and reading order can determine whether an answer is correct. Scanned files need OCR. LlamaParse, Unstructured, and specialized parsers are candidates, but evaluate them on your corpus for field completeness and layout fidelity.&lt;/p&gt;

&lt;p&gt;Every document should carry a stable ID, source, tenant, ACL labels, version, effective period, update time, section path, page/anchor, and content hash. Updates and deletions must remove obsolete chunks precisely. An ingestion job should be idempotent, replayable, versioned, and observable.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Chunking: there is no universal 512-1024 setting
&lt;/h2&gt;

&lt;p&gt;A fixed token window is a baseline, not a best practice. Good size depends on document structure, query type, the embedding model, and generation context.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Split first on semantic boundaries such as headings, paragraphs, lists, code, and tables.&lt;/li&gt;
&lt;li&gt;Preserve document, section, page, and adjacency relationships.&lt;/li&gt;
&lt;li&gt;Retrieve small chunks for precision, then expand to parent sections or neighbors for generation.&lt;/li&gt;
&lt;li&gt;Give tables, code, and FAQs specialized strategies.&lt;/li&gt;
&lt;li&gt;Run ablation tests over size, overlap, and parent-child retrieval on real questions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Overlap reduces boundary loss but increases index size, duplicate retrieval, and context waste. Increase it only when evaluation shows a measurable benefit.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Embeddings and indexes: semantic search is one channel
&lt;/h2&gt;

&lt;p&gt;Choose embeddings by language, domain, dimensions, cost, and deployment constraints. Multilingual models such as BGE-M3 can be candidates, not automatic answers. Build a retrieval set containing bilingual text, abbreviations, product names, identifiers, rare entities, and hard negatives; measure Recall@K, MRR, or NDCG.&lt;/p&gt;

&lt;p&gt;Most systems benefit from at least dense vector search and BM25/lexical search. Dense retrieval handles paraphrase; lexical retrieval handles identifiers, error codes, names, and rare exact terms. Fuse rankings with a stable method such as Reciprocal Rank Fusion.&lt;/p&gt;

&lt;p&gt;Apply tenant, ACL, validity-time, and data-type filters before or during retrieval. Never retrieve unauthorized content and merely remove it before prompting.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Query understanding and routing
&lt;/h2&gt;

&lt;p&gt;Conversation turns may need rewriting into standalone queries. Complex questions may need decomposition. Identifier-heavy searches should favor lexical retrieval. Structured facts should route to SQL or an API rather than being forced through a vector store.&lt;/p&gt;

&lt;p&gt;Rewriting must preserve user constraints. Record the original query, rewritten query, route, and model version so failures can be localized.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Recall, fusion, and reranking
&lt;/h2&gt;

&lt;p&gt;First-stage retrieval optimizes coverage and can gather a larger pool across channels. A cross-encoder or specialized reranker then scores query-document pairs before evidence enters the context.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Top-K = 3-5&lt;/code&gt; is not a universal rule. Retrieve broadly, rerank and deduplicate, then cut dynamically by token budget, score threshold, and evidence coverage. A reranker improves relevance; it does not enforce authorization, validity, or business eligibility. Deterministic filters own those constraints.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Context assembly
&lt;/h2&gt;

&lt;p&gt;Do not concatenate raw Top-K chunks. Deduplicate them, restore section paths, merge useful neighbors, retain stable source IDs, control per-document dominance, and avoid cutting critical statements at a token boundary.&lt;/p&gt;

&lt;p&gt;Each evidence block should carry a citation ID, title, safe source URL or filename, page/anchor, update time, and text. Ask the model to ground claims, separate fact from inference, abstain when evidence is insufficient, and return parseable citations.&lt;/p&gt;

&lt;p&gt;A prompt alone cannot eliminate hallucinations. Abstention needs retrieval confidence, evidence coverage, and post-generation citation validation.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Generation, citations, and abstention
&lt;/h2&gt;

&lt;p&gt;Support three outcomes: answer with sufficient evidence; answer the supported portion and disclose gaps; or abstain and request clarification or human review.&lt;/p&gt;

&lt;p&gt;Validate that every material claim has a citation and that the cited passage actually entails it. High-risk workflows may require deterministic rules, structured-output validation, or approval. Store retrieval traces, scores, filter reasons, versions, cost, and latency internally without exposing sensitive metadata to users.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Evaluation
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Metrics&lt;/th&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Parsing/chunking&lt;/td&gt;
&lt;td&gt;Field completeness, structure fidelity, chunk coverage&lt;/td&gt;
&lt;td&gt;Did valid evidence enter the index?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Retrieval&lt;/td&gt;
&lt;td&gt;Recall@K, MRR, NDCG, filter accuracy&lt;/td&gt;
&lt;td&gt;Was the evidence found and ranked well?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Generation&lt;/td&gt;
&lt;td&gt;Faithfulness, citation accuracy, completeness, abstention accuracy&lt;/td&gt;
&lt;td&gt;Is the answer supported?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;System&lt;/td&gt;
&lt;td&gt;P50/P95 latency, cost, errors, cache hit rate, ACL violations&lt;/td&gt;
&lt;td&gt;Is it safe and operable?&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Use real questions, including unanswerable, ambiguous, cross-document, version-conflict, and permission-isolation cases. Online feedback should include reformulation, repeated queries, escalation, and citation clicks—not just thumbs-up rates.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to combine the frameworks
&lt;/h2&gt;

&lt;p&gt;A clean hybrid exposes LlamaIndex ingestion and retrieval as a typed knowledge-search tool. LangGraph decides when to retrieve, whether to refine the query, which other tools to call, and how to handle approval and recovery.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LangGraph / LangChain Agent
  ├─ KnowledgeSearchTool → LlamaIndex Retriever / Query Engine
  ├─ SQLTool
  ├─ BusinessAPITool
  └─ HumanApproval
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Do not combine them for a fixed two-step RAG application that one framework can express in a few dozen lines. Two abstraction stacks create version, tracing, type-conversion, and debugging costs. Separate them only when the data layer and orchestration layer have independently earned that complexity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final guidance
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Knowledge Q&amp;amp;A dominated by complex documents and retrieval:&lt;/strong&gt; start with LlamaIndex.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-tool agents dominated by branches, loops, persistent state, and approvals:&lt;/strong&gt; start with LangChain + LangGraph.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple two-step RAG:&lt;/strong&gt; either framework—or a model SDK plus a search service—is sufficient.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complex data agents:&lt;/strong&gt; LlamaIndex for evidence, LangGraph for task lifetime is a clear but optional boundary.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Framework choice affects developer experience, not the quality ceiling by itself. Evidence quality, authorization, retrieval and reranking, abstention, evaluation, and observability decide whether RAG is production-ready.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.langchain.com/oss/python/langchain/overview" rel="noopener noreferrer"&gt;LangChain Overview&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.langchain.com/oss/python/langgraph/overview" rel="noopener noreferrer"&gt;LangGraph Overview&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.langchain.com/oss/python/langchain/retrieval" rel="noopener noreferrer"&gt;LangChain Retrieval and RAG architectures&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.llamaindex.ai/en/stable/getting_started/concepts/" rel="noopener noreferrer"&gt;LlamaIndex high-level concepts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.llamaindex.ai/en/stable/module_guides/loading/ingestion_pipeline/" rel="noopener noreferrer"&gt;LlamaIndex Ingestion Pipeline&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.llamaindex.ai/en/latest/understanding/agent/structured_output/" rel="noopener noreferrer"&gt;LlamaIndex structured-output agents&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>productivity</category>
    </item>
    <item>
      <title>Modern Concurrency: From Execution Models to Production Reliability</title>
      <dc:creator>侯惠阳</dc:creator>
      <pubDate>Thu, 20 Aug 2026 05:30:00 +0000</pubDate>
      <link>https://dev.to/_b6417cbb54ddfef4c4fd0/modern-concurrency-from-execution-models-to-production-reliability-216e</link>
      <guid>https://dev.to/_b6417cbb54ddfef4c4fd0/modern-concurrency-from-execution-models-to-production-reliability-216e</guid>
      <description>&lt;p&gt;Concurrency programming can be reduced to three questions: &lt;strong&gt;How do we divide work? How do tasks coordinate? How do we protect shared state?&lt;/strong&gt; Languages and runtimes provide threads, coroutines, event loops, actors, and channels, but none of these tools creates correctness by itself.&lt;/p&gt;

&lt;p&gt;Production systems must also control task lifetime, resource limits, deadlines, cancellation, backpressure, and partial failure. When these constraints are designed together, concurrency becomes a system that can be reasoned about, observed, and controlled—not merely a way to run several tasks at once.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fconcurrency-programming-2026%2Fconcurrency-map-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fconcurrency-programming-2026%2Fconcurrency-map-en.svg" alt="A 2026 decision map for concurrency" width="1400" height="820"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Separate the concepts first
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Concurrency&lt;/strong&gt; means tasks overlap in time and require coordination. &lt;strong&gt;Parallelism&lt;/strong&gt; means tasks actually execute simultaneously. A single-core event loop can be concurrent without executing Python code in parallel; workers on multiple cores may provide both.&lt;/p&gt;

&lt;p&gt;Synchronous/asynchronous and blocking/non-blocking are also independent axes. The former mostly describes control flow and result delivery. The latter asks whether a calling thread stops when an operation cannot complete immediately. A non-blocking call may return a status, handle, or incomplete result—not the final value. An asynchronous API may still block an internal worker.&lt;/p&gt;

&lt;p&gt;Processes provide separate address spaces and fault boundaries. Platform threads share process memory and are scheduled by the operating system. Goroutines, Java virtual threads, and asyncio Tasks are lighter runtime-managed units, but they do not share one implementation or one set of semantics.&lt;/p&gt;

&lt;p&gt;A coroutine is not atomic. It yields at suspension points; two tasks performing read-modify-write operations around an &lt;code&gt;await&lt;/code&gt; can still violate an invariant. A single event-loop thread removes simultaneous multicore execution, not logical races.&lt;/p&gt;

&lt;h2&gt;
  
  
  Memory models are about ordering
&lt;/h2&gt;

&lt;p&gt;Concurrency bugs commonly arise from visibility, atomicity, and ordering. The reliable way to reason about them is through the language memory model and explicit happens-before relationships, not assumptions about a particular CPU cache.&lt;/p&gt;

&lt;p&gt;Java defines volatile through its memory model: a write to a volatile field happens-before a subsequent read, establishing visibility and ordering. It does not make a compound operation such as &lt;code&gt;count++&lt;/code&gt; atomic. Locks, thread start and termination, and concurrent collections establish other ordering guarantees.&lt;/p&gt;

&lt;p&gt;Go has different syntax but the same fundamental requirement. Concurrent access to one location with at least one write must be serialized using channels, &lt;code&gt;sync&lt;/code&gt;, or &lt;code&gt;sync/atomic&lt;/code&gt;. The official memory model gives excellent advice: if proving correctness requires clever memory-model reasoning, simplify the design.&lt;/p&gt;

&lt;p&gt;Locking rules should be protocols, not slogans. Multiple locks, lock striping, read-write locks, and optimistic concurrency can all be correct. Every shared state item needs a clear and consistently followed protocol; when several locks protect one invariant, acquisition order and deadlock behavior must be proven.&lt;/p&gt;

&lt;h2&gt;
  
  
  Java: virtual threads change cost, not correctness
&lt;/h2&gt;

&lt;p&gt;Virtual threads became final in Java 21. High-throughput I/O services can dedicate a virtual thread to a task while retaining straightforward blocking code and useful stack traces.&lt;/p&gt;

&lt;p&gt;Virtual threads do not accelerate CPU-bound work beyond available cores. They also should not be pooled merely to limit concurrency. Limit the scarce resource—database connections, remote API quota, memory, or file descriptors—with semaphores, connection pools, and rate limiters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;permits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Semaphore&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;executor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Executors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;newVirtualThreadPerTaskExecutor&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;future&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;executor&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;submit&lt;/span&gt;&lt;span class="o"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;permits&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;acquire&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;callDownstream&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;permits&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;release&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;});&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;future&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Structured Concurrency remains a preview API in Java 25, so its surface should not be presented as permanently finalized. Its direction is what matters: parents own children, scope exit waits for subtasks, sibling work can be cancelled after failure, and deadlines and errors follow a task tree rather than leaving orphaned Futures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Go: a channel is not a durable message broker
&lt;/h2&gt;

&lt;p&gt;Goroutines and channels still provide a concise way to express collaboration. A matched send and receive, or closing a channel and observing that close, establishes synchronization. Channels carry ordering as well as values.&lt;/p&gt;

&lt;p&gt;“Share memory by communicating” does not mean every counter requires a channel. Channels are natural for work streams and ownership transfer. A mutex is often clearer for a short critical section around one object; atomic operations fit small counters and flags.&lt;/p&gt;

&lt;p&gt;Production code must answer questions tutorials often omit: Who closes the channel? What is its capacity? What happens when consumers slow down? How does cancellation propagate? How do goroutines exit? Pass deadlines and cancellation through &lt;code&gt;context.Context&lt;/code&gt;, and keep queues bounded so “asynchronous” does not become unbounded memory growth.&lt;/p&gt;

&lt;h2&gt;
  
  
  Python: the GIL is no longer a one-line answer
&lt;/h2&gt;

&lt;p&gt;With default CPython, asyncio or threads remain appropriate for I/O-bound work, while CPU-heavy pure Python commonly uses processes, native extensions, or external compute. Since Python 3.13, however, CPython has offered an optional free-threaded build that can run Python threads in parallel across cores. It is not automatic acceleration: some extensions may re-enable the GIL, and both safety and performance require testing.&lt;/p&gt;

&lt;p&gt;For asynchronous programs, &lt;code&gt;asyncio.TaskGroup&lt;/code&gt; expresses a group of tasks that share a lifetime. Leaving the scope waits for all children; the first non-cancellation failure cancels siblings and errors are aggregated. Cleanup belongs in &lt;code&gt;try/finally&lt;/code&gt;, and &lt;code&gt;CancelledError&lt;/code&gt; should normally be re-raised after cleanup.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;load_dashboard&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;asyncio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;TaskGroup&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;group&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;load_user&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
        &lt;span class="n"&gt;projects&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;load_projects&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;result&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;projects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;result&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Never run blocking I/O directly on the event loop. Use an asynchronous driver or isolate legacy blocking code with &lt;code&gt;asyncio.to_thread()&lt;/code&gt;. Route CPU work to a process pool, a tested free-threaded runtime, or an external executor according to the deployment.&lt;/p&gt;

&lt;h2&gt;
  
  
  From concurrency models to structured lifetimes
&lt;/h2&gt;

&lt;p&gt;Reactor, Future, Callback, Actor, and CSP still solve different problems. Reactor dispatches ready events. Future represents a later value. Actor contains mutable state behind a mailbox. CSP coordinates processes through communication.&lt;/p&gt;

&lt;p&gt;The major modern addition is that &lt;strong&gt;task lifetime must be modeled too&lt;/strong&gt;. A concurrent task should not outlive the request that created it unless ownership is deliberately transferred. Structured concurrency forms a task tree so completion, failure, cancellation, and observability have explicit parent-child relationships.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fconcurrency-programming-2026%2Fproduction-loop-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fconcurrency-programming-2026%2Fproduction-loop-en.svg" alt="The production concurrency loop" width="1400" height="720"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Eight production rules
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Define the objective:&lt;/strong&gt; lower latency, higher throughput, and fault isolation require different designs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Classify the work:&lt;/strong&gt; measure I/O wait, CPU work, and mixed workloads before choosing concurrency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limit work in flight:&lt;/strong&gt; lightweight tasks do not make connections, memory, descriptors, or quotas infinite.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bound every queue:&lt;/strong&gt; capacity, overflow policy, priority, and discard semantics must be explicit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Propagate deadlines and cancellation:&lt;/strong&gt; timeout is an end-to-end budget, not a collection of unrelated timers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assign state ownership:&lt;/strong&gt; prefer immutable values, single writers, and transfer; synchronize shared mutable state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Observe failure and saturation:&lt;/strong&gt; record queue delay, in-flight work, rejection, cancellation, lock contention, and downstream latency—not just average QPS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test interleavings:&lt;/strong&gt; use race detectors, stress tests, fault injection, and virtual time to cover timeout, cancellation, retry, and partial failure.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Patterns still matter—with limits
&lt;/h2&gt;

&lt;p&gt;Immutability remains the best default for reducing shared-state complexity. Copy-on-write fits read-mostly data, not large collections with frequent writes. Thread-local state requires cleanup with reused platform threads and should not become a large cache on virtual threads. Worker pools are valuable for resource isolation and capacity control, not merely thread reuse.&lt;/p&gt;

&lt;p&gt;Producer-consumer is particularly easy to misuse. A queue decouples producers and consumers, but it cannot eliminate a sustained rate mismatch. If average production exceeds consumption, a bounded queue fills and an unbounded queue exhausts memory. The solution is backpressure, rejection, degradation, scaling, or less input—not another queue.&lt;/p&gt;

&lt;h2&gt;
  
  
  A 2026 definition
&lt;/h2&gt;

&lt;p&gt;Concurrency programming is not simply “doing more things at once.” It is &lt;strong&gt;managing the lifetime and state relationships of multiple tasks under finite resources and uncertain failure&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Threads, locks, channels, and execution models are implementation tools. Scopes, cancellation, backpressure, resource budgets, and observability are equally important parts of the design. Concurrency is easier to create than ever; that makes constrained concurrency more important than ever.&lt;/p&gt;

&lt;p&gt;A mature system is not one that can start a million tasks. It knows how many should start, when they must stop, whose failure affects whom, and how overload remains controlled.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://openjdk.org/jeps/444" rel="noopener noreferrer"&gt;OpenJDK JEP 444: Virtual Threads&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openjdk.org/jeps/505" rel="noopener noreferrer"&gt;OpenJDK JEP 505: Structured Concurrency&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://go.dev/ref/mem" rel="noopener noreferrer"&gt;The Go Memory Model&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.python.org/3.14/library/asyncio-task.html" rel="noopener noreferrer"&gt;Python 3.14: Coroutines and Tasks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.python.org/3/howto/free-threading-python.html" rel="noopener noreferrer"&gt;Python support for free threading&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>programming</category>
      <category>javascript</category>
      <category>python</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Xinxu Cloud Brain AI: Building a Reliable Multimodal Emotion System</title>
      <dc:creator>侯惠阳</dc:creator>
      <pubDate>Thu, 20 Aug 2026 01:30:00 +0000</pubDate>
      <link>https://dev.to/_b6417cbb54ddfef4c4fd0/xinxu-cloud-brain-ai-building-a-reliable-multimodal-emotion-system-1hnp</link>
      <guid>https://dev.to/_b6417cbb54ddfef4c4fd0/xinxu-cloud-brain-ai-building-a-reliable-multimodal-emotion-system-1hnp</guid>
      <description>&lt;p&gt;Xinxu Cloud Brain AI is designed to understand emotional cues in text, speech, and drawings that users voluntarily provide, enabling more empathetic human-computer interaction.&lt;/p&gt;

&lt;p&gt;The challenge is not feeding three inputs into one large model. Each modality contains different evidence; emotions can coexist and change with context; and a model output can only express a hypothesis from available evidence. It cannot replace self-report or become a psychological diagnosis.&lt;/p&gt;

&lt;p&gt;The system therefore follows three principles: &lt;strong&gt;preserve modality-specific evidence, model uncertainty explicitly, and leave final interpretation with the user.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fbuilding-xinxu-multimodal-emotion-ai%2Farchitecture-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fbuilding-xinxu-multimodal-emotion-ai%2Farchitecture-en.svg" alt="Xinxu multimodal emotion architecture" width="1600" height="920"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Define the task before choosing a model
&lt;/h2&gt;

&lt;p&gt;Happy, sad, angry, fearful, surprised, disgusted, and neutral can remain useful presentation labels, but a single seven-way Softmax is too restrictive for training. Expressions can contain sadness and anger together, while “neutral” may simply mean insufficient evidence.&lt;/p&gt;

&lt;p&gt;A useful output combines multi-label probabilities, continuous valence and arousal, calibrated uncertainty, modality-specific evidence, and a policy decision:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"emotions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sadness"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"probability"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.68&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"anxiety"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"probability"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.31&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"valence"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;-0.62&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"arousal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.48&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"uncertainty"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.27&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"decision"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ask_for_confirmation"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Intensity must come from a trained and calibrated regression head, not an arbitrary number generated by a language model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preserve three kinds of evidence
&lt;/h2&gt;

&lt;p&gt;The text encoder handles semantics, negation, irony, context, and conversation history. ASR transcripts enter this branch with timestamps, confidence, and language metadata, clearly separated from user-written text.&lt;/p&gt;

&lt;p&gt;Speech must not be reduced to a transcript. Pitch, energy, rate, pauses, voice quality, and rhythm carry information that words discard. A speech encoder should process waveform or acoustic representations alongside ASR semantics. Audio normalization, voice activity detection, segmentation, and quality scoring belong in preprocessing; low-quality audio should reduce modality weight.&lt;/p&gt;

&lt;p&gt;Drawings are highly personal. Color, line, and composition can provide context, but there is no universal mapping such as black meaning sadness. The vision branch models content and structure. Stroke trajectory and drawing duration should be used only with explicit consent. Augmentations must preserve task semantics: strong color jitter and cropping can change or delete the very cue being modeled. Synthetic images may support pretraining or rare-pattern augmentation, but must be provenance-tagged and excluded from validation and test sets.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why one VLM is not the entire architecture
&lt;/h2&gt;

&lt;p&gt;A vision-language model can jointly understand images and text, but an ordinary VLM does not consume raw audio and may not learn emotion boundaries for the target population and culture. Converting speech only to text discards acoustic evidence.&lt;/p&gt;

&lt;p&gt;Xinxu uses modality-specific text, speech, and vision encoders. Adapters map their outputs to a shared space, followed by gated fusion or a cross-modal transformer. A VLM can act as a visual-semantic teacher, weak labeler, or explanation generator; supervised heads own classification, dimensional regression, and uncertainty.&lt;/p&gt;

&lt;p&gt;This design also works when a user supplies only one or two modalities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Missing modalities are the default
&lt;/h2&gt;

&lt;p&gt;Users may type only text, decline audio, upload a damaged image, or encounter an ASR failure. Train and evaluate every available modality combination.&lt;/p&gt;

&lt;p&gt;Use modality dropout during training, pass presence and quality signals into fusion, and retain an auxiliary loss for every unimodal branch. At serving time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Availability → Unimodal encoding → Quality estimation → Dynamic fusion
             → Multi-task prediction → Calibration → Policy decision
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Report full-modality, unimodal, and missing-modality performance separately. A single Macro-F1 score with every channel present hides operational risk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data: self-report before observer inference
&lt;/h2&gt;

&lt;p&gt;Emotion labels are subjective. Majority votes from external annotators describe how observers interpret an expression, not necessarily how the person feels.&lt;/p&gt;

&lt;p&gt;Store self-reported labels and valence/arousal as primary supervision, observer-label distributions as soft labels, context, modality quality, consent scope, and provenance. Split train, validation, and test by user or speaker. Adjacent segments from one person, conversation, or source video must not cross splits.&lt;/p&gt;

&lt;p&gt;Public datasets are useful for pretraining and baselines, but acted or scripted MELD and IEMOCAP samples differ from real Chinese users. The final test set must represent the target population, devices, languages, and missing-modality distribution with appropriate authorization.&lt;/p&gt;

&lt;h2&gt;
  
  
  Training in evidence-driven stages
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Establish text, speech, and image unimodal baselines.&lt;/li&gt;
&lt;li&gt;Freeze most encoders and train adapters, fusion, and multi-task heads.&lt;/li&gt;
&lt;li&gt;Add cross-modal attention, modality dropout, soft labels, and imbalance-aware loss.&lt;/li&gt;
&lt;li&gt;Apply LoRA/QLoRA or staged unfreezing only when evaluation justifies it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;LoRA rank, target layers, learning rate, and quantization are experiment variables, not fixed recipes. Small data can easily damage foundation capabilities if every encoder is tuned indiscriminately.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;L = λ1 · MultiLabelEmotionLoss
  + λ2 · ValenceArousalRegressionLoss
  + λ3 · UnimodalAuxiliaryLoss
  + λ4 · CrossModalConsistencyLoss
  + λ5 · CalibrationLoss
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Track dataset and split versions, seeds, preprocessing, base models, code commits, hyperparameters, and hardware. The registry should contain weights, thresholds, calibrators, and a Model Card—not just a merged checkpoint.&lt;/p&gt;

&lt;h2&gt;
  
  
  Evaluation beyond accuracy
&lt;/h2&gt;

&lt;p&gt;Report Macro-F1, per-class precision and recall, confusion matrices, and multi-label metrics; MAE and CCC for valence/arousal; and ECE, Brier score, and selective-risk curves for confidence.&lt;/p&gt;

&lt;p&gt;Evaluate modality ablations, damaged and missing inputs, demographic and device slices, cross-dataset/OOD transfer, calibration and abstention, and safety behavior. A headline accuracy without split details, confidence intervals, class distribution, and independent repetition is not meaningful.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fbuilding-xinxu-multimodal-emotion-ai%2Flifecycle-en.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhouhuiyang.com%2Fblog%2Fbuilding-xinxu-multimodal-emotion-ai%2Flifecycle-en.svg" alt="The Xinxu data, training, and evaluation lifecycle" width="1500" height="780"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Serving needs policy before and after the model
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Consent and purpose check
  → File safety, type, and size limits
  → Modality quality and preprocessing
  → Parallel encoders, fusion, and multi-task prediction
  → Calibration, thresholds, and OOD detection
  → Safety policy and response generation
  → User confirmation or correction
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Validate output against a strict schema. Parse failure must return an error or explicit degraded result, never silently default to neutral. Apply deadlines, batching limits, GPU admission control, and circuit breakers, and observe ASR, encoder, fusion, and generation latency separately.&lt;/p&gt;

&lt;p&gt;LoRA adapters do not always need merging. Merging fits a single low-overhead deployment; separate adapters fit multiple variants and fast rollback. Verify that the chosen inference engine actually supports the target multimodal architecture and adapter configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Safety, privacy, and product boundaries
&lt;/h2&gt;

&lt;p&gt;Voice and images can contain biometric and sensitive information. Minimize collection, encrypt transit and storage, shorten retention, support deletion, isolate purposes, and audit access. Low-confidence samples must never enter a training pool without separate, explicit training consent.&lt;/p&gt;

&lt;p&gt;Use language such as “emotional cues” or “model hypothesis,” not claims of reading inner states. Do not use the system for employment, performance, education, insurance, credit, or law-enforcement decisions, and do not present it as a mental-health diagnostic tool. The EU AI Act restricts emotion inference in workplaces and educational institutions and highlights limitations in reliability, specificity, and generalization.&lt;/p&gt;

&lt;p&gt;Self-harm or immediate-danger language requires a separately designed safety path, not a conclusion from an emotion label: supportive language, encouragement to contact local emergency services or a trusted person, and human escalation where lawful and consented.&lt;/p&gt;

&lt;h2&gt;
  
  
  Monitor model behavior, not people's emotions
&lt;/h2&gt;

&lt;p&gt;Monitor modality availability and quality, prediction entropy, calibration error, abstention, user correction, slice performance, drift, tail latency, and resource saturation. Fixed targets such as neutral under 40% or average confidence above 0.75 are not universal health indicators. Confidence can be wrong, and real population distributions change.&lt;/p&gt;

&lt;p&gt;Retraining should follow evidence: degradation on a stable target set, widening group gaps, new devices or languages, or a changed label definition. Release through offline gates, shadow traffic, and a small canary with rapid rollback.&lt;/p&gt;

&lt;h2&gt;
  
  
  The architectural conclusion
&lt;/h2&gt;

&lt;p&gt;Xinxu Cloud Brain AI is not merely Qwen plus Whisper plus a classifier. It is a multimodal learning system centered on evidence quality, consent, and uncertainty.&lt;/p&gt;

&lt;p&gt;Text says what was expressed; speech contributes how it was expressed; drawings add personal visual context. Fusion combines evidence without forcing certainty. A reliable system lowers confidence when signals conflict, degrades safely when modalities are missing, respects user corrections, and never confuses an affective cue with a diagnosis.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2401.03429" rel="noopener noreferrer"&gt;MERBench&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2404.17113" rel="noopener noreferrer"&gt;MER 2024&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2506.10452" rel="noopener noreferrer"&gt;Robust MER under Missing Modalities and Distribution Shifts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.nist.gov/itl/ai-risk-management-framework" rel="noopener noreferrer"&gt;NIST AI Risk Management Framework&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://eur-lex.europa.eu/eli/reg/2024/1689/oj" rel="noopener noreferrer"&gt;EU Artificial Intelligence Act&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>productivity</category>
    </item>
    <item>
      <title>The Moat in Large Language Models Is Not Just Code—It Is Data</title>
      <dc:creator>侯惠阳</dc:creator>
      <pubDate>Wed, 19 Aug 2026 09:30:00 +0000</pubDate>
      <link>https://dev.to/_b6417cbb54ddfef4c4fd0/the-moat-in-large-language-models-is-not-just-code-it-is-data-2198</link>
      <guid>https://dev.to/_b6417cbb54ddfef4c4fd0/the-moat-in-large-language-models-is-not-just-code-it-is-data-2198</guid>
      <description>&lt;p&gt;Large language model code is no longer as mysterious as it was a few years ago.&lt;/p&gt;

&lt;p&gt;Transformers are public. Attention is public. Mature open-source implementations now exist for pretraining, supervised fine-tuning, preference optimization, quantization, and serving. PyTorch, Hugging Face, DeepSpeed, Megatron-LM, TRL, and vLLM have turned many capabilities that once belonged only to large research labs into reusable engineering components.&lt;/p&gt;

&lt;p&gt;For an experienced team, building a model that can train, fine-tune, and serve is genuinely easier than before.&lt;/p&gt;

&lt;p&gt;But making a model run is not the same as making it useful.&lt;/p&gt;

&lt;p&gt;My view has become increasingly clear:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;As model architectures converge and training code becomes widely available, the real competition is shifting from “Can we implement the model?” to “Do we have the right data, how good is it, and can we continuously improve it?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This does not make algorithms, compute, or systems engineering unimportant. Frontier training still demands sophisticated distributed systems, optimization, reliability, evaluation, and enormous compute. The difference is that baseline code is increasingly accessible, while valuable data and the system that produces it remain difficult to copy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Parameters determine capacity; data determines what is learned
&lt;/h2&gt;

&lt;p&gt;Machine learning has a simple and durable rule:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Garbage in, garbage out.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A language model does not first decide whether a document is true and then choose whether to learn from it. Pretraining still centers on predicting tokens from context. If a pattern appears often enough in the training data, the model may encode it in its parameters.&lt;/p&gt;

&lt;p&gt;Fill the corpus with SEO-generated pages, and the model learns fluent emptiness. Fill a code corpus with duplicated repositories, obsolete dependencies, and incorrect implementations, and the model may produce unsafe code with greater confidence. If medical, legal, or financial material is wrong, adding parameters does not automatically turn it into truth.&lt;/p&gt;

&lt;p&gt;“Data determines the ceiling” is directionally right, but it can be stated more precisely:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Parameter count determines how much pattern capacity a model has. Data determines which patterns it encounters. Algorithms and optimization determine how effectively those patterns are absorbed. Evaluation determines whether the team actually knows what the model learned.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Capability is not controlled by one variable. Architecture, compute, tokenization, objectives, data, post-training, and inference strategy interact. Data matters because it defines the boundary of experience available to the model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data quality is more than removing dirty text
&lt;/h2&gt;

&lt;p&gt;Data quality is often reduced to deleting corrupted text, advertisements, explicit content, and duplicates. That is only the first layer.&lt;/p&gt;

&lt;p&gt;For a language model, quality has at least five dimensions:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Correctness&lt;/td&gt;
&lt;td&gt;Are facts reliable? Does the code compile and pass tests?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Diversity&lt;/td&gt;
&lt;td&gt;Does the corpus cover different languages, domains, tasks, views, and styles?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Representativeness&lt;/td&gt;
&lt;td&gt;Does its distribution resemble the situations the model will face?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Safety and compliance&lt;/td&gt;
&lt;td&gt;Does it contain personal data, secrets, harmful material, or licensing risk?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Learnability&lt;/td&gt;
&lt;td&gt;Is the content complete, clear, structured, and information-dense?&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A cleanly formatted dataset without offensive language is not necessarily high quality. If every example repeats the same view, the resulting model will still be narrow and biased.&lt;/p&gt;

&lt;p&gt;Quality and quantity are not simple opposites. General models need scale for coverage. Quality determines whether those tokens deserve the compute spent on them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do not invent percentages that were never disclosed
&lt;/h2&gt;

&lt;p&gt;The precise composition of a training corpus is often among a model developer's most valuable secrets.&lt;/p&gt;

&lt;p&gt;For Llama 3, Meta disclosed that the pretraining corpus contained more than 15 trillion tokens from publicly available sources. It was roughly seven times larger than Llama 2's corpus, contained four times as much code, and included more than 5% high-quality non-English data across over 30 languages. Meta also described heuristic filters, NSFW filters, semantic deduplication, quality classifiers, and experiments used to choose the final mixture.&lt;a href="https://ai.meta.com/blog/meta-llama-3/" rel="noopener noreferrer"&gt;Meta's official Llama 3 announcement&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Meta did not publish a complete mixture such as “50% Common Crawl, 17% GitHub, and 10% books and ArXiv.”&lt;/p&gt;

&lt;p&gt;The rigorous claim is that large-model corpora commonly contain web pages, code, books, papers, encyclopedic material, conversations, and multilingual text. Their exact proportions depend on the target capabilities and should not be presented as official figures without a source.&lt;/p&gt;

&lt;p&gt;That distinction reveals something important:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Architecture can be described in a paper. The data recipe often remains the commercial secret.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Phi-1 demonstrated data efficiency, not universal small-model superiority
&lt;/h2&gt;

&lt;p&gt;Microsoft's Phi-1 is frequently cited as proof that data quality matters, but its conclusion is often overstated.&lt;/p&gt;

&lt;p&gt;Phi-1 is a 1.3-billion-parameter model trained on approximately 6 billion tokens of filtered code data plus about 1 billion tokens of synthetic textbooks and exercises. It achieved strong results on coding benchmarks including HumanEval and MBPP.&lt;a href="https://arxiv.org/abs/2306.11644" rel="noopener noreferrer"&gt;“Textbooks Are All You Need”&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Its strongest lesson is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In a focused domain with verifiable outcomes, information-dense data and a good teaching progression can dramatically improve training efficiency.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The work did not establish that a 1.3B model universally beats 7B models. Coding, world knowledge, multilingual capability, long-context behavior, and writing are different dimensions. One coding benchmark cannot stand in for all of them.&lt;/p&gt;

&lt;p&gt;Data quality is not magic. It does not remove the boundary of the task or create knowledge absent from the corpus.&lt;/p&gt;

&lt;h2&gt;
  
  
  LIMA demonstrated “less but better,” not “1,000 equals 52,000”
&lt;/h2&gt;

&lt;p&gt;LIMA fine-tuned an already pretrained 65B LLaMA model using only 1,000 carefully selected prompts and responses, and obtained strong instruction-following behavior.&lt;a href="https://arxiv.org/abs/2305.11206" rel="noopener noreferrer"&gt;The LIMA paper&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The precondition matters: the base model had already acquired substantial knowledge during pretraining. Supervised fine-tuning was largely teaching it how to organize, invoke, and express that capability.&lt;/p&gt;

&lt;p&gt;The more defensible lesson is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For a capable pretrained model, a small, carefully selected, well-covered instruction dataset can outperform a much larger collection of noisy and repetitive instructions.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It does not mean that any 1,000 examples equal 52,000 Alpaca examples, or that every enterprise needs only 1,000 labels. Base-model capability, task boundaries, coverage, and evaluation criteria all change the outcome.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a production data pipeline should look like
&lt;/h2&gt;

&lt;p&gt;Production data engineering is not a one-off cleaning script. It is a traceable, reproducible, measurable, and continuously evolving manufacturing system.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source registration and license review
        ↓
collection, parsing, and normalization
        ↓
main-content extraction and structure recovery
        ↓
language, domain, and content-type detection
        ↓
rule-based filtering and anomaly detection
        ↓
quality scoring and stratified sampling
        ↓
exact, fuzzy, and cross-source deduplication
        ↓
PII, secret, safety, and compliance processing
        ↓
train–evaluation contamination detection
        ↓
mixture design, curriculum, and token budgeting
        ↓
small-scale ablation experiments
        ↓
capability, safety, bias, and regression evaluation
        ↓
versioned release
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The ordering is not universally fixed. Exact deduplication can move earlier to reduce downstream cost. Quality-aware deduplication may score first and retain the best document from each duplicate cluster. The best practice is not memorizing an order; it is giving every stage defined inputs, outputs, metrics, and lineage.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Govern the source before cleaning it
&lt;/h3&gt;

&lt;p&gt;Every data batch should record its origin, acquisition date, license, usage restrictions, language, domain, and processing history.&lt;/p&gt;

&lt;p&gt;Without provenance, a team cannot respond to copyright concerns, deletion requests, contamination, or reproducibility failures. What an enterprise needs is not merely object storage full of files, but a data catalog and lineage system.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Parsing quality constrains everything downstream
&lt;/h3&gt;

&lt;p&gt;Menus, advertisements, recommendation links, cookie notices, and comments can overwhelm the main text of a webpage. PDFs introduce repeated headers, broken reading order, misplaced tables, and OCR errors.&lt;/p&gt;

&lt;p&gt;If parsing destroys semantic structure, later stages are only cleaning characters in the wrong order. Data engineering begins by recovering document boundaries and structure as faithfully as possible.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Language identification needs more than fastText
&lt;/h3&gt;

&lt;p&gt;fastText is a useful baseline, but short passages, dialects, low-resource languages, and code mixed with natural language are easy to misclassify.&lt;/p&gt;

&lt;p&gt;Production pipelines usually combine model predictions, character-level rules, source metadata, and human sampling. Thresholds should be calibrated per language. Applying English-centric quality rules to every language often deletes the rarest multilingual data systematically.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Perplexity is not a synonym for quality
&lt;/h3&gt;

&lt;p&gt;KenLM perplexity, heuristics, and learned classifiers are all useful, but no single score represents quality.&lt;/p&gt;

&lt;p&gt;High perplexity may indicate corrupted text. It may also indicate specialized terminology, new knowledge, or a low-resource language. Aggressive global thresholds can remove the material that is hardest to replace.&lt;/p&gt;

&lt;p&gt;A stronger approach combines multiple signals, buckets data by language and domain, performs human audits, and validates filtering choices through training experiments.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Deduplication is more than MinHash
&lt;/h3&gt;

&lt;p&gt;One article may be syndicated dozens of times. A GitHub repository may have thousands of forks. A tutorial may be copied with only its title and a few sentences changed.&lt;/p&gt;

&lt;p&gt;A complete strategy can include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;URL and content-hash deduplication;&lt;/li&gt;
&lt;li&gt;exact document-level deduplication;&lt;/li&gt;
&lt;li&gt;fuzzy deduplication using MinHash, LSH, or embeddings;&lt;/li&gt;
&lt;li&gt;cross-source and cross-language deduplication;&lt;/li&gt;
&lt;li&gt;contamination checks between training and evaluation sets.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not to delete the largest possible amount. It is to keep the most complete, trustworthy, and highest-quality member of each duplicate cluster.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. PII and safety require more than regular expressions
&lt;/h3&gt;

&lt;p&gt;Email addresses, phone numbers, identity numbers, home addresses, API keys, and internal code can all enter a corpus.&lt;/p&gt;

&lt;p&gt;Regular expressions handle stable formats, but production systems also need entity recognition, secret scanners, classifiers, and human review. They need deletion workflows too: when data must be withdrawn, the team should know which dataset and model versions consumed it.&lt;/p&gt;

&lt;p&gt;Harmful content should not simply be removed by keyword. A model needs some understanding of attacks, fraud, and dangerous material in order to detect and refuse them. Context, proportion, labeling, and the training objective matter more than mere occurrence.&lt;/p&gt;

&lt;h2&gt;
  
  
  A data mixture is a capability budget
&lt;/h2&gt;

&lt;p&gt;Training compute is finite. Increasing the sampling rate of one source reduces the training opportunity available to another.&lt;/p&gt;

&lt;p&gt;Code contains structure, long-range dependencies, and partially verifiable outcomes. More code may improve programming and some reasoning tasks, but it does not guarantee stronger general reasoning. Too much can crowd out natural language, domain knowledge, and multilingual ability.&lt;/p&gt;

&lt;p&gt;More Chinese data generally improves Chinese understanding, expression, and knowledge coverage. The number of tokens required to encode Chinese, however, is governed mainly by the tokenizer's vocabulary and segmentation strategy. Corpus share and tokenization efficiency are related, but they are not the same variable.&lt;/p&gt;

&lt;p&gt;Books and papers can provide dense knowledge and long-form structure. Social media can cover current language and public opinion while introducing misinformation, abuse, and demographic bias.&lt;/p&gt;

&lt;p&gt;There is no universal golden ratio.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A data mixture is not a shopping list of ingredients. It is the product strategy projected into the training corpus.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A coding model, a Chinese legal model, and a general assistant should not share the same recipe.&lt;/p&gt;

&lt;h2&gt;
  
  
  The core of synthetic data is verification, not generation
&lt;/h2&gt;

&lt;p&gt;As high-quality natural data becomes scarcer, synthetic data becomes increasingly useful. Strong models can generate textbooks, reasoning problems, code, question-answer pairs, and preference examples while controlling difficulty and covering rare tasks.&lt;/p&gt;

&lt;p&gt;But synthetic data does not create trustworthy knowledge from nothing.&lt;/p&gt;

&lt;p&gt;Teacher errors propagate to students. Repetitive templates reduce diversity. Repeatedly generating and filtering with the same model can amplify its existing biases.&lt;/p&gt;

&lt;p&gt;The decisive capability is therefore verification:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;check mathematics against answers and constraints;&lt;/li&gt;
&lt;li&gt;compile code and run tests and static analysis;&lt;/li&gt;
&lt;li&gt;execute tool calls and compare real outcomes;&lt;/li&gt;
&lt;li&gt;ground factual questions in retrieved sources;&lt;/li&gt;
&lt;li&gt;use multi-model review and human sampling where automatic verification is impossible.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without a verifier, synthetic data is simply a cheaper and faster way to manufacture uncertainty.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data engineering must close the loop with evaluation
&lt;/h2&gt;

&lt;p&gt;After a cleaning run, the key question is not “How many tokens remain?” It is: which capabilities improved, which regressed, and why?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;model failures and user feedback
        ↓
failure taxonomy and root-cause analysis
        ↓
identify gaps, bad samples, or mixture problems
        ↓
add, correct, resample, or relabel data
        ↓
small training runs and ablations
        ↓
offline evaluation, red teaming, and online observation
        ↓
promote into the next dataset version after quality gates
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At least four kinds of metrics are required:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Data metrics:&lt;/strong&gt; duplication, language distribution, domain coverage, quality scores, and PII detections;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Training metrics:&lt;/strong&gt; loss by data bucket, gradient anomalies, token utilization, and convergence;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Capability metrics:&lt;/strong&gt; target-task accuracy, code pass rate, factuality, and instruction following;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Risk metrics:&lt;/strong&gt; hallucination, harmful output, privacy leakage, bias, and benchmark contamination.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Without versioned data, training cannot be reproduced. Without ablations, a team cannot prove that a data batch helped. Without production feedback, offline leaderboards cannot establish business value.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the data moat means for an enterprise
&lt;/h2&gt;

&lt;p&gt;Most companies should not pretrain a general foundation model from scratch. The better investment is converting internal knowledge, workflows, and expert feedback into governed and measurable data assets.&lt;/p&gt;

&lt;p&gt;I would prioritize the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select three valuable business tasks with measurable outcomes;&lt;/li&gt;
&lt;li&gt;build a separate evaluation set for each task before collecting “all the data”;&lt;/li&gt;
&lt;li&gt;inventory sources, permissions, licenses, sensitivity, and ownership;&lt;/li&gt;
&lt;li&gt;create pipelines for cleaning, deduplication, redaction, versioning, and lineage;&lt;/li&gt;
&lt;li&gt;validate value through RAG or small fine-tuning runs before scaling training;&lt;/li&gt;
&lt;li&gt;continuously feed back corrections, reviews, and failure cases;&lt;/li&gt;
&lt;li&gt;use business outcomes—not token counts—to decide where to invest.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The most defensible enterprise data is rarely another copy of the public web. It is authorized workflow data, expert judgment, customer feedback, failure cases, and outcome labels.&lt;/p&gt;

&lt;p&gt;Such datasets may be small, but they are closely tied to real results and difficult for competitors to reproduce.&lt;/p&gt;

&lt;h2&gt;
  
  
  My conclusion
&lt;/h2&gt;

&lt;p&gt;Algorithms and code still matter. Training systems, architecture, optimizers, compute, and inference engineering do not lose their value merely because open source exists.&lt;/p&gt;

&lt;p&gt;But as the baseline stack becomes shared infrastructure, the advantages that remain hard to copy are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;long-lived, authorized domain data;&lt;/li&gt;
&lt;li&gt;an understanding of provenance, bias, and quality;&lt;/li&gt;
&lt;li&gt;expert judgment and feedback;&lt;/li&gt;
&lt;li&gt;the ability to turn model failures into better training data;&lt;/li&gt;
&lt;li&gt;evaluation tied to real business outcomes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;“Garbage in, garbage out” is only the first conclusion.&lt;/p&gt;

&lt;p&gt;I would state the complete version this way:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Parameters determine capacity. Compute determines training scale. Algorithms determine learning efficiency. Data determines what the model ultimately learns.&lt;/p&gt;

&lt;p&gt;As code becomes common infrastructure, the real competition is no longer about who can make a model run. It is about who can continuously feed it correct, scarce, lawful, and verifiable data—and prove that the model becomes better as a result.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is the real data moat in the age of large language models.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://ai.meta.com/research/publications/the-llama-3-herd-of-models/" rel="noopener noreferrer"&gt;Meta AI: The Llama 3 Herd of Models&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ai.meta.com/blog/meta-llama-3/" rel="noopener noreferrer"&gt;Meta AI: Introducing Meta Llama 3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2306.11644" rel="noopener noreferrer"&gt;Gunasekar et al.: Textbooks Are All You Need (Phi-1)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2305.11206" rel="noopener noreferrer"&gt;Zhou et al.: LIMA — Less Is More for Alignment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2406.17557" rel="noopener noreferrer"&gt;Penedo et al.: The FineWeb Datasets — Decanting the Web for the Finest Text Data at Scale&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2406.11794" rel="noopener noreferrer"&gt;Li et al.: DataComp-LM — In Search of the Next Generation of Training Sets for Language Models&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2402.00159" rel="noopener noreferrer"&gt;Soldaini et al.: Dolma — An Open Corpus of Three Trillion Tokens for Language Model Pretraining Research&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/huggingface/datatrove" rel="noopener noreferrer"&gt;Hugging Face: DataTrove, a toolkit for large-scale data processing, filtering, and deduplication&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Building a Recruitment LLM from Zero to One: A BOSS Zhipin–Style Case Study</title>
      <dc:creator>侯惠阳</dc:creator>
      <pubDate>Wed, 19 Aug 2026 05:30:00 +0000</pubDate>
      <link>https://dev.to/_b6417cbb54ddfef4c4fd0/building-a-recruitment-llm-from-zero-to-one-a-boss-zhipin-style-case-study-20bp</link>
      <guid>https://dev.to/_b6417cbb54ddfef4c4fd0/building-a-recruitment-llm-from-zero-to-one-a-boss-zhipin-style-case-study-20bp</guid>
      <description>&lt;p&gt;If I had to build a language model for a recruitment platform similar to BOSS Zhipin, I would not begin by buying GPUs or debating whether the model should have 7B, 32B, or 100B parameters.&lt;/p&gt;

&lt;p&gt;I would begin with three questions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Which business outcome must the system improve?&lt;/li&gt;
&lt;li&gt;What lawful, distinctive, and verifiable data do we have?&lt;/li&gt;
&lt;li&gt;Which problems belong to an LLM, and which should remain search, recommendation, or rule-based problems?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The easiest mistake in recruitment AI is to treat “building an industry model” as training a chatbot. A production system is not one model. It is a coordinated system of data, retrieval, matching, generation, risk controls, evaluation, and human decisions.&lt;/p&gt;

&lt;p&gt;One factual boundary matters. Public filing information lists “Nanbeige,” operated by the company behind BOSS Zhipin, under filing number &lt;code&gt;Beijing-NanBeiGe-20240102&lt;/code&gt;. Its complete data recipe, training pipeline, and internal architecture are not public.&lt;a href="https://www.cac.gov.cn/2024-04/02/c_1713729983803145.htm" rel="noopener noreferrer"&gt;Cyberspace Administration of China filing notice&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article therefore does not claim to reconstruct BOSS Zhipin's internal system. It uses a BOSS Zhipin–style platform as a business case and presents an implementable open-source reference architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  What “from zero” should mean
&lt;/h2&gt;

&lt;p&gt;Pretraining a general foundation model from random initialization requires trillions of tokens, long-running clusters, mature distributed systems, and substantial compute. For almost every recruitment company, that is the wrong first milestone.&lt;/p&gt;

&lt;p&gt;A practical zero-to-one path is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;open-weight base model
    ↓
recruitment-domain continued pretraining (optional)
    ↓
task-oriented supervised fine-tuning
    ↓
preference optimization and safety alignment
    ↓
RAG, business tools, and matching systems
    ↓
offline evaluation, canary release, and feedback loop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;“Self-developed” does not have to mean random initial weights. The assets a company should own are its domain data, training recipe, evaluation sets, service architecture, and learning loop.&lt;/p&gt;

&lt;p&gt;Training from scratch becomes reasonable only when the company has a very large lawful corpus, stable compute, an experienced training team, and a base-model deficiency in tokenization, language coverage, or core behavior that adaptation cannot fix.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: turn business goals into evaluable tasks
&lt;/h2&gt;

&lt;p&gt;A recruitment platform serves both candidates and recruiters, whose goals differ.&lt;/p&gt;

&lt;p&gt;Candidates need to know which roles genuinely fit, which requirements are hard constraints, how to improve a résumé, how to communicate effectively, and whether a role or company is trustworthy.&lt;/p&gt;

&lt;p&gt;Recruiters need to turn ambiguous needs into clear job descriptions, discover qualified candidates, understand skill fit, reduce unproductive conversations, and identify fraudulent résumés, jobs, or accounts.&lt;/p&gt;

&lt;p&gt;Version one should not solve everything. I would choose three measurable scenarios:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;Output&lt;/th&gt;
&lt;th&gt;Primary metrics&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;JD normalization and rewriting&lt;/td&gt;
&lt;td&gt;Standard title, skills, experience, location, compensation, and a faithful rewrite&lt;/td&gt;
&lt;td&gt;Field F1, factual fidelity, publish acceptance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Candidate–job explanation&lt;/td&gt;
&lt;td&gt;Matches, gaps, evidence, and uncertainty&lt;/td&gt;
&lt;td&gt;Recall@K, NDCG, evidence accuracy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Recruitment copilot&lt;/td&gt;
&lt;td&gt;Questions, replies, and next-step suggestions grounded in the job and résumé&lt;/td&gt;
&lt;td&gt;Reply rate, human acceptance, safety violations&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Do not use hiring rate as the only early metric. Hiring is delayed and influenced by compensation, location, employer brand, recruiter behavior, and the economy. Early evaluation needs model-quality metrics, process metrics, and business outcomes together.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: separate the system instead of asking the LLM to do everything
&lt;/h2&gt;

&lt;p&gt;A recruitment platform needs a layered architecture:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                        ┌─────────────────────────────┐
candidate / recruiter → │ chat, search, recommendation│
                        └──────────────┬──────────────┘
                                       ↓
                        ┌─────────────────────────────┐
                        │ task routing and policy      │
                        │ intent / auth / risk / cost  │
                        └───────┬──────────┬──────────┘
                                │          │
                  ┌─────────────┘          └──────────────┐
                  ↓                                          ↓
       ┌───────────────────────┐                ┌───────────────────────┐
       │ recruitment LLM       │                │ retrieval and ranking │
       │ extract/generate/explain│              │ two-tower/rank/rerank │
       └───────────┬───────────┘                └───────────┬───────────┘
                   ↓                                            ↓
       ┌───────────────────────┐                ┌───────────────────────┐
       │ RAG and business tools│                │ feature/vector platform│
       │ jobs/company/API      │                │ user/job/behavior      │
       └───────────┬───────────┘                └───────────┬───────────┘
                   └───────────────────┬────────────────────┘
                                       ↓
                        ┌─────────────────────────────┐
                        │ governance, eval, audit, loop│
                        └─────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;LLMs are strong at semantic interpretation, extraction, generation, explanations, and tool orchestration. They are not the right engine for low-latency retrieval across millions of candidates, and they should not make opaque rejection decisions by themselves.&lt;/p&gt;

&lt;p&gt;A mature design usually assigns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;search and two-tower models to high-scale retrieval;&lt;/li&gt;
&lt;li&gt;ranking models to combine semantics, behavior, freshness, and constraints;&lt;/li&gt;
&lt;li&gt;the LLM to parse natural language, enrich structured features, explain results, and conduct dialogue;&lt;/li&gt;
&lt;li&gt;rules and safety models to hard constraints, authorization, fraud, and compliance;&lt;/li&gt;
&lt;li&gt;humans to the final application, contact, interview, and hiring decisions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  A minimal open-source stack
&lt;/h3&gt;

&lt;p&gt;Do not accumulate frameworks merely to claim an open stack. Give each layer one primary implementation and a replaceable boundary:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Initial choice&lt;/th&gt;
&lt;th&gt;Output contract&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Data&lt;/td&gt;
&lt;td&gt;Python/SQL + DataTrove or Spark&lt;/td&gt;
&lt;td&gt;Versioned Parquet, dataset card, lineage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Training&lt;/td&gt;
&lt;td&gt;PyTorch + LLaMA-Factory/TRL; FSDP or DeepSpeed when scale requires it&lt;/td&gt;
&lt;td&gt;Adapter/checkpoint and metrics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lexical/vector search&lt;/td&gt;
&lt;td&gt;OpenSearch, or PostgreSQL + pgvector initially&lt;/td&gt;
&lt;td&gt;Filtered candidates and evidence&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Embedding/reranking&lt;/td&gt;
&lt;td&gt;Open-weight bilingual embedding + cross-encoder&lt;/td&gt;
&lt;td&gt;Vectors and relevance scores&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Serving&lt;/td&gt;
&lt;td&gt;vLLM or SGLang&lt;/td&gt;
&lt;td&gt;OpenAI-compatible API&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Experiment/evaluation&lt;/td&gt;
&lt;td&gt;MLflow + private gold sets and regression scripts&lt;/td&gt;
&lt;td&gt;Versioned data, model, prompt, metrics&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Tool names matter less than interfaces. Training examples, embeddings, retrieval results, generations, and evaluations should carry &lt;code&gt;dataset_version&lt;/code&gt;, &lt;code&gt;model_version&lt;/code&gt;, &lt;code&gt;prompt_version&lt;/code&gt;, and &lt;code&gt;trace_id&lt;/code&gt;; otherwise production failures cannot be reconstructed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: build a recruitment ontology first
&lt;/h2&gt;

&lt;p&gt;More data creates more contradiction when terms do not share a common meaning.&lt;/p&gt;

&lt;p&gt;“Senior Java developer,” “backend engineer,” and “server-side engineer” may belong to the same job family. “LLM experience” may mean calling an API, or it may mean training, evaluation, and inference optimization.&lt;/p&gt;

&lt;p&gt;I would first build a versioned ontology:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;job family → normalized title → specialization → skill → proficiency
                                                   ├─ required/preferred
                                                   ├─ years of use
                                                   └─ recency

job → industry → company stage → location → work mode → compensation

candidate → experience → project → responsibility → action → result → evidence
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The ontology does not force every employer to use the same title. It gives retrieval, training, and evaluation a shared coordinate system. Every mapping should retain the original phrase, normalized value, confidence, and ontology version.&lt;/p&gt;

&lt;p&gt;A structured JD example should include evidence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"source_text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Hiring a senior backend engineer, 5+ years, Java and microservices required; LLM experience preferred."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"job_family"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Software Engineering"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"normalized_title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Senior Backend Engineer"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"required_skills"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Java"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Microservices"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"preferred_skills"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Large Language Models"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"experience_min_years"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"evidence"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"experience_min_years"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"5+ years"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"required_skills"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Java and microservices required"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"confidence"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.96&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"ontology_version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"job-ontology-2026-08"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important field is not JSON; it is &lt;code&gt;evidence&lt;/code&gt;. Recruitment outputs must remain traceable to source text.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: create lawful, traceable data assets
&lt;/h2&gt;

&lt;p&gt;Recruitment data is unusually sensitive. Résumés can contain names, contact details, education, employment history, location, and salary expectations. Conversations can reveal family circumstances, health information, and other private details.&lt;/p&gt;

&lt;p&gt;I would separate data into four layers:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Examples&lt;/th&gt;
&lt;th&gt;Main use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Public knowledge&lt;/td&gt;
&lt;td&gt;Occupational taxonomies, public skill documentation, labor rules, public company information&lt;/td&gt;
&lt;td&gt;Domain knowledge and RAG&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Platform data&lt;/td&gt;
&lt;td&gt;Authorized JDs, de-identified résumés, search and interaction data&lt;/td&gt;
&lt;td&gt;Continued pretraining and matching&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Expert labels&lt;/td&gt;
&lt;td&gt;Normalized roles, skill evidence, fit judgments, preferred responses&lt;/td&gt;
&lt;td&gt;SFT, preference optimization, evaluation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Online feedback&lt;/td&gt;
&lt;td&gt;Accept, edit, reply, apply, interview, complaint&lt;/td&gt;
&lt;td&gt;Iteration and impact measurement&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every record needs provenance, authorization basis, collection time, owner, sensitivity, permitted tasks, transformation history, retention, and deletion status.&lt;/p&gt;

&lt;p&gt;The fact that data exists in a platform database does not automatically authorize model training. Product operation, recommendation, fraud prevention, and training are different processing purposes and require separate review.&lt;/p&gt;

&lt;h3&gt;
  
  
  Recruitment data pipeline
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source registration and permission review
        ↓
parse JDs, résumés, conversations, and event logs
        ↓
remove templates, ads, contact solicitation, and corruption
        ↓
detect language, job family, industry, and content type
        ↓
detect PII, tokenize replacements, isolate identity mapping
        ↓
exact dedup, résumé-version dedup, fuzzy JD-template dedup
        ↓
detect fraud, low quality, discriminatory text, and conflicts
        ↓
quality scoring and evidence-completeness checks
        ↓
split by time, user, and company—not random rows
        ↓
dataset card, version, and audit record
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Regular expressions are insufficient for de-identification. Emails and phone numbers fit rules; names, schools, project descriptions, addresses, and identity hints in free text need NER, dictionaries, model-based detection, and sampled review.&lt;/p&gt;

&lt;p&gt;Random row splits are also unsafe. Multiple résumés from one person, templated JDs from one employer, or messages from one conversation can leak across train and test sets. Group by person and employer, split by time, and check contamination against public benchmarks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: choose a base model by workload, not leaderboard rank
&lt;/h2&gt;

&lt;p&gt;For Chinese recruitment, candidate open-weight families include Qwen, GLM, and Llama. The Qwen ecosystem supports Transformers, vLLM, SGLang, and fine-tuning frameworks such as LLaMA-Factory and TRL.&lt;a href="https://github.com/QwenLM/Qwen3" rel="noopener noreferrer"&gt;Qwen official repository&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Evaluate:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;License:&lt;/strong&gt; commercial and derivative-model terms;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chinese and mixed-language quality:&lt;/strong&gt; titles and technical stacks often mix Chinese and English;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Structured output:&lt;/strong&gt; JSON Schema adherence and field stability;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Long context:&lt;/strong&gt; full résumés, JDs, and conversations—not just advertised context length;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool calling:&lt;/strong&gt; argument accuracy, recovery, and authorization boundaries;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Serving cost:&lt;/strong&gt; TTFT, TPOT, throughput, and memory at target concurrency;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Domain baseline:&lt;/strong&gt; performance on the company's recruitment evaluation suite.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A 7B–14B model is often the right first experiment. Prove the task and data before scaling. Larger models are not automatically better for every classifier or extractor, and stable tasks can later be distilled into smaller models.&lt;/p&gt;

&lt;p&gt;Measure the tokenizer on real JDs, résumés, and technical vocabulary: characters per token, truncation rate, and terminology fragmentation. Do not modify the vocabulary unless measured gains justify compatibility and retraining costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: train in stages
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Stage A: continued pretraining (optional)
&lt;/h3&gt;

&lt;p&gt;Continued pretraining teaches domain language and relationships using large amounts of unlabeled text. Candidate sources include authorized and deduplicated JDs, de-identified occupational material, public labor rules, high-quality industry documents, and strictly governed business text.&lt;/p&gt;

&lt;p&gt;Do not dump all résumés and conversations into pretraining. Apply PII, safety, quality, duplication, and mixture controls first. Mix in some general data to reduce catastrophic forgetting, and use small ablations to determine whether continued pretraining is worth its cost.&lt;/p&gt;

&lt;p&gt;If domain text is limited and the base model is already strong, SFT plus RAG is often a better investment.&lt;/p&gt;

&lt;p&gt;Continued pretraining still optimizes next-token cross-entropy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;L_CPT = -Σ log Pθ(x_t | x_&amp;lt;t)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Four engineering controls matter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mixture:&lt;/strong&gt; sweep candidate domain/general ratios such as 3:7, 5:5, and 7:3 in small runs instead of treating one ratio as law;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Boundaries:&lt;/strong&gt; sequence packing improves utilization, but attention must not leak across documents;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Token budget:&lt;/strong&gt; estimate effective tokens multiplied by cost per training token, not file size;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stopping:&lt;/strong&gt; monitor domain validation loss, general-capability regression, and target-task metrics together.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each checkpoint needs a data manifest, code revision, random seed, optimizer state, and mixture. Falling domain loss with large general regressions indicates forgetting, not success.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stage B: supervised fine-tuning
&lt;/h3&gt;

&lt;p&gt;SFT should cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JD and résumé extraction;&lt;/li&gt;
&lt;li&gt;skill and experience evidence;&lt;/li&gt;
&lt;li&gt;search-constraint parsing;&lt;/li&gt;
&lt;li&gt;fit explanations and gap analysis;&lt;/li&gt;
&lt;li&gt;JD rewriting and résumé suggestions;&lt;/li&gt;
&lt;li&gt;recruitment conversation and tool calls;&lt;/li&gt;
&lt;li&gt;clarification and abstention when information is missing;&lt;/li&gt;
&lt;li&gt;privacy, fairness, and safety cases.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A high-quality example includes not only a prompt and response, but task type, source evidence, allowed tools, expected output, risk labels, and dataset version.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"messages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"system"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"You are a recruitment assistant. Use only the supplied job and résumé. Never infer age, marital status, family plans, or health."&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Explain matches and gaps.&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;[JOB]...&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;[RESUME]..."&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"assistant"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;matched&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:[...],&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;gaps&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:[...],&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;unknown&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:[...],&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;evidence&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:[...]}"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"task"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"job_candidate_explanation"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"risk_tags"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"employment"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"personal_information"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"dataset_version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"recruit-sft-2026-08"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;LoRA or QLoRA is appropriate for fast validation. LLaMA-Factory supports continued pretraining, SFT, DPO, and related workflows.&lt;a href="https://github.com/hiyouga/LlamaFactory" rel="noopener noreferrer"&gt;LLaMA-Factory&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;model_name_or_path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Qwen/Qwen3-8B&lt;/span&gt;
&lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;sft&lt;/span&gt;
&lt;span class="na"&gt;do_train&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="na"&gt;finetuning_type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;lora&lt;/span&gt;
&lt;span class="na"&gt;lora_target&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;all&lt;/span&gt;
&lt;span class="na"&gt;dataset&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;recruitment_sft&lt;/span&gt;
&lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;qwen3&lt;/span&gt;
&lt;span class="na"&gt;cutoff_len&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;4096&lt;/span&gt;
&lt;span class="na"&gt;learning_rate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;1.0e-4&lt;/span&gt;
&lt;span class="na"&gt;num_train_epochs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2.0&lt;/span&gt;
&lt;span class="na"&gt;bf16&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="na"&gt;val_size&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.05&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llamafactory-cli train recruitment_sft.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are starting parameters, not a universal recipe. Learning rate, epochs, sequence length, rank, and mixture require validation and ablation.&lt;/p&gt;

&lt;p&gt;Several SFT details are easy to miss:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;normally compute loss only on assistant tokens instead of teaching the model to repeat system and user text;&lt;/li&gt;
&lt;li&gt;bucket and pack sequences to reduce padding while preserving conversation boundaries;&lt;/li&gt;
&lt;li&gt;evaluate both token loss and schema validity for structured tasks—they do not always move together;&lt;/li&gt;
&lt;li&gt;start LoRA experiments around rank 16 or 32 on attention and MLP linear layers, then expand through ablation;&lt;/li&gt;
&lt;li&gt;maintain a blind test set never used during prompt iteration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whether full fine-tuning beats LoRA depends on dataset size, task breadth, and compute. First use LoRA to prove the data; run a controlled full-tuning comparison only when adapter capacity is a measured bottleneck.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stage C: preference optimization
&lt;/h3&gt;

&lt;p&gt;Once the model can perform the task but remains inconsistent in style, evidence, or refusal boundaries, collect preferred and rejected responses.&lt;/p&gt;

&lt;p&gt;Prefer grounded explanations over unsupported judgments, uncertainty over fabricated experience, capability-related language over age or family proxies, concise action over empty prose, and valid tool calls over invented live job data.&lt;/p&gt;

&lt;p&gt;DPO is simpler than traditional RLHF for an initial system. TRL provides SFT, DPO, reward modeling, and other post-training tools.&lt;a href="https://github.com/huggingface/trl" rel="noopener noreferrer"&gt;Hugging Face TRL&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do not adopt GRPO simply because it is fashionable. Reinforcement learning is most dependable when rewards are verifiable—schema validity, SQL execution, code tests, or deterministic rules. Subjective employment judgments should never be reduced to one reward model.&lt;/p&gt;

&lt;p&gt;DPO directly increases the relative probability of a preferred response over a rejected one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;L_DPO = -log σ(β[(log πθ(y+|x)-log πref(y+|x))
                 -(log πθ(y-|x)-log πref(y-|x))])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;β&lt;/code&gt; controls deviation from the reference model. Bucket by task, length, and risk, and verify that “preference improvement” is not merely verbosity. When recruitment experts genuinely disagree, retain annotator distributions or send the case to review instead of inventing one truth.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: use RAG for changing facts and tools for actions
&lt;/h2&gt;

&lt;p&gt;Job availability, compensation, employer information, and application status change continuously. They should not be memorized in model parameters.&lt;/p&gt;

&lt;p&gt;The retrieval layer can include current jobs and versions, verified employer data, skill knowledge, policies, labor rules, and only the résumés or conversations the current user is authorized to access.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;question
   ↓
intent and authorization
   ↓
structured filters: location, salary, experience, status
   ↓
hybrid retrieval: lexical + vector
   ↓
reranker
   ↓
evidence compression and citations
   ↓
generation or business-tool call
   ↓
factuality, authorization, and safety checks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Recruitment search cannot be vector similarity alone. Location, compensation, experience, job status, and access are hard filters. Semantic retrieval handles differences such as “AI platform engineering” versus “LLM infrastructure.” A reranker then scores a small candidate set.&lt;/p&gt;

&lt;p&gt;Do not add raw BM25 and vector scores directly; they usually have incompatible scales. Reciprocal Rank Fusion is a robust first implementation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RRF(d) = Σ 1 / (k + rank_i(d))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Retrieve lexical and dense Top-K lists separately, fuse their ranks, and send the best 50–200 records to a cross-encoder. Enforce &lt;code&gt;tenant_id&lt;/code&gt;, status, location, compensation, freshness, and authorization filters in the index or service before evidence reaches the LLM—not by redacting after generation.&lt;/p&gt;

&lt;p&gt;Write actions—submitting a résumé, sending a message, or editing a JD—need typed schemas, server-side reauthorization, idempotency keys, preview and confirmation, timeout and compensation behavior, and audit logs. The model may propose an action; it must not bypass business permissions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 8: train matching as a separate system
&lt;/h2&gt;

&lt;p&gt;Large-scale job matching remains a retrieval and recommendation problem.&lt;/p&gt;

&lt;p&gt;Use a two-tower model to encode candidate and job representations for ANN retrieval. Apply a cross-encoder or learning-to-rank model to the retrieved set, then rerank for freshness, diversity, deduplication, and business constraints.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;candidate profile → candidate tower ─┐
                                     ├─ similarity → ANN Top-K
job profile       → job tower ───────┘
                                           ↓
                            cross-encoder / learning-to-rank
                                           ↓
                         rules, freshness, diversity, fairness
                                           ↓
                              LLM-generated explanation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An LLM can enrich features, produce weak labels, and explain results. It should not iterate over millions of jobs at inference time.&lt;/p&gt;

&lt;p&gt;Labels also need care. A click is not ground truth. Exposure is controlled by the previous model; clicks respond to titles and compensation; conversations depend on recruiter activity. Use layered events—impression, click, save, apply, reply, interview, hire—and account for position bias, negative sampling, and delayed outcomes.&lt;/p&gt;

&lt;p&gt;Two-tower retrieval can use a contrastive objective. For candidate vector &lt;code&gt;u&lt;/code&gt;, positive job &lt;code&gt;v+&lt;/code&gt;, and jobs in the batch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;L_retrieval = -log exp(sim(u,v+)/τ) / Σ_j exp(sim(u,v_j)/τ)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Random negatives are often too easy. Add hard negatives such as the same title at a different seniority or the same skill set in an incompatible location. An exposed but unclicked job is not necessarily negative—it may have appeared too low—so preserve exposure position and filter likely false negatives.&lt;/p&gt;

&lt;p&gt;The ranker can combine semantic crosses, structured compatibility, freshness, and behavior. LLM explanations must read the factual features and source evidence used by the final ranking, avoiding one mechanism for ranking and an invented story for explanation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 9: build evaluation before large training runs
&lt;/h2&gt;

&lt;p&gt;Without a private recruitment benchmark, the team cannot know whether domain training helped.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding and generation
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Capability&lt;/th&gt;
&lt;th&gt;Metrics&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Field extraction&lt;/td&gt;
&lt;td&gt;Precision, recall, F1, schema-valid rate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JD rewriting&lt;/td&gt;
&lt;td&gt;Factual fidelity, completeness, violations, acceptance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fit explanation&lt;/td&gt;
&lt;td&gt;Evidence precision, omissions, unsupported-claim rate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RAG&lt;/td&gt;
&lt;td&gt;Recall@K, citation correctness, groundedness, abstention&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tool use&lt;/td&gt;
&lt;td&gt;Argument accuracy, execution success, unauthorized calls, duplicates&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Safety&lt;/td&gt;
&lt;td&gt;PII leakage, discriminatory language, prompt-injection success&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Matching and ranking
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Recall@K for retrieval;&lt;/li&gt;
&lt;li&gt;MRR and NDCG@K for ordering;&lt;/li&gt;
&lt;li&gt;coverage for long-tail jobs and new candidates;&lt;/li&gt;
&lt;li&gt;calibration between scores and outcomes;&lt;/li&gt;
&lt;li&gt;subgroup differences across legitimate evaluation slices;&lt;/li&gt;
&lt;li&gt;online valid-contact, reply, application, interview, and complaint rates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Freeze the test set by time and exclude future feedback from training. General leaderboards cannot replace domain evaluation.&lt;/p&gt;

&lt;p&gt;Release through shadow traffic first: generate outcomes without affecting users, compare against production, then progress through a small canary only after safety, quality, latency, and cost gates pass.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 10: production is more than starting vLLM
&lt;/h2&gt;

&lt;p&gt;Open-source engines such as vLLM and SGLang provide efficient serving, but production also requires gateways, routing, caching, degradation, and observability.&lt;a href="https://github.com/vllm-project/vllm" rel="noopener noreferrer"&gt;vLLM&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;API gateway
   ↓
identity, quota, length, and risk checks
   ↓
task router
   ├─ small model: classification, extraction, rewriting
   ├─ larger model: complex analysis and dialogue
   ├─ embedding/reranker: retrieval and matching
   └─ rule service: constraints and safety
   ↓
batching, KV cache, timeout, circuit breaker
   ↓
schema, citation, and safety validation
   ↓
logs, traces, cost, and quality sampling
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Observe time to first token, time per output token, total latency, queue time, token counts, GPU utilization, cost per task, timeout, cancellation, retry, fallback, JSON failures, tool failures, and unsupported claims—split by model, task, language, and version.&lt;/p&gt;

&lt;p&gt;A model upgrade is not one file replacement. Prompts, tokenizers, retrieval, tool schemas, quantization, and decoding parameters all affect behavior and need coordinated versioning.&lt;/p&gt;

&lt;p&gt;A first capacity approximation is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;replicas ≈ peak QPS × P95 service time
           ÷ safe concurrency per replica × headroom
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Correct it with load tests using real input and output lengths. Benchmark short extraction, long-résumé analysis, and multi-turn dialogue separately; averages hide long-tail out-of-memory failures. Compare BF16, FP8/INT8, and lower-bit quantization on the recruitment gold set before production—throughput alone is not an acceptance test.&lt;/p&gt;

&lt;h2&gt;
  
  
  The safety line in recruitment
&lt;/h2&gt;

&lt;p&gt;Recruitment is not ordinary text generation. A bad recommendation wastes time; an opaque rejection can affect a person's livelihood.&lt;/p&gt;

&lt;p&gt;China's Personal Information Protection Law requires transparency and fairness when personal information is used for automated decision-making.&lt;a href="https://www.samr.gov.cn/wljys/gzzd/art/2023/art_3ef1e889c1e644d4b65b5f5c7f432386.html" rel="noopener noreferrer"&gt;Personal Information Protection Law&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At minimum:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Do not use sex, age, ethnicity, family status, or health as matching features without a lawful and justified basis;&lt;/li&gt;
&lt;li&gt;test proxy effects from school, address, career gaps, and similar attributes;&lt;/li&gt;
&lt;li&gt;never let the LLM make final hiring or rejection decisions alone;&lt;/li&gt;
&lt;li&gt;ground important recommendations in job and résumé evidence;&lt;/li&gt;
&lt;li&gt;provide human review, correction, opt-out, and appeal paths;&lt;/li&gt;
&lt;li&gt;enforce résumé authorization at retrieval, prompt, log, and cache layers;&lt;/li&gt;
&lt;li&gt;audit dataset, model, prompt, and tool-call versions;&lt;/li&gt;
&lt;li&gt;complete applicable security assessment, algorithm filing, or model registration before public launch.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Removing a name does not make a model fair. Schools, postal codes, employment years, and writing style can become identity proxies. Fairness review requires lawful subgroup analysis and joint ownership across legal, ethics, recruitment, product, and ML teams.&lt;/p&gt;

&lt;h2&gt;
  
  
  An executable 12-week plan
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Period&lt;/th&gt;
&lt;th&gt;Goal&lt;/th&gt;
&lt;th&gt;Deliverable&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Weeks 1–2&lt;/td&gt;
&lt;td&gt;Tasks and baselines&lt;/td&gt;
&lt;td&gt;Three scenarios, gold evaluation set, production baseline, compliance checklist&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Weeks 3–4&lt;/td&gt;
&lt;td&gt;Data and ontology&lt;/td&gt;
&lt;td&gt;Ontology v1, lineage, de-identification pipeline, dataset v1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Weeks 5–6&lt;/td&gt;
&lt;td&gt;Open-model PoC&lt;/td&gt;
&lt;td&gt;Three-model benchmark, LoRA SFT, error taxonomy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Weeks 7–8&lt;/td&gt;
&lt;td&gt;RAG and matching&lt;/td&gt;
&lt;td&gt;Hybrid retrieval, reranker, two-tower baseline, citations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Weeks 9–10&lt;/td&gt;
&lt;td&gt;Preference and safety&lt;/td&gt;
&lt;td&gt;DPO set, safety suite, red team, authorization and audit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Week 11&lt;/td&gt;
&lt;td&gt;Shadow and canary&lt;/td&gt;
&lt;td&gt;Shadow report, latency/cost report, 1–5% canary&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Week 12&lt;/td&gt;
&lt;td&gt;Review&lt;/td&gt;
&lt;td&gt;Business impact, regression report, decision on scale and model size&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Define release gates in advance: extraction F1, schema validity, unsupported-claim rate, zero severe PII or authorization failures, P95 latency and cost budgets, and a statistically credible lift in acceptance or valid conversations.&lt;/p&gt;

&lt;p&gt;Exact thresholds must come from the business baseline, not another company's blog post.&lt;/p&gt;

&lt;h2&gt;
  
  
  Seven common failure modes
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Train first, search for a use case later:&lt;/strong&gt; the result is a demo chatbot without a business outcome.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treat database access as training consent:&lt;/strong&gt; résumé, conversation, and behavior purposes are ignored.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Randomly split rows:&lt;/strong&gt; users and templates leak into test data and inflate scores.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build only an LLM:&lt;/strong&gt; no scalable retrieval, high latency, and high cost.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trust general benchmarks:&lt;/strong&gt; the model solves math but cannot extract salary evidence consistently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treat clicks as truth:&lt;/strong&gt; the new system learns the old system's exposure and position bias.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automatically reject candidates:&lt;/strong&gt; no evidence, explanation, human review, or fairness control.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  My conclusion
&lt;/h2&gt;

&lt;p&gt;The moat in a recruitment model is not renaming an open model or maximizing parameter count.&lt;/p&gt;

&lt;p&gt;It comes from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a consistent, evolving job and skill ontology;&lt;/li&gt;
&lt;li&gt;lawful governance of high-quality recruitment data;&lt;/li&gt;
&lt;li&gt;correct boundaries between search, recommendation, LLMs, RAG, and rules;&lt;/li&gt;
&lt;li&gt;evaluation against both business outcomes and safety constraints;&lt;/li&gt;
&lt;li&gt;a loop that turns failures, edits, and final outcomes back into better data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without these five elements, a self-developed model is an expensive chatbot.&lt;/p&gt;

&lt;p&gt;With them, even a 7B–14B open-weight model can create real value in version one.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Building a recruitment LLM from zero to one is not writing a Transformer from zero. It is building, from zero, a system that connects recruitment knowledge, business data, model capability, and real outcomes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.cac.gov.cn/2024-04/02/c_1713729983803145.htm" rel="noopener noreferrer"&gt;Cyberspace Administration of China: Filed Generative AI Services&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.miit.gov.cn/zcfg/qtl/art/2023/art_f4e8f71ae1dc43b0980b962907b7738f.html" rel="noopener noreferrer"&gt;Interim Measures for the Management of Generative AI Services&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.samr.gov.cn/wljys/gzzd/art/2023/art_3ef1e889c1e644d4b65b5f5c7f432386.html" rel="noopener noreferrer"&gt;Personal Information Protection Law of the People's Republic of China&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/QwenLM/Qwen3" rel="noopener noreferrer"&gt;QwenLM: Qwen3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/huggingface/trl" rel="noopener noreferrer"&gt;Hugging Face: TRL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/huggingface/datatrove" rel="noopener noreferrer"&gt;Hugging Face: DataTrove&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/hiyouga/LlamaFactory" rel="noopener noreferrer"&gt;LLaMA-Factory: Unified Efficient Fine-Tuning&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/vllm-project/vllm" rel="noopener noreferrer"&gt;vLLM: High-Throughput LLM Inference and Serving&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2106.09685" rel="noopener noreferrer"&gt;Hu et al.: LoRA — Low-Rank Adaptation of Large Language Models&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2305.14314" rel="noopener noreferrer"&gt;Dettmers et al.: QLoRA — Efficient Finetuning of Quantized LLMs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/1606.07792" rel="noopener noreferrer"&gt;Cheng et al.: Wide &amp;amp; Deep Learning for Recommender Systems&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2305.18290" rel="noopener noreferrer"&gt;Rafailov et al.: Direct Preference Optimization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2004.04906" rel="noopener noreferrer"&gt;Karpukhin et al.: Dense Passage Retrieval for Open-Domain Question Answering&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
