Skip to content

LLM provider: make the intent prompt template a per-provider arg (+ minimal compiled prompt variant) #145

Description

@se-jo-ma

Context. The entire intent-classification procedure (schema + 6 rules + hard constraints — intent_v1.txt is 66 lines) is hard-wired as module-level constants _PROMPT_PATH/_PROMPT_VERSION in OpenAIProvider, inherited verbatim by LocalInferenceProvider. A fine-tuned checkpoint that has internalized the procedure still gets the whole procedure re-injected every request — defeating the per-token win. Most surgical, best-grounded rec; prerequisite for any compiled-checkpoint payoff. Relates to #82 (prompt_version in LLMProvenance).

Proposal. Promote the prompt path/version to constructor args; add a minimal compiled prompt variant.

  • OpenAIProvider(prompt_path=..., prompt_version=...) — defaults unchanged (intent_v1.txt/'v1'), preserving the determinism harness + byte-compat.
  • Add analysis/llm/prompts/intent_compiled_v1.txt — only the schema echo + $intent/$context_json slots.
  • Add LocalInferenceProviderSpec.prompt: Literal['full','compiled'] = 'full'; Broker._build_llm_provider passes the selected template.
  • prompt_version keeps flowing into LLMProvenance + the audit entry so the version hook + audit stream stay intact.

Where.

  • nautilus/analysis/llm/openai_provider.py:48-49 (_PROMPT_PATH/_PROMPT_VERSION) + :82-83 (template read); local_provider.py:38-54 (ctor); config/models.py:257-264 (LocalInferenceProviderSpec); core/broker.py:663-671 (local-provider build); LLMProvenance (base.py:96 / fallback.py:123); audit (broker.py:421).

Acceptance criteria.

  • Prompt path/version are constructor args; default behavior byte-identical (determinism harness green).
  • prompt='compiled' selects the minimal template; prompt_version distinguishes full vs compiled in provenance/audit.

Caveat. A minimal prompt against a model that did NOT internalize the procedure silently degrades classification — gate behind explicit opt-in; document that 'compiled' requires a compiled checkpoint. Keep the compiled prompt in sync with the IntentAnalysis schema.


Source: arXiv:2605.22502v1 — "Compiling Agentic Workflows into LLM Weights" (subterranean agents). Distilled from arXiv-research/2605.22502v1/analysis.md; file refs verified against current main by the analysis pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High priority: load-bearing v1 gaparea/coreBroker core, CLIPS routing, session stateenhancementNew feature or requestsize/M<2 days: multi-file feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions