Instructions to use anicka/nla-qwen3-4b-universal-ar with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use anicka/nla-qwen3-4b-universal-ar with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B") model = PeftModel.from_pretrained(base_model, "anicka/nla-qwen3-4b-universal-ar") - Transformers
How to use anicka/nla-qwen3-4b-universal-ar with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="anicka/nla-qwen3-4b-universal-ar")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("anicka/nla-qwen3-4b-universal-ar", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use anicka/nla-qwen3-4b-universal-ar with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "anicka/nla-qwen3-4b-universal-ar" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "anicka/nla-qwen3-4b-universal-ar", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/anicka/nla-qwen3-4b-universal-ar
- SGLang
How to use anicka/nla-qwen3-4b-universal-ar with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "anicka/nla-qwen3-4b-universal-ar" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "anicka/nla-qwen3-4b-universal-ar", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "anicka/nla-qwen3-4b-universal-ar" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "anicka/nla-qwen3-4b-universal-ar", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use anicka/nla-qwen3-4b-universal-ar with Docker Model Runner:
docker model run hf.co/anicka/nla-qwen3-4b-universal-ar
NLA Activation Reconstructor β Qwen3 4B, universal multi-layer
LoRA adapter that reads a natural-language description of an activation and reconstructs the activation vector β the audit half of the NLA pair. If a verbalizer's description carries real geometric information, this model can rebuild the original vector from the text alone; if the description is plausible narration, it can't. It is also the reward model for the GRPO-refined verbalizer.
Part of the nla-at-home project. Companions: AV (SFT), AV (GRPO).
Architecture: self-layer readout (lora_sl)
No value heads. The reconstruction is the model's own hidden state: the
description is wrapped in a depth-conditioned prompt ending with the
injection character, and the reconstruction for layer L is read at
hidden_states[L+1][:, -1, :] β the output of block L at that trailing
token. One adapter serves all 36 layers.
Prompt (frozen interface, nla_lib.AR_TEMPLATE_DEPTH_SL):
Summary of the following text from depth {depth}%: <text>{explanation}</text> <summary>γ
Left padding, add_special_tokens=False, max length 512. Load with
nla_lib.load_ar_lora_sl(...) / score with LoraSLReward.reconstruct(...)
from the repo β format detection and the readout convention are handled for
you.
Training
LoRA (r16, lr 7e-5, 5-epoch schedule β best checkpoint is epoch 1;
like the AV, it converges in one epoch) on ~158k (description, activation)
pairs (_tokenpred_gpt4o_clean descriptions Γ 36 layers; 528 texts held
out, ids ship as val_text_ids.json). Loss: direction MSE + InfoNCE
contrastive (weight 1.0), mse_scale 59.87.
Evaluation
Validation cosine (held-out texts, raw): 0.942 overall. Per-layer:
| layer band | val cosine |
|---|---|
| L0βL9 (early) | 0.96β0.99 |
| L10βL19 (mid) | 0.95β0.96 |
| L20βL29 (late) | 0.90β0.94 |
| L30βL34 (near-output) | 0.91β0.95 |
| L35 (final) | 0.79 |
Full per-layer table in nla_meta.yaml. Round-trip numbers (verbalizer β
this AR β centered cosine on a clean 284-text holdout) live on the
AV and
AV-GRPO
cards.
Limitations
Reconstruction quality tracks description quality β it cannot conjure
geometry a vague description doesn't carry (that asymmetry is the point).
Raw cosine at these layers is dominated by the shared per-layer mean; always
compare centered cosines (per-layer mean removed) when auditing
descriptions. Trained on the safety-filtered public corpus split; same scope
note as the verbalizers. Qwen3 chat-template use elsewhere in the pipeline
needs enable_thinking=False (the AR prompt itself is raw, no template).
- Downloads last month
- 48