# Subspace Validity Suite (SVS) **A diagnostic toolkit for validating claimed "visual directions" in Vision-Language Models.** > Do your visual subspace directions actually capture visual content, > or are they just network geometry? SVS provides 6 tests that any claimed visual direction must pass before being attributed mechanistic significance. ## Quick Start ```python from svs_toolkit import SubspaceValiditySuite svs = SubspaceValiditySuite() # Run all tests report = svs.full_report( directions=your_visual_directions, # (k, d) numpy array h_visual=visual_hidden_states, # list of (d,) arrays h_gibberish=gibberish_hidden_states, # list of (d,) arrays h_factual=factual_hidden_states, # optional h_math=math_hidden_states, # optional ) svs.print_report(report) ``` ## The 6 Tests | # | Test | What it checks | PASS condition | |---|------|---------------|----------------| | 1 | Gibberish Specificity | Do directions respond more to visual than gibberish? | Gib/Vis < 0.8, TOST rejects equivalence | | 2 | Cross-Type Discrimination | Can projection magnitude tell visual from non-visual? | AUROC > 0.65 | | 3 | Projection Magnitude | Do directions capture more variance than random? | Ratio > 1.5x | | 4 | Anisotropy Orthogonality | Are directions different from general PCA? | Mean cosine < 0.3 | | 5 | Direction Consistency | Are directions stable across calibration splits? | Split alignment > 0.8 | | 6 | Pairwise Discrimination | Do projections encode visual content specifically? | Only visual pairs separable | ## Key Finding We tested 11 methods across 3 VLM architectures, 2 text-only backbones, and 2 non-VLM transformer families. **Every method fails the SVS.** PCA-based "visual directions" capture generic network geometry — the dominant modes of the weight matrices — not visual content. Gibberish activates them identically to visual descriptions (Gib/Vis ≈ 1.00, TOST equivalence p < 0.0001, N = 4,000). ## Installation ```bash pip install numpy scipy scikit-learn ``` No additional dependencies required. Single file: `svs_toolkit.py`. ## Generating Test Inputs SVS needs hidden states from a text-only backbone (e.g., Vicuna-7B): ```python from transformers import AutoModelForCausalLM, AutoTokenizer import torch model = AutoModelForCausalLM.from_pretrained("lmsys/vicuna-7b-v1.5", torch_dtype=torch.float16, device_map="auto") tokenizer = AutoTokenizer.from_pretrained("lmsys/vicuna-7b-v1.5") def get_hidden(prompt, layer=16): inp = tokenizer(prompt, return_tensors="pt").to(model.device) with torch.no_grad(): out = model(**inp, output_hidden_states=True) return out.hidden_states[layer][0, -1, :].cpu().float().numpy() # Visual prompts h_visual = [get_hidden(p) for p in [ "A kitchen with a table and chairs.", "A beach with surfers and umbrellas.", # ... 20+ prompts ]] # Gibberish prompts h_gibberish = [get_hidden(p) for p in [ "Xkq plm wvt zzz brrn.", "Qwzyx nkl jjj hhh ttttt.", # ... 20+ prompts ]] ``` ## Citation ```bibtex @inproceedings{svs2027, title={The Subspace Validity Suite: Do Visual Directions in Vision-Language Models Survive Basic Sanity Checks?}, author={Anonymous}, booktitle={WACV}, year={2027} } ``` ## License MIT