Commit f6d92b0
committed
feat: Add RLM embedder, tokenizer, eval gates, trace writer, and security hardening
New modules (4 files, 2,359 lines):
- rlm_embedder.rs (743L): RLM-style recursive sentence transformer with
3 variants (query-conditioned, corpus-conditioned, contradiction-aware
twin), merge rule, BaseEmbedder/NeighborRetriever traits, 14 tests
- tokenizer.rs (418L): BPE tokenizer with GGUF vocab loading, encode/decode,
special token handling, 10 tests
- trace.rs (554L): JSONL trace writer for routing, citation, refusal
decisions, jaccard similarity, manual JSON serialization, 10 tests
- eval.rs (644L): Three behavioral gates (routing correctness >= 0.85,
citation precision >= 0.90, refusal F1 >= 0.85), EvalSuite, 12 tests
Documentation:
- AD-24: RLM-Style Recursive Sentence Transformer Embedder — 3 variants,
merge rule, training strategy, evaluation criteria, appliance fit
- DDD v2.6: 8 new ubiquitous language terms, 4 new open questions (#31-34)
- 3 new positive consequences (#31-33) for RLM embeddings
Security hardening (across 6 existing files):
- Path traversal validation in GGUF export
- Division-by-zero epsilon guards in quantizer
- Bounds validation on public function inputs
- NaN-safe softmax with -inf handling
138 tests pass, 0 compilation errors.
Total bitnet module: 9,632 lines across 16 files.
https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK1 parent 14ed07e commit f6d92b0
13 files changed
Lines changed: 2614 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
541 | 548 | | |
542 | 549 | | |
543 | 550 | | |
| |||
573 | 580 | | |
574 | 581 | | |
575 | 582 | | |
576 | | - | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
577 | 589 | | |
578 | 590 | | |
579 | 591 | | |
| |||
926 | 938 | | |
927 | 939 | | |
928 | 940 | | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
929 | 944 | | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
930 | 949 | | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
931 | 961 | | |
932 | 962 | | |
933 | 963 | | |
934 | 964 | | |
935 | 965 | | |
936 | | - | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
937 | 969 | | |
938 | | - | |
| 970 | + | |
939 | 971 | | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
940 | 976 | | |
941 | 977 | | |
942 | 978 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
119 | 124 | | |
120 | 125 | | |
121 | 126 | | |
| |||
0 commit comments