Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
73dfeaf
deepnsm: sentence-level AriGraph reader (left-corner state machine)
claude Jun 7, 2026
beadbe6
deepnsm: lock Pika left-corner adaptation into architecture
claude Jun 7, 2026
a5d23f7
deepnsm: add signed_crystal — P64 + Crystal4096 bridge to holograph s…
claude Jun 7, 2026
4e95453
deepnsm: add SentenceTransformer64 — native P64 meaning field + CAM40…
claude Jun 7, 2026
1711336
docs: DeepNSM reader design document for PR review
claude Jun 7, 2026
98e6a96
docs: add reviewer glossary to DeepNSM reader design doc
claude Jun 7, 2026
52ae964
deepnsm: HorizonPolarity stub + Crystal4096 neighbourhood geometry (L1)
claude Jun 7, 2026
0c67aaf
docs: scope Anaphora64 (v1.5) and OGAR adapter (v2) as follow-up PRs
claude Jun 7, 2026
175696a
deepnsm: address PR #479 review — coref-keyed cam64, expectation life…
claude Jun 7, 2026
f299543
Merge remote-tracking branch 'origin/main' into claude/stoic-turing-M…
claude Jun 7, 2026
438f243
docs: mark v2 expectation-TTL policy split on clear_expected
claude Jun 7, 2026
d722c64
deepnsm: address CodeRabbit review nitpicks on #479
claude Jun 9, 2026
dd3d9ce
style: apply rustfmt to the deepnsm crate
claude Jun 9, 2026
887fed3
ci: wire deepnsm into fmt/clippy/test (fmt+test gating, clippy advisory)
claude Jun 9, 2026
bf95caa
deepnsm: resolve TD-DEEPNSM-CLIPPY-195 — hand-reviewed clippy sweep
claude Jun 9, 2026
a36600b
ci: promote deepnsm clippy advisory -> gating (TD-DEEPNSM-CLIPPY-195 …
claude Jun 9, 2026
4f73044
ci: declare least-privilege permissions on the deepnsm-wired workflows
claude Jun 9, 2026
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
11 changes: 11 additions & 0 deletions .claude/board/TECH_DEBT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2638,3 +2638,14 @@ W6 entropy-ledger reframe of `DEEPNSM-NSM-1`.
## TD-DEEPNSM-CLIPPY-195 — 12 pre-existing default-clippy lints in deepnsm (clippy 1.95 bump)

`cargo clippy --manifest-path crates/deepnsm/Cargo.toml --all-targets -- -D warnings` reports 12 errors across 7 files (codebook 2, encoder 4, similarity 2, disambiguator_glue/nsm_primes/parser/quantum_mode 1 each) — newer lints (`manual_repeat_n`, `uninlined_format_args`, …) that were clean when written and fire only under clippy 1.95.0. Pre-existing (not from the E-ENGLISH-BIFURCATES slice; `arcs.rs` is clean at pedantic+nursery). Tests unaffected (94+4+8+1 green). Fix = a separate mechanical sweep across the 7 files; deliberately NOT bundled into the feature slice (7-file scope creep). Surfaced 2026-05-31.

**Resolved 2026-06-09** (PR #479, branch `claude/stoic-turing-M0Eiq`, commit `bf95caa`):
hand-reviewed clippy sweep landed. `cargo clippy --manifest-path
crates/deepnsm/Cargo.toml --all-targets -- -D warnings` is now clean (exit 0).
Cleared the original 7-file set plus the lints in PR #479's new reader modules
(window / reader_state / crystal_neighborhood / sentence_transformer64 /
signed_crystal / codebook) surfaced by `--all-targets` — 22 lints across 13
files; 217 tests green. Fixes are hand-applied (NOT `clippy --fix`, which mangled
`reader_state.rs` into stranded-comment match guards). The CI clippy step for
deepnsm was promoted Tier-B advisory → Tier-A gating in
`.github/workflows/style.yml`.
5 changes: 5 additions & 0 deletions .github/workflows/rust-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ jobs:
run: cargo test --manifest-path crates/lance-graph-contract/Cargo.toml --tests
- name: Run contract doctests
run: cargo test --manifest-path crates/lance-graph-contract/Cargo.toml --doc
# deepnsm: standalone 0-dep codec crate, workspace-excluded, so the
# lance-graph test steps above never reached it. ~217 lib + integration +
# doctests, fast (no lance/datafusion/ndarray deps). Gating.
- name: Run deepnsm tests
run: cargo test --manifest-path crates/deepnsm/Cargo.toml
Comment thread
coderabbitai[bot] marked this conversation as resolved.

test-with-coverage:
runs-on: ubuntu-24.04
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ jobs:
- name: Clippy lance-graph (advisory)
continue-on-error: true
run: cargo clippy --manifest-path crates/lance-graph/Cargo.toml --lib --tests -- -D warnings
# Tier A (mandatory, gating): deepnsm is now clippy-clean — TD-DEEPNSM-CLIPPY-195
# resolved 2026-06-09 by a hand-reviewed sweep. It's a standalone 0-dep codec
# crate, workspace-excluded, so the lance-graph clippy steps don't cover it;
# gate it explicitly (same posture as the contract crate) so it can't regress.
- name: Clippy deepnsm (mandatory)
run: cargo clippy --manifest-path crates/deepnsm/Cargo.toml --all-targets -- -D warnings
Comment thread
coderabbitai[bot] marked this conversation as resolved.

format:
runs-on: ubuntu-24.04
Expand All @@ -94,8 +100,13 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Check formatting
- name: Check formatting (lance-graph)
run: cargo fmt --manifest-path crates/lance-graph/Cargo.toml -- --check
# deepnsm is a standalone, workspace-excluded codec crate, so
# `cargo fmt --all` never reaches it. It was brought to a rustfmt-clean
# baseline in this PR; check it explicitly so it can't silently drift.
- name: Check formatting (deepnsm)
run: cargo fmt --manifest-path crates/deepnsm/Cargo.toml -- --check

# typos / spell-check removed 2026-04-26: too many false positives on
# technical jargon (NARS terms, codec acronyms, German loanwords used in
Expand Down
12 changes: 6 additions & 6 deletions crates/deepnsm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ version = "0.1.0"
edition = "2021"
license = "Apache-2.0"
publish = false

# Empty `[workspace]` so cargo treats this crate as standalone when invoked
# via `--manifest-path` (deepnsm is `exclude`d from the parent workspace,
# but in nested git-worktree directories cargo's auto-discovery would
# otherwise walk further up and pick up the outer workspace root).
[workspace]
description = """
DeepNSM: Distributional semantic transformer replacement.
4,096 words × 12 bits × 8MB distance matrix = complete semantic engine.
O(1) per word, O(n) per sentence, deterministic, bit-reproducible.
No GPU. No learned weights. Same decision boundaries as cosine.
"""

# Empty `[workspace]` so cargo treats this crate as standalone when invoked
# via `--manifest-path` (deepnsm is `exclude`d from the parent workspace,
# but in nested git-worktree directories cargo's auto-discovery would
# otherwise walk further up and pick up the outer workspace root).
[workspace]

# Zero EXTERNAL (crates.io) dependencies — for supply-chain cleanness.
# AdaWorldAPI path deps are mandatory and compile into the same binary.
# ndarray is the canonical SIMD/BLAS/CLAM provider: ndarray::simd is a
Expand Down
71 changes: 50 additions & 21 deletions crates/deepnsm/examples/probe_semantic_sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//! - off-diag cosine mean 0.64
//! - effective rank (participation ratio) 1.82 out of 256
//! - 43.76% of pairs with cos > 0.9
//! → degenerate null-context artifact, not a real semantic manifold
//! → degenerate null-context artifact, not a real semantic manifold
//!
//! The DeepNSM matrix is a completely different source: 96-dimensional
//! distributional vectors from COCA subgenre frequencies (1-billion-word
Expand Down Expand Up @@ -49,8 +49,8 @@
use std::fs;
use std::path::PathBuf;

use deepnsm::DeepNsmEngine;
use deepnsm::spo::WordDistanceMatrix;
use deepnsm::DeepNsmEngine;

fn main() {
println!("# Probe: DeepNSM Semantic Layer Sanity");
Expand Down Expand Up @@ -86,7 +86,11 @@ fn main() {
let nonzero_diagonals: Vec<(usize, u8)> = (0..k)
.filter_map(|i| {
let d = dm.get(i as u16, i as u16);
if d != 0 { Some((i, d)) } else { None }
if d != 0 {
Some((i, d))
} else {
None
}
})
.take(5)
.collect();
Expand All @@ -113,10 +117,14 @@ fn main() {
// Convert to f64 for stats
let n = off.len() as f64;
let mean: f64 = off.iter().map(|&v| v as f64).sum::<f64>() / n;
let var: f64 = off.iter().map(|&v| {
let diff = v as f64 - mean;
diff * diff
}).sum::<f64>() / n;
let var: f64 = off
.iter()
.map(|&v| {
let diff = v as f64 - mean;
diff * diff
})
.sum::<f64>()
/ n;
let std_dev = var.sqrt();

// Percentiles via sort
Expand Down Expand Up @@ -165,12 +173,20 @@ fn main() {
// has no per-row distinguishing structure → degenerate.
let row_sum_f64: Vec<f64> = row_sum.iter().map(|&s| s as f64).collect();
let mean_rs = row_sum_f64.iter().sum::<f64>() / k as f64;
let var_rs = row_sum_f64.iter().map(|&s| {
let diff = s - mean_rs;
diff * diff
}).sum::<f64>() / k as f64;
let var_rs = row_sum_f64
.iter()
.map(|&s| {
let diff = s - mean_rs;
diff * diff
})
.sum::<f64>()
/ k as f64;
let std_rs = var_rs.sqrt();
let cv = if mean_rs.abs() > 1e-9 { std_rs / mean_rs } else { 0.0 };
let cv = if mean_rs.abs() > 1e-9 {
std_rs / mean_rs
} else {
0.0
};
println!("## Row-sum constancy (matrix isotropy proxy)");
println!("- mean row sum: {:.2}", mean_rs);
println!("- std row sum: {:.2}", std_rs);
Expand All @@ -186,17 +202,25 @@ fn main() {
for i in 0..k {
let mut best = u32::MAX;
for j in 0..k {
if i == j { continue; }
if i == j {
continue;
}
let d = dm.get(i as u16, j as u16) as u32;
if d < best { best = d; }
if d < best {
best = d;
}
}
nn_dist.push(best);
}
let nn_mean: f64 = nn_dist.iter().map(|&v| v as f64).sum::<f64>() / k as f64;
let nn_var: f64 = nn_dist.iter().map(|&v| {
let diff = v as f64 - nn_mean;
diff * diff
}).sum::<f64>() / k as f64;
let nn_var: f64 = nn_dist
.iter()
.map(|&v| {
let diff = v as f64 - nn_mean;
diff * diff
})
.sum::<f64>()
/ k as f64;
let nn_std = nn_var.sqrt();
println!("## Nearest-neighbor distance (excluding self)");
println!("- mean: {:.2}", nn_mean);
Expand Down Expand Up @@ -232,8 +256,10 @@ fn main() {
println!("| matrix size | 256×256 | {}×{} |", k, k);
println!("| off-diag mean | 0.640 (cos) | {:.2} (u8 dist) |", mean);
println!("| effective rank | 1.82 | see Python follow-up |");
println!("| frac > 0.9 (cos) / high u8 | 43.76% | {:.2}% (top 10 bins) |",
top10 as f64 / n * 100.0);
println!(
"| frac > 0.9 (cos) / high u8 | 43.76% | {:.2}% (top 10 bins) |",
top10 as f64 / n * 100.0
);
println!("| nearest-neighbor similarity | 0.9407 (cos) | see std above |");
println!();

Expand All @@ -242,7 +268,10 @@ fn main() {
println!();
println!("```python");
println!("import numpy as np");
println!("d = np.fromfile('{}', dtype=np.uint8).reshape(4096, 4096).astype(np.float64)", dump_path);
println!(
"d = np.fromfile('{}', dtype=np.uint8).reshape(4096, 4096).astype(np.float64)",
dump_path
);
println!("# Convert distance to similarity: normalize [0,255] → [0,1], invert");
println!("max_d = d.max()");
println!("sim = 1.0 - d / max(max_d, 1)");
Expand Down
5 changes: 4 additions & 1 deletion crates/deepnsm/src/arcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ mod tests {
let ranks = [12_u16, 670, 2942];
let (basin, literal) = t.split_arcs(&ranks);
assert_eq!(basin.0, t.fingerprint, "basin arc IS the spine bundle");
assert_eq!(literal.0, ranks, "literal arc carries the COCA ranks verbatim");
assert_eq!(
literal.0, ranks,
"literal arc carries the COCA ranks verbatim"
);
}

#[test]
Expand Down
5 changes: 4 additions & 1 deletion crates/deepnsm/src/arcuate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ mod tests {
}
let result = arc.disambiguate([fp(1.0), fp(-1.0)]);
assert_eq!(result.candidate_count, 2, "both candidates evaluated");
assert!(result.winner_index < 2, "a real winner over the ±5 evidence");
assert!(
result.winner_index < 2,
"a real winner over the ±5 evidence"
);
}
}
Loading
Loading