syed-aliredha/llama-31-8b-creativity-iti-full
08
Creativity ITI for LLaMA 3.1 8B Instruct (v2.0)
๐ Major Update: Improved Training & Optimization
What's New
- Correct Training Method: Now extracts activations from complete code solutions (not just prompts)
- New Optimal ฮฑ: 0.1 (previously 0.4)
- Efficient Design: Uses only top 11 heads (previously 48) with similar performance
- Better Signal: Trained on how model perceives creativity in existing solutions
Key Improvements
๐ Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load model with auto-ITI
model = AutoModelForCausalLM.from_pretrained(
"syed-aliredha/llama-31-8b-creativity-iti-full",
trust_remote_code=True, # Enables automatic ITI
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(
"syed-aliredha/llama-31-8b-creativity-iti-full"
)
# Generate creative code (ITI automatically applied with ฮฑ=0.1)
prompt = "Write a function to check if a number is prime"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.8)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))๐ Technical Details
Training Methodology
- Data: NeoCoder dataset with creativity labels
- Activations: Extracted from model processing complete solutions
- Labels: Based on novel technique usage vs human solutions
- Probes: Linear classifiers on each attention head
- Selection: Top 11 heads by AUC score
- Direction: Center-of-mass between creative/non-creative
Why Only 11 Heads?
- Pareto principle: 80% of effect from 20% of heads
- Reduces computational overhead significantly
- Maintains creativity enhancement quality
- Faster inference with minimal quality loss
๐ Performance
- Uses efficient subset of most predictive heads
- ~4x faster intervention application
- Maintains creativity enhancement effectiveness
๐ง Custom Parameters
If you want to adjust parameters locally:
from huggingface_hub import hf_hub_download
import pickle
# Download components
top_heads = pickle.load(open(hf_hub_download(repo_id, "iti_top_heads.pkl", repo_type="model"), 'rb'))
directions = pickle.load(open(hf_hub_download(repo_id, "iti_directions.pkl", repo_type="model"), 'rb'))
# Apply with custom alpha
custom_alpha = 0.2 # Your value๐ Citation
Based on: Li et al., "Inference-Time Intervention: Eliciting Truthful Answers from a Language Model" (NeurIPS 2023)
๐ Acknowledgments
- NSCC Singapore for compute resources
- NeoCoder dataset creators
- Meta AI for LLaMA 3.1
