--- license: apache-2.0 base_model: kakaocorp/kanana-safeguard-8b quantized_by: Arc1el quantization_method: bitsandbytes model_type: llama tags: - quantized - 4bit - bitsandbytes - safeguard - korean - safety pipeline_tag: text-generation --- # Kanana Safeguard Siren 8B - 4bit 양자화 버전 ## 모델 개요 - **원본 모델**: [kakaocorp/kanana-safeguard-8b](https://huggingface.co/kakaocorp/kanana-safeguard-8b) - **양자화 방법**: BitsAndBytes 4bit (NF4) - **양자화 도구**: bitsandbytes + transformers - **압축률**: 원본 대비 약 75% 크기 감소 (추정) ## 모델 세부정보 ### 원본 모델 정보 - **모델 아키텍처**: Safeguard model based on transformer architecture - **파라미터 수**: 8B parameters - **주요 용도**: 안전성 검증, 유해 콘텐츠 탐지 - **언어**: 한국어 중심 - **원본 모델 라이선스**: Apache 2.0 ### 양자화 정보 - **양자화 타입**: 4bit NormalFloat (NF4) - **정밀도**: 4bit weights, 16bit activations ## 성능 및 벤치마크 ### 모델 크기 비교 - **원본 모델**: ~16GB (추정) - **양자화 모델**: ~4GB (추정) - **압축률**: 약 75% 감소 ### 메모리 사용량 - **로딩 시 VRAM**: 약 4-5GB - **추론 시 VRAM**: 약 6-8GB (배치 크기에 따라 변동) - **시스템 RAM**: 최소 8GB 권장 ## 사용법 ### 설치 ```bash pip install transformers accelerate bitsandbytes torch ``` ### 코드 예시 ```python import torch from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig model_name = "nxtcloud-org/kanana-safeguard-siren-8b-4bit" # BitsAndBytesConfig 설정 bnb_config = BitsAndBytesConfig( load_in_4bit=True, bnb_4bit_use_double_quant=True, bnb_4bit_quant_type="nf4", bnb_4bit_compute_dtype=torch.bfloat16 ) # 모델과 토크나이저 로드 tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained( model_name, quantization_config=bnb_config, device_map="auto", trust_remote_code=True ) # 사용 예시 - 안전성 검증 text = "이것은 검증할 텍스트입니다." inputs = tokenizer(text, return_tensors="pt") with torch.no_grad(): outputs = model.generate( **inputs, max_length=512, temperature=0.7, do_sample=True, pad_token_id=tokenizer.eos_token_id ) result = tokenizer.decode(outputs[0], skip_special_tokens=True) print(result) ``` ## 시스템 요구사항 - **최소 RAM**: 8GB - **권장 RAM**: 16GB - **GPU 메모리**: 6GB VRAM (RTX 3060 이상) - **지원 플랫폼**: Linux, Windows (CUDA 지원 GPU) - **Python**: 3.8+ - **CUDA**: 11.1+ ## 제한사항 및 고려사항 ### 성능 제한사항 - 4bit 양자화로 인한 미미한 성능 저하 가능 - 원본 모델 대비 추론 품질이 약간 감소할 수 있음 - 복잡한 안전성 판단에서 더 큰 영향을 받을 수 있음 ### 사용 권장사항 - GPU 메모리 제약이 있는 환경에서 사용 권장 - 실시간 안전성 검증이 필요한 애플리케이션에 적합 - 프로덕션 환경 사용 전 충분한 검증 필요 ### 주의사항 - 이 모델은 안전성 검증 목적의 safeguard 모델입니다 - 원본 모델의 성능과 안전성 특성을 양자화 후에도 유지하도록 노력했으나, 완전히 동일하지 않을 수 있습니다 - 중요한 안전성 판단에는 원본 모델과의 교차 검증을 권장합니다 ## 윤리적 고려사항 - 원본 Kakao Corp의 safeguard 모델의 윤리적 가이드라인을 준수합니다 - 이 모델은 유해 콘텐츠 탐지 및 안전성 검증 목적으로만 사용되어야 합니다 - 양자화로 인한 예상치 못한 편향이나 안전성 이슈가 발생할 수 있으므로 주의가 필요합니다 ## 라이선스 이 양자화 모델은 원본 모델과 동일한 **Apache License 2.0**을 따릅니다. ``` Copyright 2025 Kakao Corp. (Original model) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` ## 크레딧 및 인용 ### 원본 모델 크레딧 ```bibtex @misc{kakao-kanana-safeguard-siren-8b, title={Kanana Safeguard Siren 8B}, author={Kakao Corp}, year={2024}, publisher={Hugging Face}, url={https://huggingface.co/kakaocorp/kanana-safeguard-8b} } ```