Define hallucination labels
Create a labelling protocol that distinguishes factual errors, invented facts and unsupported assertions in model outputs so evaluation metrics match the task.
Explain hallucinations. Assess explanation stability.
A hallucination explanation analyser aims to detect when a model fabricates details and to provide human-interpretable reasons for those errors. Key challenges include defining hallucination labels, aligning explanation methods with human judgement, and measuring explanation stability under data or prompt perturbations.
Learning concept · Not a validated service
A hallucination explanation analyser aims to detect when a model fabricates details and to provide human-interpretable reasons for those errors. Key challenges include defining hallucination labels, aligning explanation methods with human judgement, and measuring explanation stability under data or prompt perturbations.
Proposed application: a reviewer-assist tool for content teams that flags likely hallucinations in model outputs and surfaces candidate attribution traces for a human moderator to inspect. This project emphasises human-in-the-loop review rather than automated removal.
Create a labelling protocol that distinguishes factual errors, invented facts and unsupported assertions in model outputs so evaluation metrics match the task.
Collect model outputs paired with reference facts or human judgements and split by source, topic and difficulty to measure generalisation.
Run explanation methods (feature attribution, LIME/SHAP, counterfactual prompts) and measure stability across perturbations or alternate prompts.
Report explanation stability, hallucination detection precision/recall, and provide a review UI where humans can correct labels and explanations.
The supplied starter generates synthetic tabular classification data with sklearn.make_classification, trains a RandomForestClassifier, computes permutation feature importances on the test set, and prints the model score and the top features. It does not operate on text or model outputs, nor does it detect or explain hallucinations of language models.
X, y = make_classification(n_samples=700, n_features=8, n_informative=5, random_state=42)
columns = [f"feature_{i}" for i in range(X.shape[1])]
X = pd.DataFrame(X, columns=columns)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42, stratify=y)
model = RandomForestClassifier(n_estimators=250, random_state=42)
model.fit(X_train, y_train)
importance = permutation_importance(model, X_test, y_test, n_repeats=10, random_state=42)
report = pd.DataFrame({"feature": columns, "importance": importance.importances_mean})The starter uses synthetic tabular data and a RandomForest; it only computes permutation-based feature importance. It does not ingest model outputs, does not label or detect hallucinations, and does not produce LLM-style explanations or faithfulness checks required by the titled task.
A proposed extension is to replace the synthetic data with a dataset of model outputs annotated for hallucinations, then generate explanations tied to the model input (token or feature attributions) and measure explanation stability under perturbations.
This is a potential application pathway, not a delivered product. The supplied starter does not implement this service or validate it with real users.
Networkers Home runs this topic inside its AI Engineer Course, with placement support and hands-on labs.