Doctoral Research on Competency Transfer in Human-AI Collaboration Models
PIDL (Persona in the Loop) is a research platform that investigates the impact of AI personas at different competency levels on user learning in code generation. The system supports Solidity smart contract development tasks with 10 different personas based on the Dreyfus Model of Skill Acquisition.
- Features
- Project Structure
- Installation
- Usage
- System Architecture
- Research Methodology
- Technical Details
- Database
- Admin Dashboard
- Development
- License
- 5 Dreyfus Levels: Novice, Advanced Beginner, Competent, Proficient, Expert
- 2 Domains: Education (Pedagogical) and Technology (Technical)
- Each persona has its own unique coding style, philosophy, and system prompt
- Dual Domain Assessment: Technical and pedagogical competencies are measured separately
- 10-Question Survey: 5 technical + 5 pedagogical questions
- Dreyfus Model Mapping: Scores are automatically converted to Dreyfus levels
6-Stage Calculation Process:
- User Vector Creation: Converting user competency to a 10-dimensional vector
- Persona Vectors Matching: Defining characteristic vectors for each persona
- Similarity Score (S): Hybrid Distance (Cosine + Euclidean)
- Competency Match (C): Gaussian ZPD (Zone of Proximal Development)
- Performance Prediction (P): Logistic Regression Model
- Learning Trajectory (L): Exponential Growth Model
Two Recommendation Modes:
- Similar AI: Persona from your strong domain, at your level
- Complementary AI: Persona from your weak domain, to complement you
- Diploma Verification: Blockchain-based diploma system
- NFT Creation: NFT minting and transfer
- Access Control: Role-based access control
- Loan System: DeFi loan contract
- Incentive Mechanism: Token incentive system
- DAO Management: Decentralized autonomous organization
For each generated code and prompt:
- Prompt Feature Analysis: Word count, technical terms, clarity, specificity
- Prompt Similarity Analysis: Cosine Similarity, Jaccard Similarity
- Code Structure Analysis: Line count, comment ratio, function count
- Code Complexity Analysis: Cyclomatic Complexity, Nesting Depth
- Code Quality Assessment: Readability, maintainability, documentation
- Comparative Analysis: Persona comparison
- Pre-Test / Post-Test: Learning gain measurement
- NASA-TLX: Cognitive load assessment
- AI Code Evaluation: Code quality from user perspective
- Final Survey: General experience evaluation
- Participant analysis and demographic distribution
- Task performance metrics
- Learning gain analysis
- Cognitive load comparison
- AI persona performance comparison
- Detailed data tables and CSV export
pidl/
├── research_app.py # Main research application
├── app.py # Demo/test application
├── personas.py # 10 persona definitions
├── competency_assessment.py # Competency assessment
├── recommendation_engine.py # Mathematical recommendation engine
├── content_analyzer.py # 6-stage content analysis
├── database/
│ ├── models.py # SQLAlchemy models
│ ├── database.py # Database connection
│ └── research_data.db # SQLite database
├── research_modules/
│ ├── consent_form.py # Consent form
│ ├── pre_post_test.py # Pre/post test
│ ├── nasa_tlx.py # NASA-TLX form
│ ├── ai_evaluation.py # AI code evaluation
│ ├── final_survey.py # Final survey
│ └── data_logger.py # Data logging system
├── tasks/
│ ├── base_task.py # Task base class
│ ├── task1_diploma.py # Task 1: Diploma
│ ├── task2_nft.py # Task 2: NFT
│ ├── task3_access.py # Task 3: Access Control
│ ├── task4_loan.py # Task 4: Loan
│ ├── task5_incentive.py # Task 5: Incentive
│ └── task6_dao.py # Task 6: DAO
├── pages/
│ └── 1_📊_Yonetim_Paneli.py # Admin dashboard
├── requirements.txt # Python dependencies
├── setup.sh # Installation script
└── README.md # This file
- Python 3.8+
- OpenAI API key (or other LLM providers)
- Clone the project:
cd /Users/mustafa/Downloads/pidl-main/Downloads/pidl- Run the installation script:
chmod +x setup.sh
./setup.shOr manual installation:
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install --upgrade pip
pip install -r requirements.txt- Create
.envfile:
# Create .env file
cat > .env << EOF
# OpenAI API Key
OPENAI_API_KEY=your_openai_api_key_here
# Model Settings
DEFAULT_MODEL=gpt-4o-mini
TEMPERATURE=0.7
MAX_TOKENS=2000
EOF- Initialize the database:
python -c "from database.database import init_database; init_database()"source venv/bin/activate
streamlit run research_app.pyNavigate to http://localhost:8501 in your browser.
streamlit run pages/1_📊_Yonetim_Paneli.pyOr as a Streamlit multi-page application:
streamlit run research_app.py
# Select "📊 Yönetim Paneli" from the sidebarstreamlit run app.py1. Consent Form
↓
2. Competency Assessment (10 questions)
↓
3. Persona Recommendation (6-Stage Mathematical Calculation)
├─ Similar AI (Strong domain)
└─ Complementary AI (Weak domain)
↓
4. 6 Task Loop (For each task):
├─ Pre-Test (3 questions)
├─ Code Generation (with AI Persona)
├─ 6-Stage Content Analysis
├─ Post-Test (5 questions)
├─ NASA-TLX (Cognitive load)
└─ AI Code Evaluation
↓
5. Final Survey
↓
6. Completion
- Odd-numbered tasks (1, 3, 5): Similar AI
- Even-numbered tasks (2, 4, 6): Complementary AI
This strategy ensures users gain experience in both their strong and weak domains.
-
Dreyfus Model of Skill Acquisition (1980)
- 5-stage competency model
- Novice → Expert transition process
-
Cognitive Load Theory (Sweller, 1988)
- Intrinsic, extraneous, and germane cognitive load
- Learning optimization
-
Zone of Proximal Development (Vygotsky, 1978)
- Optimal difficulty level
- Gaussian ZPD model
-
Multi-Criteria Decision Analysis (MCDA)
- Multi-criteria decision making
- Weighted scoring
- Does Similar AI or Complementary AI provide more effective learning?
- How does persona level (Dreyfus) affect learning gain?
- How does cognitive load (NASA-TLX) vary by persona type?
- What is the relationship between code quality and learning gain?
- Dependent Variables: Learning gain (post-test - pre-test), cognitive load, perceived code quality
- Independent Variables: Persona type (Similar/Complementary), persona level, user competency
- Control Variables: Task difficulty, code generation time, prompt quality
u = [technical_skill, domain_knowledge, ai_experience, learning_goal,
procedural_knowledge, declarative_knowledge, conditional_knowledge,
cognitive_capacity, pattern_recognition, abstraction_level]S = 0.6 × cosine_similarity(u, p) + 0.4 × (1 - euclidean(u, p) / √10)
C = exp(-λ × |skill_gap|²) × alignment
P = σ(β₀ + β₁·skill + β₂·quality + β₃·similarity + β₄·task_complexity)
L = L_max × (1 - e^(-k·τ)) × potential
R_similar = 0.30·S + 0.35·C + 0.25·P + 0.10·L
R_complementary = 0.30·(1-S) + 0.35·D + 0.25·P + 0.10·L
- Cyclomatic Complexity: McCabe (1976)
- Halstead Metrics: Code volume and difficulty
- Maintainability Index: Maintainability score
- TF-IDF Cosine Similarity: Text similarity
Tables:
participants: Participant information and competency scorestask_sessions: Task sessionspre_post_tests: Pre-test and post-test resultsgenerated_codes: Generated codes and promptsnasa_tlx_responses: NASA-TLX cognitive load measurementsai_code_evaluations: AI code evaluationsfinal_evaluations: Final survey responses
from database.database import DatabaseSession
from database.models import Participant
with DatabaseSession() as session:
participants = session.query(Participant).all()The admin dashboard provides the following analyses:
-
General Statistics
- Total number of participants
- Number of completed tasks
- Number of generated codes
- Average cognitive load
-
Participant Analysis
- Competency level distribution
- Technical vs Pedagogical scores
- Demographic distribution
-
Task Performance Analysis
- Task completion status
- AI persona usage
- Task durations
-
Learning Gain Analysis
- Pre-test vs Post-test comparison
- Task-based gains
-
Cognitive Load Analysis
- NASA-TLX dimensions
- AI type-based cognitive load
-
AI Code Evaluation Analysis
- Code quality metrics
- Persona comparison
-
Content Analysis
- 6-stage mathematical analysis results
- Persona performance comparison
-
Data Export
- CSV export
- Excel export (coming soon)
Add a new persona to personas.py:
Persona(
id="new_persona_id",
name="Persona Name",
role="Role",
category="education" or "technology",
dreyfus_level="novice" | "advanced_beginner" | "competent" | "proficient" | "expert",
# ... other attributes
)Add a new task class to tasks/ folder:
from tasks.base_task import BaseTask
class Task7New(BaseTask):
title = "New Task"
description = "Task description"
difficulty = "Medium"
def get_pre_test_questions(self):
# Pre-test questions
pass
def get_post_test_questions(self):
# Post-test questions
passpython test_system.pyMain dependencies:
streamlit==1.31.0: Web interfaceopenai==1.54.0: GPT-4 APIsqlalchemy>=2.0.44: Database ORMscikit-learn==1.4.0: Machine learning modelsnumpy==1.26.3: Mathematical calculationspandas==2.2.0: Data analysisplotly==5.18.0: Visualization
See requirements.txt for the complete list.
- All participant data is stored anonymously
- Identity privacy is ensured with UUID
- API keys are stored in
.envfile (should not be committed to git) - Database is unencrypted SQLite (PostgreSQL recommended for production)
- Dreyfus, S. E., & Dreyfus, H. L. (1980). A five-stage model of the mental activities involved in directed skill acquisition.
- Sweller, J. (1988). Cognitive load during problem solving: Effects on learning.
- Vygotsky, L. S. (1978). Mind in society: The development of higher psychological processes.
- McCabe, T. J. (1976). A complexity measure.
- Halstead, M. H. (1977). Elements of software science.
- ISO/IEC 25010: Software Quality Model
This is a doctoral research project. Please contact for contributions.
This project is for academic research purposes. Permission required for commercial use.
- OpenAI GPT-4 API
- Streamlit team
- All participants