Downloads · 30 days
4
8% of all-time downloads
ZhixiaoQi/Qwen-7B-chat-Fake-Learning
Qwen-7B-chat-Fake-Learning is a machine learning model from ZhixiaoQi. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This is a Fake-Learning enhanced version of the Qwen-7B-Chat model, which leverages token collocation patterns to improve generation quality without requiring model retraining.
Downloads · 30 days
4
8% of all-time downloads
All-time downloads
52
Public
Parameters
7.7B
16.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors15.4 GB · 94%
From the Hugging Face model README
This is a Fake-Learning enhanced version of the Qwen-7B-Chat model, which leverages token collocation patterns to improve generation quality without requiring model retraining.
Fake-Learning is a novel approach that enhances large language model generation by incorporating statistical token collocation patterns. The method works by:
This plug-and-play approach can be integrated into existing models without retraining, requiring only the pre-computed collocation matrix and modified inference code.
This model is based on the Qwen-7B-Chat architecture with the following modifications:
DispersionLogitsProcessor for token collocation-based logits adjustmentTokenCollocationSpikeValues_Matrix.mtx for runtime inferencemodeling_qwen.py to incorporate Fake-Learning during generationfrom transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.generation import GenerationConfig
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
"./Qwen-7B-chat-Fake-Learning",
device_map="auto",
trust_remote_code=True
).eval()
tokenizer = AutoTokenizer.from_pretrained(
"./Qwen-7B-chat-Fake-Learning",
trust_remote_code=True
)
# Set generation config
model.generation_config = GenerationConfig.from_pretrained(
"./Qwen-7B-chat-Fake-Learning",
trust_remote_code=True
)
# Generate text
response, history = model.chat(tokenizer, "Your prompt here", history=None)
print(response)
The alpha parameter controls the influence of Fake-Learning on generation:
# Higher alpha (e.g., 0.9) gives more weight to token collocation patterns
# Lower alpha (e.g., 0.3) relies more on the original model predictions
This model is built upon the Qwen-7B-Chat model from Alibaba Cloud. No additional training was performed.
The Fake-Learning enhancement consists of:
modeling_qwen.py and modify_logits.py files that integrate the collocation matrix into the generation processmodeling_qwen.py: Modified Qwen modeling code with Fake-Learning integrationmodify_logits.py: Logits processor implementation for token collocation adjustmentTokenCollocationSpikeValues_Matrix.mtx: Pre-computed token collocation spike value matrixREADME.md: Detailed documentation and usage instructionsFor source code, documentation, and additional resources, please visit: