AQIT 0.1.0
Loading...
Searching...
No Matches
check_cli.py
Go to the documentation of this file.
1# Copyright (c) 2025-present Aquin Labs Private Limited. All Rights Reserved.
2"""aquin check — model/checkpoint health checks."""
3
4import sys
5
6# check subcommand -> canonical CLI verb dispatched through cmd_tool
7_CHECK_TOOL_VERBS: dict[str, str] = {
8 "attention": "attention",
9 "layer": "layer-analysis",
10 "perturbation": "perturbation",
11 "weight": "check-weights",
12}
13
14
15def _print_help() -> None:
16 print("Model and checkpoint health checks.")
17 print("")
18 print("Usage: aquin check <subcommand> ...")
19 print("")
20 print(" attention Per-head attention patterns")
21 print(" aquin check attention --prompt <text> [--check]")
22 print("")
23 print(" layer Layer health / activation stability")
24 print(" aquin check layer [--prompts <json>] [--localize] [--check]")
25 print("")
26 print(" perturbation Channel sensitivity via dropout/gaussian")
27 print(" aquin check perturbation --prompt <text> [--check]")
28 print("")
29 print(" weight Trojan/backdoor scan + SVD rank health across tensors")
30 print(" aquin check weight [--collapse_threshold 0.01] [--check]")
31 print("")
32 print(" confidence Per-probe confidence (token logits)")
33 print(" aquin check confidence --prompts <json|jsonl> [--join-sae]")
34 print("")
35 print(" trajectory Multi-checkpoint weight trajectory vs base")
36 print(" aquin check trajectory --checkpoints <glob> | --dir <dir>")
37 print("")
38 print("Docs: https://aquin.app/docs")
39
40
41def cmd_check(args: list[str]) -> None:
42 if not args or args[0] in ("-h", "--help", "help"):
44 return
46 sub = args[0]
47 rest = args[1:]
48
49 if sub == "trajectory":
50 from aquin.trajectory_analysis_cli import cmd_trajectory_analysis
51
52 cmd_trajectory_analysis(rest)
53 return
54
55 if sub == "confidence":
56 from aquin.confidence_analysis_cli import cmd_confidence_analysis
57
58 cmd_confidence_analysis(rest)
59 return
60
61 if sub in _CHECK_TOOL_VERBS:
62 from aquin.cli import cmd_tool
63
64 cmd_tool(_CHECK_TOOL_VERBS[sub], rest)
65 return
66
67 print(f"Unknown check subcommand: {sub}")
68 print("Run: aquin check --help")
69 sys.exit(1)
None _print_help()
Definition check_cli.py:19
None cmd_check(list[str] args)
Definition check_cli.py:45