AQIT 0.1.0
Loading...
Searching...
No Matches
feature_cli.py
Go to the documentation of this file.
1# Copyright (c) 2025-present Aquin Labs Private Limited. All Rights Reserved.
2"""aquin feature locate | logit | neighbor"""
3
4import sys
5
6
7def _print_help() -> None:
8 print("SAE feature tools.")
9 print("")
10 print("Usage: aquin feature <locate|logit|neighbor> ...")
11 print("")
12 print(" locate Rank features on labeled probes (e.g. honest vs deceptive)")
13 print(" aquin feature locate [--prompts <json|jsonl>] [--layer N]")
14 print("")
15 print(" logit Tokens boosted/suppressed by one feature")
16 print(" aquin feature logit --feature <idx> [--layer N] [--topk N]")
17 print("")
18 print(" neighbor Nearest decoder neighbors of one feature")
19 print(" aquin feature neighbor --feature <idx> [--layer N] [--topk N]")
20 print("")
21 print("Docs: https://aquin.app/docs/inspection-sae/llm")
22
23
24def cmd_feature(args: list[str]) -> None:
25 if not args or args[0] in ("-h", "--help", "help"):
26 _print_help()
27 return
29 sub = args[0]
30 rest = args[1:]
31
32 if sub == "locate":
33 from aquin.find_feature_cli import cmd_find_feature
34
35 cmd_find_feature(rest)
36 return
37
38 if sub in ("logit", "logits"):
39 from aquin.cli import cmd_feature_logits
40
41 cmd_feature_logits(rest)
42 return
43
44 if sub in ("neighbor", "neighbors"):
45 from aquin.cli import cmd_feature_neighbors
46
47 cmd_feature_neighbors(rest)
48 return
49
50 print(f"Unknown feature subcommand: {sub}")
51 print("Run: aquin feature --help")
52 sys.exit(1)