Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ share `/data/target` across agent lanes. See
the precise threat model. Ordinary compilation is not a hardware-test permit.
Every Cargo invocation, including lockfile generation and formatting, uses the
runner; an ambient compiler wrapper must not escape the isolated lane.
Host CPU compile admission is separate: where required, the approved admission
entrypoint wraps this runner rather than relying on ambient PATH shims.

## Key patterns

Expand Down Expand Up @@ -62,6 +64,7 @@ runner; an ambient compiler wrapper must not escape the isolated lane.
| STT pipeline | `crates/ekphrasis/` |
| Tokenizer | `crates/tokenize/` |
| Native text request pipeline | `crates/text/` |
| Shared bounded template rendering | `crates/templates/` |
| Shared synthetic GGUF test data | `crates/test-fixtures/` (dev-only) |

The private planning corpus governs future scope and sequencing. This repository's
Expand Down
32 changes: 32 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ semantically respects that boundary.
Stella API and tensor/encoder graph; direct consumers disable default
features to exclude that accelerator-capable graph. Consumers still use the
unchanged `core::EmbeddingModel` contract.
- `rerank` consumes the same CPU decoder/tokenizer graph and `templates` for
native Qwen3 pair scoring. Its default `modernbert` feature preserves the
existing encoder implementation; disabling default features removes that
accelerator-capable graph without changing the `Reranker` contract.
- `templates` owns bounded, capability-free artifact-template rendering for
`text` and `rerank`. It has no model, GGUF, tokenizer or device dependency;
pipelines retain artifact binding, typed message roles and token policy.
- `tokenize` owns exact vocabulary/special-ID verification and refusal of
configured tokenizer padding or truncation. Native text, embedding and
reranking setup invoke that guard; ordinary tokenizer consumers retain their
configured behavior. Disabling automatic special tokens alone does not
disable padding or truncation.
- `taxis` depends locally on `hipcore`.
- `kernels/gpu` enables the local `hipcore` and `taxis` dependencies and GPU
launcher modules, including their nested parity references. Standalone
Expand Down Expand Up @@ -186,6 +198,26 @@ instruction, and advertised dimensions do not imply Matryoshka qualification.
Synthetic family and pipeline tests do not establish deployed-artifact parity,
retrieval quality, reindex authority, serving or GPU qualification.

## Native reranking ownership

`decoders::Qwen3RankWeights` admits a distinct rank profile over the shared
private Qwen3 body. Rank pooling, exact `[yes, no]` labels and a two-row
`cls.output.weight` are required; embedding admission still refuses extra
heads. The decoder returns raw terminal-token classifier logits after final
RMS normalization. `rerank` owns their signed `yes - no` reduction and returns
one relevance logit per input index, not probabilities or sorted results.

The pipeline renders its verified artifact's embedded template using typed
system/query/document messages and an explicit setup instruction. It encodes
the whole render with automatic special tokens disabled. Separate byte,
token and batch bounds reject oversized inputs without truncation. The shared
`templates` owner retains strict undefined values, fuel, recursion and output
bounds, without external or named template resolution. Public batch structs
are revalidated at the prediction boundary; failure publishes no partial map.
These controls do not bound all tokenizer/template intermediates or total
process memory. Synthetic execution does not resolve exact-artifact conversion
provenance, template parity, retrieval quality, deployment or hardware gates.

## cfg flags

- `logismos_no_gpu_kernels` - build path without compiled HIP kernels. Implemented GPU operations
Expand Down
20 changes: 19 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ tokenize = { path = "crates/tokenize" }
cache = { path = "crates/cache" }
decode = { path = "crates/decode" }
text = { path = "crates/text" }
templates = { path = "crates/templates" }
core = { path = "crates/core" }
transformers = { path = "crates/transformers" }
encoders = { path = "crates/encoders" }
Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ targeting AMD gfx1100, with owned HIP/WMMA kernels and progressively owned execu
**Status:** HIP primitives, Stella CPU golden-fixture parity, action-free placement,
process-local admission/residency coordination, and bounded instruction emulation exist.
GGUF inspection, digest-bound mixed-weight CPU projections, bounded hybrid CPU
text generation and native Qwen3 CPU embeddings are foundations, not serving or
text generation and native Qwen3 CPU embeddings/reranking are foundations, not serving or
hardware qualification. The W7900
is available; the RX 7900 XTX is a
planned second device and requires its own qualification. The experimental below-HIP
Expand Down Expand Up @@ -101,6 +101,21 @@ establish exact deployed-artifact parity, retrieval quality or reindex authority
Direct `embed` consumers disable default features for the HIP-free native path;
the default `stella` feature preserves the existing Stella API and dependencies.

