nx_actor_role_llm_v2.nx
buildroot/runtime/nx_actor_role_llm_v2.nx
about
nx_actor_role_llm_v2.nx -- REAL transformer-forward LLM actor.
Where [[nx_actor_role_llm]] drives a tiny 3-step micro-pipeline
(embed + matmul + sample) over synthetic toy weights, THIS adapter
wraps the full Llama-class runner [[nx_llm_run_v2]] -- multi-layer
transformer forward including RoPE + RMSNorm + multi-head attention
+ SwiGLU FFN + output projection + temperature + top_k + sample.
Cooperative phases:
Phase 0 (INIT) : reserved
Phase 1 (RUN) : single call to nx_llm_generate_one_v2(spec, gguf,
hdr, bpe, prompt, ..., prng, rope_base, attn_scale)
-- this is the monolithic generate-one-token step
Phase 2 (EMIT) : fanout LLM_TOKEN with the generated token if
positive; else fanout ERROR_REPORT with verdict id
Phase 3 (DONE) : terminal
V1 of this adapter is single-shot (one token per actor lifetime).
V2 will add a reset_for_next_token loop similar to nx_actor_role_llm.
Composes [[project-conductor-arc-phases-c-d-integrate-with-nishi-ai
-2026-05-19]] -- the LLM substrate the other agent built becomes
callable from inside the parallel-companion actor system.
dependencies 8 imports · 15 importers
diagram shows first 10 each side; +0 more imports, +5 more importers in the complete lists below.
imports: nx_syscalls.nxnx_tier.nxnx_model_spec.nxnx_gguf.nxnx_bpe.nxnx_llm_run_v2.nxnx_actor.nxnx_message.nx
imported by: nx_actor_role_llm_v2_autoreg_test.nxnx_actor_role_llm_v2_real_autoreg_test.nxnx_actor_role_llm_v2_real_test.nxnx_actor_role_llm_v2_test.nxnx_bench_dist_emit_test.nxnx_bench_dist_persist_test.nxnx_bench_scale_dist_emit_test.nxnx_bench_scale_test.nxnx_bench_stress_autoreg_test.nxnx_bench_stress_emit_test.nxnx_bench_v1_vs_v2_test.nxnx_dual_real_llm_compose_test.nxnx_dual_real_llm_emit_test.nxnx_quad_real_emit_test.nxnx_session_real_llm_compose_test.nx
structs
| 57 | struct NxLlmV2ActorCtx |
consts
| 36 | const NX_LV_PHASE_INIT: nx_int = 0 |
| 37 | const NX_LV_PHASE_RUN: nx_int = 1 |
| 38 | const NX_LV_PHASE_EMIT: nx_int = 2 |
| 39 | const NX_LV_PHASE_DONE: nx_int = 3 |
| 40 | const NX_LV_PHASE_N: nx_int = 4 |
| 44 | const NX_LV_V_STEPPED: nx_int = 0 |
| 45 | const NX_LV_V_COMPLETED: nx_int = 1 |
| 46 | const NX_LV_V_FAILED_RUN: nx_int = 2 |
| 47 | const NX_LV_V_INVALID: nx_int = 3 |
| 48 | const NX_LV_V_NULL: nx_int = 4 |
| 49 | const NX_LV_V_N: nx_int = 5 |
| 75 | const NX_LV_CTX_BYTES: nx_int = 120 // 15 fields * 8 |
functions
| 79 | func nx_lv_phase_is_valid(p: nx_int) -> nx_int called by 1: main |
| 85 | func nx_lv_v_is_valid(v: nx_int) -> nx_int called by 1: main |
| 93 | func nx_lv_actor_new(spec: *NxModelSpec, |
| 137 | func _lv_step_run(ctx: *NxLlmV2ActorCtx) -> nx_int |
| 155 | func _lv_step_emit(ctx: *NxLlmV2ActorCtx, |
| 175 | func nx_lv_actor_step(ctx: *NxLlmV2ActorCtx, |
| 221 | func nx_lv_actor_reset_for_next_token(ctx: *NxLlmV2ActorCtx, |
| 246 | func nx_lv_actor_phase(ctx: *NxLlmV2ActorCtx) -> nx_int called by 1: main |
| 251 | func nx_lv_actor_token(ctx: *NxLlmV2ActorCtx) -> nx_int |
| 257 | func nx_lv_actor_runner_verdict(ctx: *NxLlmV2ActorCtx) -> nx_int |
| 262 | func nx_lv_actor_is_done(ctx: *NxLlmV2ActorCtx) -> nx_int |