chatglm
**ChatGLM: Bilingual Open Model**
**Overview**
ChatGLM is a family of open-source LLMs developed by **Tsinghua University** (KEG & Data Mining Group) in China. It is specifically optimized for **Chinese-English bilingual** conversation.
**Architecture (GLM)**
It uses the **GLM (General Language Model)** architecture, which is different from GPT (Decoder-only) or BERT (Encoder-only). It uses Autoregressive Blank Infilling.
**Key Models**
- **ChatGLM-6B**: A 6 billion parameter model (very small!).
- **Quantization**: Famous for running on consumer hardware (consumer laptop GPUs). It can run in 4-bit mode on just 6GB VRAM.
**Significance**
Before Llama 2 became the global standard, ChatGLM was the go-to open model for the Chinese NLP community. It handles Chinese idioms, culture, and grammar significantly better than western-trained models (GPT-3).
**Deployment**
It is fully integrated into Hugging Face Transformers.
```python
model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
response, history = model.chat(tokenizer, "你好", history=[])
```