Text Generation
PEFT
Safetensors
Chinese
stablelex
lora
qwen
stablecoin
virtual-assets
legal-analysis
compliance
Instructions to use Karitasu/StableLex with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Karitasu/StableLex with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-9B") model = PeftModel.from_pretrained(base_model, "Karitasu/StableLex") - Notebooks
- Google Colab
- Kaggle
| license: apache-2.0 | |
| base_model: Qwen/Qwen3.5-9B | |
| library_name: peft | |
| pipeline_tag: text-generation | |
| language: | |
| - zh | |
| tags: | |
| - stablelex | |
| - peft | |
| - lora | |
| - qwen | |
| - stablecoin | |
| - virtual-assets | |
| - legal-analysis | |
| - compliance | |
| # StableLex | |
| StableLex is a PEFT/LoRA adapter based on `Qwen/Qwen3.5-9B`. It is not a standalone language model: it must be loaded together with the base model. | |
| The adapter is intended for controlled stablecoin and virtual-asset legal/compliance analysis workflows where responses are expected to stay grounded in supplied materials, use explicit citations, distinguish source-backed conclusions from cautious inference, and refuse or qualify answers when the provided materials are insufficient. | |
| ## Repository Contents | |
| - `adapter_model.safetensors`: LoRA adapter weights. | |
| - `adapter_config.json`: PEFT adapter configuration. | |
| - `formal_eval_report.md`: copied formal evaluation report for this adapter release. | |
| - `README.md`: this model card. | |
| - `LICENSE`: Apache License 2.0 for this adapter repository. | |
| ## Model Details | |
| | Item | Value | | |
| |---|---| | |
| | Model name | StableLex | | |
| | Repository | `Karitasu/StableLex` | | |
| | Hub URL | `https://huggingface.co/Karitasu/StableLex` | | |
| | Base model | `Qwen/Qwen3.5-9B` | | |
| | Adapter type | LoRA via PEFT | | |
| | Task type | `CAUSAL_LM` | | |
| | PEFT version | `0.19.1` | | |
| | LoRA rank | `16` | | |
| | LoRA alpha | `32` | | |
| | LoRA dropout | `0.05` | | |
| | Target modules | `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj` | | |
| | License | Apache License 2.0 for this adapter repository | | |
| ## Intended Use | |
| This adapter is designed for domain-specific answer generation in stablecoin, virtual-asset, and compliance-oriented research settings. Suitable uses include: | |
| - material-grounded analysis of stablecoin and virtual-asset regulatory documents; | |
| - comparison of legal, academic, policy, judicial, and industry materials; | |
| - drafting structured compliance or risk-analysis responses based on supplied source passages; | |
| - identifying when the supplied materials are insufficient to support a legal, regulatory, or factual conclusion; | |
| - citation-sensitive workflows where each substantive claim should be traceable to provided source chunks. | |
| The adapter is best used in a retrieval-augmented or otherwise source-controlled environment. It should receive the relevant source text, source identifiers, and explicit instructions about citation format, material boundaries, and refusal behavior. | |
| ## Out-of-Scope Use | |
| This adapter is not a substitute for qualified legal, financial, compliance, or professional advice. It should not be used as an autonomous decision-maker for high-stakes matters, licensing analysis, enforcement risk assessment, investment decisions, or client-facing legal opinions without human review. | |
| The released evaluation supports the adapter's behavior under the tested prompt, citation, and material-boundary setup only. Performance outside that setup has not been established. | |
| ## Formal Evaluation Summary | |
| The released adapter was evaluated on a 300-sample formal evaluation set covering stablecoin and virtual-asset analysis tasks. The evaluation focused on citation discipline, material-boundary control, refusal behavior, and domain-relevant reasoning. | |
| | Metric | Value | | |
| |---|---:| | |
| | Sample count | 300 | | |
| | Pass count | 296 | | |
| | Pass rate | 0.9867 | | |
| | Mean score | 0.8290 | | |
| | Reasoning leak count | 0 | | |
| | Missing citation count | 0 | | |
| | Invalid citation ID count | 0 | | |
| | Empty answer count | 0 | | |
| | Material boundary error count | 0 | | |
| | API key leak count | 0 | | |
| | Format error count | 0 | | |
| | Eval set SHA256 | `1b18137c7c1a363c5f5bed2bbdd5f83d11cbe83a590671d211c134056a86861f` | | |
| Task-level results: | |
| | Task type | Samples | Pass rate | Mean score | | |
| |---|---:|---:|---:| | |
| | `academic_literature_reasoning` | 54 | 0.9815 | 0.8418 | | |
| | `cross_text_comparison` | 39 | 0.9744 | 0.7886 | | |
| | `industry_report_analysis` | 45 | 1.0000 | 0.8439 | | |
| | `insufficient_information_refusal` | 24 | 1.0000 | 0.8878 | | |
| | `judicial_case_rule_extraction` | 39 | 1.0000 | 0.8387 | | |
| | `lawyer_practice_risk_analysis` | 54 | 0.9815 | 0.8096 | | |
| | `legal_regulation_interpretation` | 45 | 0.9778 | 0.8171 | | |
| See [`formal_eval_report.md`](formal_eval_report.md) for the full copied evaluation report, including run guardrails, failure samples, and error analysis. | |
| ## Loading Example | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| from peft import PeftModel | |
| base_model_id = "Qwen/Qwen3.5-9B" | |
| adapter_id = "Karitasu/StableLex" | |
| tokenizer = AutoTokenizer.from_pretrained( | |
| base_model_id, | |
| trust_remote_code=True, | |
| ) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| base_model_id, | |
| torch_dtype="auto", | |
| device_map="auto", | |
| trust_remote_code=True, | |
| ) | |
| model = PeftModel.from_pretrained(model, adapter_id) | |
| model.eval() | |
| ``` | |
| ## Prompting And Operational Guidance | |
| For best results, use the adapter with prompts that make the evidence boundary explicit. A typical production prompt should: | |
| - provide the exact source passages or retrieved chunks to be used; | |
| - include stable source identifiers for citation; | |
| - instruct the model to cite every material factual, legal, or policy claim; | |
| - require separation between explicit source statements, legal rules, author opinions, and cautious inference; | |
| - require the model to state when the provided materials are insufficient; | |
| - prohibit unsupported references to statutes, cases, institutions, or market facts not present in the supplied context. | |
| The formal evaluation suggests that this adapter is strongest when the expected output format and citation discipline are specified clearly. | |
| ## Known Limitations | |
| - The adapter was evaluated on a controlled 300-sample set; the results should not be read as a guarantee of performance on all stablecoin, virtual-asset, or legal-compliance tasks. | |
| - The adapter can still miss parts of an analytical rubric, under-cover domain-specific criteria, or make overly broad legal/compliance inferences when the prompt does not strictly constrain the evidence boundary. | |
| - It inherits limitations from the base model and from the surrounding retrieval, prompting, decoding, and post-processing pipeline. | |
| - Outputs may be incomplete, jurisdictionally overbroad, outdated, or unsuitable for professional use unless reviewed by qualified humans. | |
| ## License | |
| This adapter repository is released under the Apache License 2.0. See [`LICENSE`](LICENSE). | |
| The base model `Qwen/Qwen3.5-9B` is not redistributed in this repository and remains subject to its own license and terms. Any third-party documents, evaluation materials, or source texts used with this adapter remain subject to their respective rights and restrictions. | |