File size: 1,962 Bytes
7dd33ba
 
 
 
 
 
c9eed11
 
674b604
7dd33ba
 
 
 
 
 
 
 
 
29e7186
7dd33ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f267a52
7dd33ba
 
0cc82a3
7dd33ba
 
 
 
 
 
 
 
 
 
 
 
 
c9eed11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
language:
- en
base_model:
- microsoft/deberta-v3-base
pipeline_tag: text-classification
tags:
- classification
- transformers
---
Binary classification model for ad-detection on QA Systems.

## Sample usage

```python
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

classifier_model_path = "jmvcoelho/ad-classifier-v0.2"
tokenizer = AutoTokenizer.from_pretrained(classifier_model_path)
model = AutoModelForSequenceClassification.from_pretrained(classifier_model_path)
model.eval()

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)

def classify(passages):
    inputs = tokenizer(
        passages, padding=True, truncation=True, max_length=512, return_tensors="pt"
    )
    inputs = {k: v.to(device) for k, v in inputs.items()}
    with torch.no_grad():
        outputs = model(**inputs)
        logits = outputs.logits
        predictions = torch.argmax(logits, dim=-1)
    return predictions.cpu().tolist()

preds = classify(["sample_text_1", "sample_text_2"])
```


## Version

- v0.0: Trained with the official data from Webis Generated Native Ads 2024
- v0.1: Trained with v0.0 data + new synthetic data
- **v0.2**: Similar to v0.1, but include more diversity in ad placement startegies through prompting.


## New Synthetic Data

Objective: Given (query, answer) pair, generate new_answer which contains an advertisement. 

### Obtaining (query, answer) pairs:

- queries: Obtained from MS-MARCO V2.1 QA task. 150K subset of queries that are associated with a "well formed answer"
- answer: Generated given the query. Model: Qwen2.5-7B-Instruct using RAG with 10 passages (from our model.)

### Models used for generation


Each model generated for 1/4th of the (query, answer) pairs
- Gemma-2-9b-it
- LLaMA-3.1-8B-Instruct
- Mistral-7B-Instruct
- Qwen2.5-7B-Instruct

### Prompts

One of twelve prompts is chosen at random.  
Prompts can be found under `files/*.prompt`.