Dataset Viewer
Auto-converted to Parquet
input
stringlengths
12
74
label
stringclasses
2 values
What is Kaikoura known for?
related
What tourist attractions are in Northland?
related
What teams has Brendon McCullum played for?
related
What is the largest lake in New Zealand?
related
Who is Dame Kiri Te Kanawa?
related
What is the best time to visit Auckland Harbour Bridge?
related
What is the Maori name for tui?
related
What is the area of North Island?
related
What is the service industry in New Zealand?
related
When was Oamaru founded?
related
What is the background of Bill English?
related
When was Fox Glacier founded?
related
When did the gold rush happen in New Zealand?
related
Where was Thomasin McKenzie born?
related
Can you climb Mount Dampier?
related
How far is Whanganui from Auckland?
related
What did Kupe do?
related
How do you get to Stewart Island?
related
What sport does Hamish Bond play?
related
Where is Wanaka located in New Zealand?
related
What is the entrance fee for Otago Museum?
related
What is a penguin?
related
What is Helen Clark known for?
related
What is Bill Rowling known for?
related
What achievements does Edmund Hillary have?
related
What region is Greymouth in?
related
What does a New Zealand fur seal eat?
related
What events are held in Hokitika?
related
What is the climate like in Porirua?
related
What is the history of Taupo?
related
What region is Hamilton in?
related
What is the entrance fee for Abel Tasman National Park?
related
What is Wellington known for?
related
What can you do at Sky Tower?
related
What is the background of Te Kooti?
related
What sports teams are based in Franz Josef?
related
What is Taieri River known for?
related
What is Wanganui River known for?
related
What teams has Richie McCaw played for?
related
What is the history of Warkworth?
related
What is the significance of Emily Barclay in New Zealand cinema?
related
Where was Valerie Adams born?
related
What events are held in Warkworth?
related
What was the welfare state in New Zealand?
related
What national parks are in Tasman?
related
What is Joel Tobeck known for?
related
Where is Bay of Islands?
related
What upcoming projects does Rose McIver have?
related
What is the warmest place in New Zealand?
related
Where was Robyn Malcolm born?
related
What does kauri look like?
related
What industries are prominent in West Coast?
related
What events are held in Dunedin?
related
What can you do at Cathedral Cove?
related
What is the significance of Mahe Drysdale in New Zealand sports?
related
What is rimu?
related
What wildlife is found in Lake Taupo?
related
What is Chatham Islands known for?
related
What wildlife is found in Taieri River?
related
What party did George Grey belong to?
related
What is the Maori name for longfin eel?
related
What upcoming projects does Emily Barclay have?
related
What is the New Zealand education system?
related
What is kina?
related
What is the population of Te Anau?
related
What policies did Keith Holyoake implement?
related
When was John Key Prime Minister?
related
When did whaling begin in New Zealand?
related
What is the height of Mount Ruapehu?
related
What teams has Allan Border played for?
related
What does a tui look like?
related
Where was Broods born?
related
What are the opening hours for Westland Tai Poutini National Park?
related
What was the ANZUS treaty?
related
What teams has Lydia Ko played for?
related
What is the habitat of rimu?
related
What movies has Taika Waititi been in?
related
What sports teams are based in Masterton?
related
What is the New Zealand Student Loan Scheme?
related
What is the elevation of Kerikeri?
related
What is the population of Dunedin?
related
What is Taranaki famous for?
related
What is the depth of Lake Te Anau?
related
What is the background of Jean Batten?
related
How far is Invercargill from Auckland?
related
What is the history of Sky Tower?
related
Where is Hamilton located in New Zealand?
related
What is the New Zealand House of Representatives?
related
What is the climate like in Wanaka?
related
What is Vegemite?
related
What is the elevation of Gisborne?
related
What are the rights of Maori under the Treaty of Waitangi?
related
What is Sky Tower known for?
related
When did New Zealand become nuclear-free?
related
What does a kakapo look like?
related
What is the significance of James Shaw in New Zealand politics?
related
What is the population of Queenstown?
related
What are the main industries in Nelson?
related
Where can you find little blue penguin?
related
What is the NPC?
related
End of preview. Expand in Data Studio

New Zealand Guard Dataset

A binary classification dataset for training guard models to identify whether user inputs are related to New Zealand or not. This dataset is designed for fine-tuning language models to act as content filters, ensuring that only New Zealand-related queries are processed by specialised New Zealand AI assistants.

Dataset Description

The New Zealand Guard Dataset contains 5,000 examples of questions and statements labeled as either:

  • related: Inputs that are relevant to New Zealand (cities, landmarks, famous people etc.)
  • not_related: Inputs that are not related to New Zealand (general knowledge, other topics, etc.)

Dataset Structure

Each example in the dataset follows this JSON format:

{"input": "What did Kupe do?", "label": "related"}
{"input": "What is the capital of France?", "label": "not_related"}

Fields

  • input (string): The text input/question to be classified
  • label (string): The classification label, either "related" or "not_related"

Dataset Statistics

  • Total Examples: 5,000
  • Format: JSONL (JSON Lines)
  • Task: Binary Text Classification
  • Labels:
    • related: New Zealand-related content
    • not_related: Non-New Zealand content

