CoolFace
Modelpublic

syed-aliredha/llama-31-8b-creativity-iti-full

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes8downloads
Model Card

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

MetricPreviousCurrent
Alpha (ฮฑ)0.40.1
Active Heads4811
Training MethodPrompt-onlyFull solutions

๐Ÿš€ Usage

python
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

  1. 1.Data: NeoCoder dataset with creativity labels
  2. 2.Activations: Extracted from model processing complete solutions
  3. 3.Labels: Based on novel technique usage vs human solutions
  4. 4.Probes: Linear classifiers on each attention head
  5. 5.Selection: Top 11 heads by AUC score
  6. 6.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:

python
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