code wiki / (root) / nx_actor_role_llm_v2.nx

nx_actor_role_llm_v2.nx

buildroot/runtime/nx_actor_role_llm_v2.nx

10430 B266 linesdepth 10pulls 36 transitivereach 15 importersview sourcekind librarytopic actor
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_tier.nx nx_model_spec.nx nx_gguf.nx nx_bpe.nx nx_llm_run_v2.nx nx_actor.nx nx_message.nx nx_actor_role_llm_v2.nx nx_actor_role_llm_v2_autoreg_test. nx_actor_role_llm_v2_real_autoreg_ nx_actor_role_llm_v2_real_test.nx nx_actor_role_llm_v2_test.nx nx_bench_dist_emit_test.nx nx_bench_dist_persist_test.nx nx_bench_scale_dist_emit_test.nx nx_bench_scale_test.nx nx_bench_stress_autoreg_test.nx nx_bench_stress_emit_test.nx

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

57struct NxLlmV2ActorCtx

consts

36const NX_LV_PHASE_INIT: nx_int = 0
37const NX_LV_PHASE_RUN: nx_int = 1
38const NX_LV_PHASE_EMIT: nx_int = 2
39const NX_LV_PHASE_DONE: nx_int = 3
40const NX_LV_PHASE_N: nx_int = 4
44const NX_LV_V_STEPPED: nx_int = 0
45const NX_LV_V_COMPLETED: nx_int = 1
46const NX_LV_V_FAILED_RUN: nx_int = 2
47const NX_LV_V_INVALID: nx_int = 3
48const NX_LV_V_NULL: nx_int = 4
49const NX_LV_V_N: nx_int = 5
75const NX_LV_CTX_BYTES: nx_int = 120 // 15 fields * 8

functions

79func nx_lv_phase_is_valid(p: nx_int) -> nx_int
called by 1: main
85func nx_lv_v_is_valid(v: nx_int) -> nx_int
called by 1: main
93func nx_lv_actor_new(spec: *NxModelSpec,
137func _lv_step_run(ctx: *NxLlmV2ActorCtx) -> nx_int
155func _lv_step_emit(ctx: *NxLlmV2ActorCtx,
called by 1: nx_lv_actor_step calls 1: nx_ms_send_fanout
175func nx_lv_actor_step(ctx: *NxLlmV2ActorCtx,
221func nx_lv_actor_reset_for_next_token(ctx: *NxLlmV2ActorCtx,
246func nx_lv_actor_phase(ctx: *NxLlmV2ActorCtx) -> nx_int
called by 1: main
251func nx_lv_actor_token(ctx: *NxLlmV2ActorCtx) -> nx_int
called by 3: mainmainmain
257func nx_lv_actor_runner_verdict(ctx: *NxLlmV2ActorCtx) -> nx_int
called by 2: mainmain
262func nx_lv_actor_is_done(ctx: *NxLlmV2ActorCtx) -> nx_int
called by 3: mainmainmain