Usage

Loading the Dataset

from datasets import load_dataset

# Load from Hugging Face Hub
dataset = load_dataset("geoffmunn/new-zealand-guard-dataset")

# Or load from local JSONL file
dataset = load_dataset("json", data_files="new_zealand_guard_dataset.jsonl")

Example Usage in Training

This dataset is designed to be used with the Hugging Face Transformers library for fine-tuning sequence classification models. Here's a basic example:

from datasets import load_dataset
from transformers import AutoTokenizer, AutoModelForSequenceClassification

# Load dataset
dataset = load_dataset("json", data_files="new_zealand_guard_dataset.jsonl")["train"]

# Map labels to IDs
LABEL2ID = {"not_related": 0, "related": 1}
ID2LABEL = {0: "not_related", 1: "related"}

dataset = dataset.map(lambda x: {"labels": LABEL2ID[x["label"]]})

# Split into train/test
dataset = dataset.train_test_split(test_size=0.1)

# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-4B", trust_remote_code=True)
model = AutoModelForSequenceClassification.from_pretrained(
    "Qwen/Qwen3-4B",
    num_labels=2,
    id2label=ID2LABEL,
    label2id=LABEL2ID,
    trust_remote_code=True
)

# Tokenize
def tokenize_function(examples):
    return tokenizer(
        examples["input"],
        truncation=True,
        padding="max_length",
        max_length=512,
    )

tokenized_dataset = dataset.map(
    tokenize_function,
    batched=True,
    remove_columns=["input", "label"]
)

For a complete training script, see the reference implementation in train_new_zealand_guard.py.

Use Cases

1. Content Moderation for New Zealand Chatbots

This dataset enables training guard models that can filter user inputs before they reach a New Zealand-specific AI assistant. Only New Zealand-related queries are allowed through, ensuring the assistant stays on-topic.

2. API-Based Moderation

The fine-tuned model can be deployed as a moderation API endpoint:

# Example API endpoint (see new_zealand_api_server.py for full implementation)
@app.route('/api/moderate', methods=['POST'])
def moderate():
    data = request.json
    message = data.get('message', '')
    
    # Classify the message
    inputs = tokenizer(message, return_tensors="pt", truncation=True, max_length=512)
    outputs = model(**inputs)
    predicted_label = ID2LABEL[outputs.logits.argmax().item()]
    
    # Return moderation result
    risk_level = "Safe" if predicted_label == "related" else "Unsafe"
    return jsonify({
        'risk_level': risk_level,
        'predicted_label': predicted_label,
        'confidence': float(torch.softmax(outputs.logits, dim=-1).max())
    })

3. Real-Time Chat Filtering

The guard model can be integrated into chat interfaces to provide real-time moderation, blocking non-New Zealand queries before they're sent to the LLM. See new_zealand_chat.html for a complete implementation example.

Model Training Recommendations

Based on the reference training script, recommended hyperparameters:

  • Base Model: Qwen/Qwen3-4B
  • Learning Rate: 2e-4
  • Batch Size: 2 (with gradient accumulation of 16)
  • Epochs: 3
  • Max Length: 512 tokens
  • Fine-tuning Method: LoRA (Low-Rank Adaptation)
    • r=16
    • lora_alpha=32
    • lora_dropout=0.05
    • Target modules: ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]

Dataset Examples

Related Examples

{"input": "What is Kaikoura known for?", "label": "related"}
{"input": "What tourist attractions are in Northland?", "label": "related"}
{"input": "What teams has Brendon McCullum played for?", "label": "related"}
{"input": "What is the largest lake in New Zealand?", "label": "related"}
{"input": "Who is Dame Kiri Te Kanawa?", "label": "related"}

Not Related Examples

{"input": "What is the capital of France?", "label": "not_related"}
{"input": "What is 2 + 2?", "label": "not_related"}
{"input": "Is the sifaka endangered?", "label": "not_related"}
{"input": "When was baseball first played?", "label": "not_related"}
{"input": "How many employees does Spotify have?", "label": "not_related"}

Label Mapping

The dataset uses the following label mapping for model training:

  • "not_related" → Class ID 0
  • "related" → Class ID 1

In the context of content moderation:

  • related = Safe (New Zealand-related content, allowed)
  • not_related = Unsafe (Non-New Zealand content, blocked)

Citation

If you use this dataset in your research or project, please cite it appropriately:

@dataset{new_zealand_guard_dataset,
  title={New Zealand Guard Dataset},
  author={Geoff Munn},
  year={2025},
  url={https://huggingface.co/datasets/geoffmunn/new-zealand-guard-dataset}
}

License

Apache 2.0

Acknowledgments

This dataset was created for training guard models to ensure New Zealand AI assistants remain focused on New Zealand-related content, improving user experience and maintaining topic relevance.

Related Resources

  • Training Script: See train_new_zealand_guard.py for a complete fine-tuning implementation
  • API Server: See new_zealand_api_server.py for deployment as a moderation API
  • Chat Interface: See new_zealand_chat.html for integration into a web-based chat application
Downloads last month
16