CoolFace
Apppublic

robbernick/Resume-Redaction-Guard-v1

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
App README

Talent-Audit-Env ๐Ÿ›ก๏ธ

An OpenEnv-compliant Reinforcement Learning environment for Automated HR Data Compliance.

Agents learn to sanitise PII, categorise resumes by tech-stack, and detect conflicting career claims โ€” all without sacrificing the integrity of technical skills data.


Project Structure

Resume-Redaction-Guard-v1/
โ”œโ”€โ”€ models.py        # Pydantic schemas: Observation, Action, Reward
โ”œโ”€โ”€ tasks.py         # Task definitions (Easy / Medium / Hard) + fixture data
โ”œโ”€โ”€ env.py           # TalentAuditEnv โ€” core OpenEnv environment class
โ”œโ”€โ”€ main.py          # FastAPI server (OpenEnv HTTP API)
โ”œโ”€โ”€ run_demo.py      # CLI demo with oracle agents
โ”œโ”€โ”€ openenv.yaml     # OpenEnv manifest
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ Dockerfile

Quick Start

bash
# 1. Install dependencies
pip install -r requirements.txt

# 2. Run the CLI demo (all 3 tasks)
python run_demo.py

# 3. Or run a single task
python run_demo.py --task pii_easy
python run_demo.py --task pii_medium
python run_demo.py --task audit_hard

# 4. Start the backend HTTP API server
uvicorn main:app --reload --port 7860
# โ†’ Swagger UI: http://localhost:7860/docs

# 5. Connect and launch the premium Next.js frontend
cd frontend
npm install
npm run dev
# โ†’ View UI: http://localhost:3000

Docker

bash
# Build
docker build -t talent-audit-env:1.0.0 .

# Run (API server)
docker run -p 7860:7860 talent-audit-env:1.0.0

# Run (CLI demo)
docker run talent-audit-env:1.0.0 python run_demo.py

Environment API

Python API

python
from env import TalentAuditEnv
from models import Action, TechCategory, RiskLevel

env = TalentAuditEnv()

# --- Easy task ---
obs = env.reset("pii_easy")
action = Action.sanitize_action("r001", ["phone"])
obs, reward, done, info = env.step(action)
print(reward.total, reward.feedback)         # +0.8  PII removed from 1 field(s).

# --- Medium task ---
obs = env.reset("pii_medium")
action = Action.categorize_action("r001", TechCategory.BACKEND, confidence=0.95)
obs, reward, done, info = env.step(action)   # +0.2

action = Action.sanitize_action("r001", ["name", "email", "phone", "address"])
obs, reward, done, info = env.step(action)   # +0.8

# --- Hard task ---
obs = env.reset("audit_hard")
action = Action.flag_action("r006", RiskLevel.HIGH,
    reason="Claimed 8 years exp but graduated only 4 years ago.")
obs, reward, done, info = env.step(action)   # +0.3

summary = env.state()
print(summary["total_reward"])

HTTP API (FastAPI)

MethodEndpointDescription
GET/healthLiveness check
GET/manifestReturns parsed openenv.yaml
GET/tasksLists all registered tasks
POST/reset?task_id=Start a new episode
POST/stepApply an action, get reward
GET/stateFull current environment state

Tasks

IDDifficultyMax StepsGoal
pii_easyEasy5Remove phone number from 1 record
pii_mediumMedium20Categorise + full PII removal across 5 records
audit_hardHard15Detect conflicts, flag High-Risk profiles

Reward Scheme

SignalValueCondition
pii_removal+0.8PII fields cleanly redacted, no technical data lost
categorization+0.2Correct TechCategory assigned
data_loss-0.5Technical skill / experience field deleted
conflict_detect+0.3Genuinely conflicting profile flagged as High-Risk
false_flag-0.3Clean profile incorrectly flagged as High-Risk

Models at a Glance

Observation

python
class Observation(BaseModel):
    task_id: str
    step: int
    records: List[ResumeRecord]   # โ‰ฅ 1 resume records
    context: Optional[Dict]       # task metadata, categorized/flagged state
    done: bool

Action

python
# Exactly one payload must be set
Action.sanitize_action(record_id, fields, replacement="[REDACTED]")
Action.categorize_action(record_id, category, confidence=1.0)
Action.flag_action(record_id, risk_level, reason)

Reward

python
class Reward(BaseModel):
    total: float
    breakdown: RewardBreakdown    # per-signal breakdown
    feedback: str                 # natural-language explanation
    is_terminal: bool

OpenEnv Compliance

The openenv.yaml manifest declares:

  • โ€”observation_space โ€” models.Observation
  • โ€”action_space โ€” union of Sanitize | Categorize | Flag
  • โ€”reward_space โ€” scalar in [-1.5, 2.0]
  • โ€”tasks โ€” all three difficulty levels
  • โ€”evaluation metrics โ€” PII recall, category accuracy, data integrity, conflict F1
  • โ€”scoring formula โ€” weighted composite score