l2d reads text logs on your own machine and tells you which ones to look at
first. Each log gets a score between 0 and 1 for how likely it is bad, learned
from logs you have already labelled. Logs that look good are scored down so
your time goes to the rest.
It is built for a security analyst with a laptop and too many logs. Nothing is sent anywhere, and the tool is designed to stay out of the way of whatever else the machine is doing.
As of 18 November 2026, the CLI can read archives, discover patterns, mark and score logs, encode original records on the NPU, and use reviewed neighbours to explain a triage queue. The assessment library now compares vector sets. What works today · Current vectorization assessment
For a file of logs, l2d triage returns three lists:
| List | Meaning |
|---|---|
| Review | Logs ranked from most to least likely bad, up to the number you say you have time for |
| Scored down | Logs the tool considers good, with the error rate that claim carries |
| Uncertain | Logs it will not call either way, or that look unlike anything it was calibrated on |
Each decision shows what it rests on: which scorer produced it and, once the encoder exists, the nearest labelled logs.
The analyst decides what to review. The tool preserves source logs and processes evidence locally. Before loading a file it checks free memory, sizes its batches and reports when a job exceeds the available budget.
The first scorer is deliberately simple. It counts short character sequences in
each log (think ' OR, %27, ../) and learns which ones show up in bad logs.
That is the technique behind classic spam filters, and on web attack data it
beat every general text-embedding model we tried, by a wide margin. The
numbers are in the benchmark.
On top of the score sits a calibration step (conformal prediction). It turns "0.8" into a statement you can act on: at a 5 % error rate, this log is good, bad, or too close to call. Without it you have a ranking; with it you have a bounded risk when you skip a log.
The laptop's NPU turns each supported original into a 128-component vector. An analyst can use a known example to retrieve similar records and inspect where their outcomes agree or differ. The fitted text score supplies the ranking. Retrieval and held-endpoint evidence
| Part | State |
|---|---|
| Reading logs: one per line, labelled CSV or JSONL, HTTP CSIC 2010 | Done, tested |
| Deduplication, with skipped rows reported by position and reason | Done, tested |
| Batches sized to free memory, with a memory limit that holds | Done, measured on files up to 564 MB |
| Admission and resource reporting for expensive operations | Done (1.24): --busy wait (default) or --busy refuse names the holder; cooperating tool processes share host/NPU locks. Final records include the limit, counted peak, waiting and spilling. Native NPU runtime memory is not included in counted Rust reservations; outside-tool NPU utilization is unknown |
| Zip archives as input: entries read without unpacking, in batches, within the memory limit | l2d ingest reads an archive and reports every entry and its records; l2d baseline score scores one into Parquet parts on disk, one row per distinct log; both deduplicate on disk when the distinct texts outgrow the memory limit, in --work-dir (by default a directory of the run below work/ in the project), after a check of the free disk space; ingest touches the disk only then and leaves nothing behind; MarkSet workflows also accept selected archive entries, with whole-history admission for grouping and policy. Measured on a 7.1 GB archive of the AIT data set under a limit of 512 MB: ingest reads its 272 *.log entries (22.9 million lines, 5.6 million distinct) in 40 s with a peak of 349 MiB, in memory, and all of its entries (30.9 million lines, 8.3 million distinct) in 58 s with a peak of 374 MiB, deduplicating on disk (task 1.20); baseline score scores all of its entries (30.9 million lines, 8.3 million distinct) in about 8 minutes with a peak of 359 MiB, deduplicating on disk, and writes 273 MiB of parts. ingest reads two entries at once by default when their readers fit (--entries-at-once, 1 to 8), with the same results as one at a time: on that archive 28 s for the *.log entries against 33 to 34 s, and 50 to 71 s for all of them against 74 to 81 s, peaks under 400 MiB; baseline score reads one entry at a time by default, because reading entries at once did not make it faster (task 1.19) |
| Character-sequence features and the scoring model | Done, tested |
| Baseline scorer (fit, score, save, load) | Done, tested |
| Calibrated decisions (label sets at a chosen error rate) | Use l2d calibrate and pass the saved calibration to triage. The error rate holds on endpoints the calibration logs cover (about 5 % measured on CSIC); on endpoints it has never seen, 32 % to 79 % of good logs were wrongly ruled out and none were called good |
| Store: one SQLite file per store with a text index and the vectors | Use l2d store add with the pinned NPU profile. In the earlier storage benchmark, CSIC's 25,608 distinct logs were added in about 3.5 s into a 46 MiB file. A single log text may be at most 1 MiB. Logs are encoded on the NPU and stored in one step, all or nothing: a failure part-way leaves the store as it was. The store records the encoder and the AMD runtime release and refuses vectors of another, and keeps per log whether its text was cut or empty; tested on the NPU with the fixture (every stored vector bit-identical to the session's) |
| Search in a store: by phrase (with or without case), by label and source, and by nearest vectors | Library done and tested, not yet wired to a command. On CSIC's 25,608 logs a nearest-vector search takes about 36 ms and the first 100 phrase matches about 1.5 ms. A search that does not fit the memory limit is refused |
| Unlabelled selections and reviewed exports | Library and l2d discover CLI done (1.26/1.28). Literal, whole-record glob and regex searches preserve exact members, source identity and completeness; store-only FTS5 trigram search is a separate insensitive mode. Explicit source-bound review exports format-3 MarkSets, keeping unresolved/conflicting members excluded from training. Selection limits and unbounded FTS prefix expansion refuse explicitly |
| Pattern catalogue | Library and discovery/refinement CLI done (1.27/1.28). Bounded Drain-style grouping preserves exact disk membership, examples, distinct/occurrence counts and explicit overflow. Frozen engineering comparison and limitations: qualification report |
| Mark sets: the analyst marks logs by phrase, regular expression or positions, on a file, a zip archive or a store, and labels them bad or good | Library and file/archive CLI done (1.21, 1.25): l2d mark --input <path> --phrase <text> or --regex <pattern> prints matching text and first positions; --name <name> saves marks/<name>.json, with --label bad by default or --label good. Supports text and --json, archive entry filters and bounded parallel readers. Saved sets retain source identity and work with redaction/fitting; changed inputs are refused. For a store, give --store NAME and a phrase or regex to preview stable IDs and original texts. For a file or archive, repeated --position options select first positions |
| Redaction: the tool proposes fragments that recur in the marked logs and also in the unmarked ones (hosts, URL paths, fixed parameters), each with its counts; confirmed rules replace them by a placeholder before scoring | Use l2d redact to preview counts and save explicitly confirmed rules. On CSIC, for the logs marked by a "drop table" pattern (168 of 25,608), the host and all five endpoint paths are proposed with their counts and no attack payload is; the rules apply the same at fitting and at scoring, and the existing option that strips the URL path is one such rule |
| A score fitted from a mark set, with a report on groups it never saw | Use l2d score fit to fit and save the score and optionally publish its score/redaction evidence. The simple scorer is fitted on the redacted marked logs against a mark set of the other label or the unmarked logs of the same input (stated), and refused when too few logs are marked; it is saved with its mark sets and rules, and applies the rules first when scoring. The report sets its quality on groups held out of fitting (CSIC: URL path; AIT: host; or a pattern) beside that on fitted groups and warns when the gap is over 0.05 ROC AUC. On CSIC it gives ratios and survives save and load; whether redaction makes a score agnostic is measured by gate 2.18 |
| Triage: ranking, review budget, and with a calibration the split into review, scored down, uncertain and unlike | Use l2d triage for baseline ranking, supported MarkSet scoring or a versioned policy with retained evidence and review allocations. Baseline triage of CSIC's 25,608 logs takes under a second |
| Evaluation | The simple scorer's evaluation is built and run as library code: on CSIC, with whole endpoints held out, it ranks attacks at ROC AUC 0.914 (bar 0.90). It is weaker on two endpoints that share one form (0.82, and 0.76 when both are unseen). The eval command and the encoder's side are not built |
Commands ingest, baseline fit, baseline score, calibrate, triage |
Work from the command line, with text and --json output. On CSIC: fit in about 2 s, triage of 8,644 logs in under half a second, each within the memory limit it reports |
| NPU and analyst commands | runtime check, encoder info, encoder encode, store add, outliers, group, redact, score fit and MarkSet/policy triage support human and JSON output. store search, encoder train, shift, assess and eval are deferred. |
| Encoder on the NPU | A trained 8-bit model runs on the AMD NPU from Rust, measured as library and test code: from log text to vector at 16,000 to 42,000 logs per second with one session over the recorded runs (the laptop's power management moves the figure from run to run) and 35,000 to 40,000 with four, ready in 3 to 5 s the first time and about 1 s after. In the usual batch layout the NPU gets every text but the first of a batch wrong; the tool lays the texts out as rows of one image, and then each vector is bit-identical to the text encoded alone. The vectors that come off the NPU give the triage quality measured in training (0.958 against 0.959). The runtime files are checked against a manifest before anything is loaded. The encoder session is built: it runs on the NPU only and refuses, with the reason, unless both the provider's placement report and the first run show the model on the NPU; there is no CPU fallback. Each vector comes with two flags that say whether the text was cut. These throughput figures describe the historical single-graph session. The analyst CLI uses the pinned two-graph f0-s0-mask profile and stores its original-record vectors. The encoder is kept as the source of vectors for search, grouping and near-duplicate views; the simple scorer classifies logs (owner decision of 2026-11-15 after gate 2.17: the encoder's vectors do not classify on endpoints they have not seen) |
A measured example: HTTP CSIC 2010 (61,065 requests, 28 MB) is read and deduplicated to 25,608 distinct logs in about a quarter of a second, with a peak of 73 MiB of memory. In small batches the peak drops to about 35 MiB.
The commands below use l2d when the executable is on your PATH. From a source checkout, you can also launch the verified debug build directly. On the Windows reference workstation, run this in PowerShell from the repository root.
& 'D:\BuildArtifacts\log2decision\task-1.26-target\debug\l2d.exe' tui --demo --session hunt.jsonOpen the Rust triage workbench with l2d tui --demo --session hunt.json. Press 1 for high-scoring originals outside the filter, then r to browse their raw log text. Use ↑/↓ to move between originals and Esc to return to your selected result. Press Enter for a record's evidence, c for recommendation coverage, and s to save. For an existing investigation, pass --report policy-report.json in place of --demo. The report comes from l2d triage --policy … --out policy-report.json. Walkthrough, keys and test cases
The demo has 20 occurrences across 12 distinct originals. To try the search bar, press / at the root, type host=edge-01 (login OR challenge) score>=0.9 and press Enter. Three raw log rows represent four matching occurrences on that host. Press 1 from those results to see which high-scoring originals the saved filter missed. You can also open a search directly with l2d tui --demo --query 'host=edge-01 (login OR challenge) score>=0.9'. Searches use Splunk's language and can be piped, for example fail* | sort - score | head 5. Search language reference
You need Windows 11 and Rust 1.98 (the repository pins the toolchain). Linux should work for everything except the NPU, but has not been tested.
cargo build --release
cargo test --workspace
cargo run --release -p l2d-cli -- --help
The help lists every command and the options that apply to all of them:
| Option | Effect |
|---|---|
--project DIR |
The project directory, where models are kept under models/. Default: the current directory |
--json |
Machine-readable output |
--memory-limit 2GB |
Cap the memory the tool may use. Default: half of what is free |
--memory-share 0.5, --reserve-share 0.25 |
The same as shares of the free memory: how much to use, and how much to keep free |
--batch-rows 10000 |
Cap the batch size. Default: 65,536 rows, fewer when memory is short |
A first run on a labelled file, here a CSV with the columns text, label
and group, cut into three parts so that nothing is judged on logs the scorer
has already seen:
l2d ingest --input all.csv --group-column group
l2d baseline fit --input fit.csv --group-column group --name demo
l2d calibrate --input cal.csv --group-column group --baseline demo --name demo-cal
l2d triage --input new.csv --group-column group --baseline demo --calibration demo-cal --budget 50
triage prints the logs to review, the logs it scored down and the logs it
will not call either way. calibrate leaves out any log whose text the scorer
was fitted on and says how many. For the CSIC dataset, download it as
described in data/README.md and use --adapter csic2010;
l2d ingest --help lists the adapters and their options. l2d is the binary
that cargo build --release puts in the build folder; cargo run --release -p l2d-cli -- in front of the arguments does the same.
Exit codes: 0 success, 2 a mistake in the options, 3 something missing (the message says where it was expected), 4 a refusal such as too little memory, 5 an input or output failure.
Every document in docs/ is listed here, newest first. File names start with
the date. These are records of what was known on that day; where later work
overturned something, the document says so at the top.
| Date | Document | What it settles |
|---|---|---|
| 2026-11-23 | Score order with reserved slots for unsupported records: not shown to help, on a panel that could show little | On a second fresh panel of 1,000 held CSIC records, reserving slots for unsupported records selected the same records as score alone in 7 of 10 planned cells and gained three positives and lost one in the rest (p = 0.63). Only three positives were within its reach, so the test could not have shown a gain. A control that fills the reservation from the rarest endpoints, without an encoder, was not distinguishable from it. Unsupported records and off-endpoint records are nearly the same set, so the vector evidence is neither shown to carry the signal nor shown to carry none. The policy again found fewer positives than score alone |
| 2026-11-23 | Low positive share, five review budgets: the Venn policy does not beat score alone | On 1,000 fresh held CSIC records with 100 positives, score alone found 12, 25, 42, 56 and 67 positives at 12 to 200 reviews, the policy 10, 20, 31, 49 and 51; only the difference at 200 passes its own uncorrected test. The policy sent 53 positives to low priority. Unsupported records were 22 of 27 positive, but on this panel that nearly coincides with being off the one dominant endpoint, so the vector evidence is not shown to carry it |
| 2026-11-18 | Triage concept: the model proposes, set algebra decides, the analyst judges | Concept for owner review. Orders the pipeline into five stages, separates the three meanings of Venn, and states what Venn changes as measured: the policy does not rank better than the score on a panel the score saturated, but its unsupported queue was 17 of 17 positive and all deferred. Proposes an exhaustive 96-case policy test and a decision on the shared reservation; agents, remote sources and the host memory ledger are parked with their preconditions |
| 2026-11-18 | The triager's search language: Splunk SPL over retained originals | Terms follow Splunk's segmentation (fail* finds failed, fail does not). Supports TERM, CASE, IN, automatic key=value fields, earliest/latest, and pipes to where, regex, rex, fields, head, tail, sort and dedup. Table-building commands are refused, and every difference from Splunk is listed |
| 2026-11-18 | Archive-scale triage performance and the SSH terminal stack | Measured archive and NPU costs, proposed warm drill-down targets, and the choice of Taffy, Ratatui and Crossterm. |
| 2026-11-18 | Vectorization assessment for security triage | What the current NPU vector captures, when neighbours help a hunt, and how to compare representations with the new assessment library. |
| 2026-11-18 | Three review workflows on held CSIC endpoints | At 12 reviews on one development panel, score alone found 12 benchmark positives, Venn found 11 and automatic patterns found 8 via the fallback. All 17 unsupported records were deferred positives. |
| 2026-11-17 | Outlier distance and neighbourhood size | Bounded squared-L2 ranking and per-label evidence; larger k did not improve a frozen CSIC endpoint-presence proxy. Three groups per class and encoder-training overlap limit the result to development evidence; default k=5 remains unchanged |
| 2026-11-17 | Exploratory redaction transfer comparison | Confirmed host/path redactions do not establish agnostic MarkSet scoring: five-fold mean held AUC 0.6163 raw and 0.6158 redacted, with two redacted folds exceeding the 0.05 diagnostic gap. Frozen fold-specific NPU vectors give an uncertain diagnostic-head change, not a production classifier. All arms exhaust the same 100-record review budget at precision one; recall is budget-limited to about 3.14%. Qualification remains incomplete; no final holdout was examined |
| 2026-11-15 | Entropy-patch encoder stability gate: are the vectors stable, and do they classify on endpoints they have not seen? | Stable and reproducible, but they do not classify on unseen endpoints; the baseline scorer is ahead on every fold. Randomness ruled out (bit for bit in and across processes, in float, 8 bits and on the NPU; same-seed training gives identical weights). Stability passes with the 8-bit byte graph's cut as the one cut (identical float to 8 bits by definition; 8 bits to NPU 25,680 of 25,680 lines, cosine at least 0.99992) and a line graph of stride 1 with the mean after it. 5 folds by endpoint x 3 seeds: linear head 0.786 seen, 0.722 ± 0.070 unseen; baseline 0.961 and 0.923 ± 0.097 (n = 5). The shortfall is little linearly usable label signal: the masked-byte vectors fall back to 3 to 4 components for 95 % of the variance and hold mostly the endpoint. Centring on the endpoint's mean (review) does not close the gap. Owner decision: the baseline scorer classifies, the encoder serves search and grouping. NPU 2,037 to 2,166 logs per second; every step under a 6 GiB limit, peak at most 3.94 GiB |
| 2026-11-14 | Hierarchical encoder gate: do patches and a content objective give vectors that keep the line? | No variant passes. Encoders trained without the label on bytes, patches and one vector per line spread over 17 to 31 principal components (published encoder: 2), keep unrelated lines near cosine 0 and edits near 1, and tell all 25,608 CSIC lines apart in float. The two-graph layout runs on the NPU only, every row right, at 1,200 to 1,500 logs per second with entropy patches and about 3,000 with fixed stride. But entropy patches do not beat fixed stride and delimiter patches, and the vectors rank attacks on held-out endpoints at 0.58 to 0.76 where the published encoder's head reaches 0.94 and the baseline scorer 0.99. Two of the research log's six "we are wrong if" conditions hold; the owner decides |
| 2026-11-14 | Research log: why the encoder's vectors are one line, and what replaces it | The day's findings and decisions in one place: the vectors are a good/bad score because the encoder was trained on the label alone; the owner's direction for its replacement (convolutional, hierarchical, entropy-based patches, no cutting, one vector per line); the objections, and what would prove the direction wrong. The scorers on vectors wait for the gate of task 2.16 |
| 2026-11-14 | Embedding qualification: what is in the vectors the NPU encoder gives? | Not noise and not the one-point collapse of the spike model, but close to one-dimensional: the first principal component holds 88 % of the variance, two hold 95 %, and the vectors are a good/bad score on one curve. Small edits stay near (cosine 0.995 or more), attacks move away from benign requests, endpoints group although the path is not read. On three endpoints the encoder was not fitted on, the linear head ranks at ROC AUC 0.939 (the first component alone 0.936), while every good text has a bad majority among its 11 nearest stored texts (0.79, and 0.55 with repeated inputs). Suitable with limits for the head, not shown suitable for neighbours across endpoints, outlier ranking not checked |
| 2026-11-13 | Baseline gate: does the simple scorer rank attacks on endpoints it has not seen? | The simple scorer passes its gate on five folds by URL path (cross-endpoint ROC AUC 0.914 with all held-out logs as one ranking, 0.919 as the mean over the folds; bar 0.90), but only three of five endpoints are strong: the two that share one form score 0.82, and 0.76 when both are unseen. The Rust tool confirms the science gate's baseline figures. Two honest rules for choosing the L2 penalty disagree; the default stays and the comparison is repeated on a second dataset |
| 2026-11-13 | The trained encoder on the NPU: are all rows right, how fast is it, how good are the vectors | In the exported batch layout only the first text of a batch is computed right on the NPU; with the texts as rows of one image every row is bit-identical to the text alone. End to end 16,600 logs per second with one session (37,600 with four), ready in 4.9 s cold and 1.0 s warm. The NPU's vectors give the quality the science gate recorded: linear head 0.958, neighbour ratio 0.899 |
| 2026-11-12 | Science gate: does a trained byte-level encoder earn its place on the NPU? | A linear head on the 8-bit vectors reaches cross-endpoint ROC AUC 0.959 on five grouped folds and clears the 0.90 bar; the neighbour ratio (0.893) and the design's training objective do not. The review found the lead over the simple scorer does not hold: about level at best, behind on endpoints of a form it has not seen |
| 2026-11-11 | Embedding speed and separability on CSIC 2010 | General embeddings are too slow on the NPU and worse than character features; a small encoder of our own runs fast there |
| 2026-11-11 | Embedding model choice | Which embedding models were considered and why the default was dropped |
| 2026-11-11 | Feasibility: triaging text logs with NPU embeddings and small decision heads | The starting plan and what became of each part |
| 2026-11-12 | Venn's operations against the log2decision spec | Which Vector Decision Model operations the spec covers, which are missing, and a proposal for after the NPU encoder |
The work follows a written specification: requirements, design and tasks. The task file also holds the notes each finished task left for the next one.
| Path | Content |
|---|---|
crates/ |
The Rust workspace: l2d-core (input, memory), l2d-baseline (features, scorer), l2d-cli, and crates reserved for the store, decisions, assessment, evaluation and encoder |
tests/fixtures/ |
A small labelled fixture used by the tests |
docs/ |
Dated research and decision documents, indexed above |
data/<dataset>/ |
One directory per dataset, registered in data/README.md; the data is not tracked |
models/ |
Fitted scorers and model weights; not tracked |
.kiro/specs/ |
Specification |
log2ml/ |
Local reference copy of the thesis repository this project grew out of; not tracked |
Rules of the house:
- Rust only. Python is not part of the tool;
uvmay run one-off analysis scripts during development. - Polars is the one data layer. Tabular data moves between crates as Polars frames.
- No crate that can open a network connection. A test fails if one appears in the lock file.
- New documents go to
docs/with a date prefix and get a row in the table above. Datasets go todata/<dataset>/and get a row indata/README.md. - On the development host, agents use PowerShell: no Git Bash, no
wsl.
Discovery workflow: command guide and artifact contracts.
Vector exploration: NPU and character-trigram command guide, measured usefulness and limits.
MarkSet support: grouping, close-enough evidence and calibration contracts.
Run the encoder, MarkSet score and triage policy from the command line.