[`rerank`](crates/rerank/src/lib.rs) implements native Qwen3 CPU pair scoring
through the existing `Reranker` contract. Its checked rank profile shares the
causal decoder body without weakening embedding admission. The verified
artifact supplies its template; setup supplies the instruction and independent
byte/token/batch limits. Each input index receives one raw `yes - no` relevance
logit, not a probability. Oversized requests fail without truncation.
Direct native consumers disable default features; the default `modernbert`
feature preserves the existing encoder implementation. Exact converted-model
provenance, template/tokenizer parity and retrieval quality remain unqualified.

[`templates`](crates/templates/src/lib.rs) owns bounded template rendering for
text generation and reranking. It permits no host callbacks, loader or named
template registration; output, recursion and fuel limits are operational
controls, not a total-memory sandbox.

[`contracts/runtime-scope.toml`](contracts/runtime-scope.toml) records this product boundary.
Bounded adaptation remains absent unless a named consumer contract supplies an output owner,
retention and revocation policy, and rollback. The repository guard validates those declared
Expand Down
26 changes: 12 additions & 14 deletions crates/decoders/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ pub enum Error {
location: snafu::Location,
},

/// A Qwen3 embedding metadata value is missing, mistyped, or unsupported.
#[snafu(display("qwen3 embedding metadata `{key}` violates {rule}"))]
/// A Qwen3 profile metadata value is missing, mistyped, or unsupported.
#[snafu(display("qwen3 profile metadata `{key}` violates {rule}"))]
Qwen3Metadata {
/// Exact GGUF key responsible for the refusal.
key: &'static str,
Expand All @@ -414,8 +414,8 @@ pub enum Error {
location: snafu::Location,
},

/// A Qwen3 embedding tensor inventory entry is missing or malformed.
#[snafu(display("qwen3 embedding tensor `{name}` violates {rule}"))]
/// A Qwen3 profile tensor inventory entry is missing or malformed.
#[snafu(display("qwen3 profile tensor `{name}` violates {rule}"))]
Qwen3Tensor {
/// Exact GGUF tensor name responsible for the refusal.
name: String,
Expand All @@ -426,8 +426,8 @@ pub enum Error {
location: snafu::Location,
},

/// A bounded Qwen3 embedding execution request is invalid.
#[snafu(display("qwen3 embedding execution request {requested} violates {rule}"))]
/// A bounded Qwen3 profile execution request is invalid.
#[snafu(display("qwen3 profile execution request {requested} violates {rule}"))]
Qwen3Execution {
/// Requested token count or other bounded execution value.
requested: usize,
Expand All @@ -438,8 +438,8 @@ pub enum Error {
location: snafu::Location,
},

/// Qwen3 embedding execution could not reserve one named local buffer.
#[snafu(display("qwen3 embedding could not reserve {length} values for {target}: {source}"))]
/// Qwen3 profile execution could not reserve one named local buffer.
#[snafu(display("qwen3 profile could not reserve {length} values for {target}: {source}"))]
Qwen3Allocation {
/// Named local buffer.
target: &'static str,
Expand All @@ -452,10 +452,8 @@ pub enum Error {
location: snafu::Location,
},

/// Qwen3 embedding execution produced a non-finite scalar.
#[snafu(display(
"qwen3 embedding arithmetic became non-finite during {stage} at index {index}"
))]
/// Qwen3 profile execution produced a non-finite scalar.
#[snafu(display("qwen3 profile arithmetic became non-finite during {stage} at index {index}"))]
Qwen3Arithmetic {
/// Mathematical stage.
stage: &'static str,
Expand All @@ -466,8 +464,8 @@ pub enum Error {
location: snafu::Location,
},

/// A checked shared CPU operation rejected Qwen3 embedding execution.
#[snafu(display("qwen3 embedding CPU operation failed: {source}"))]
/// A checked shared CPU operation rejected Qwen3 profile execution.
#[snafu(display("qwen3 profile CPU operation failed: {source}"))]
Qwen3Cpu {
/// Checked CPU operation failure.
source: kernels::Error,
Expand Down
2 changes: 2 additions & 0 deletions crates/decoders/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ pub mod qwen35_execution;
pub mod qwen35_recurrent;
mod qwen35_requirements;
pub mod qwen35_weights;
pub mod qwen3_rank;

pub use crate::error::{Error, Result};
pub use crate::qwen3::{Qwen3Execution, Qwen3Weights};
pub use crate::qwen3_rank::{Qwen3RankExecution, Qwen3RankWeights};
pub use crate::qwen35::Qwen35StructuralProfile;
pub use crate::qwen35_execution::{Qwen35Execution, Qwen35ExecutionPlan, Qwen35LogitSelection};
pub use crate::qwen35_recurrent::Qwen35RecurrentExecution;
Expand Down
Loading