wkim97/MI-KnobSet
Viewer • Updated • 52.2k • 22
How to use wkim97/Phi-4-AdKnob with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("microsoft/phi-4")
model = PeftModel.from_pretrained(base_model, "wkim97/Phi-4-AdKnob")AdKnob checkpoint for microsoft/phi-4 from AdKnob: Ad Intensity Control and Labeling for LLM-Native Advertising (NeurIPS 2026).
Code: https://github.com/wkim97/AdKnob
import torch
from adknob.data import encode_prompt
from adknob.modeling import load_model
from adknob.rollout import TAU, label_response
model, tok = load_model("wkim97/Phi-4-AdKnob")
brand, ad_copy = "Wells Fargo", "Comprehensive digital banking solutions for diverse financial needs."
question = "What are the main services and features available through online banking"
level = 3
ids, _ = encode_prompt(tok, brand, ad_copy, question, level)
x = torch.tensor([ids], device=model.device)
out = model.generate(x, attention_mask=torch.ones_like(x), max_new_tokens=500, do_sample=False)
response = tok.decode(out[0, x.shape[1]:], skip_special_tokens=True)
spans, scores = label_response(model, tok, brand, ad_copy, question, level, response)
ad_sentences = [response[a:b] for (a, b), s in zip(spans, scores) if s > TAU]
@inproceedings{kim2026adknob,
title = {AdKnob: Ad Intensity Control and Labeling for LLM-Native Advertising},
author = {Kim, Woo Jae and Keum, Seongho and Jeon, Joonsung and Ha, Suhyeon and Son, Sooel and Yoon, Sung-eui},
booktitle = {Advances in Neural Information Processing Systems (NeurIPS)},
year = {2026}
}
Base model
microsoft/phi-4