Explorar o código

finetune: quoted phrases, negation, and entity preservation (#247)

Training data:
- Expand lex phrases/negation examples from 12 to 74 with intent field
- Add 50 personal entity examples (meetings, emails, projects with names)

Reward function:
- Detect entities at position 0 (fixes "Bob asked about deploy")
- Per-entity coverage penalty: -20 per entity absent from all lex+vec
- Phrase quoting bonus: +3 when lex uses quotes for multi-word terms
- Expanded stopwords to reduce false positive entity detection

Eval queries: add 21 test queries for personal entities, quoted phrases,
and negation/disambiguation scenarios.
Tobi Lutke hai 3 meses
pai
achega
3950055708

+ 41 - 9
finetune/SCORING.md

@@ -61,24 +61,29 @@ vec: authentication configuration options
 | Lex lines are keyword-focused (shorter) | +5 | -2 if lex is longer than vec |
 | Vec lines are natural language (complete phrases) | +5 | -2 if vec is just keywords |
 
-### 5. Named Entity Preservation (0-20 points, CRITICAL)
+### 5. Named Entity Preservation (-65 to +20 points, CRITICAL)
 
-Named entities are proper nouns, brand names, technical terms, and acronyms that MUST appear in lex queries. This prevents generic expansions that lose the specific topic.
+Named entities are proper nouns, brand names, personal names, technical terms, and acronyms that MUST appear in lex queries. This prevents generic expansions that lose the specific topic.
+
+**Two-level checking:**
 
 | Criterion | Points | Deduction |
 |-----------|--------|-----------|
-| All lex lines contain at least one entity | +15 | - |
-| Some lex lines contain entities | +5 | - |
-| NO lex lines contain entities | - | **-30 HEAVY PENALTY** |
+| **Per-line**: All lex lines contain at least one entity | +15 | - |
+| **Per-line**: Some lex lines contain entities | +5 | - |
+| **Per-line**: NO lex lines contain entities | - | **-30 HEAVY PENALTY** |
+| **Per-entity**: Entity completely absent from all lex+vec | - | **-20 per dropped entity** |
 | Generic filler phrases in lex | - | -15 per phrase |
 | Entities also in vec lines | +5 | - |
 
 **Named Entity Detection:**
 - All-caps acronyms: `TDS`, `API`, `GPU`, `AWS`
-- Capitalized proper nouns: `React`, `Docker`, `Kubernetes`
+- Capitalized proper nouns (any position): `React`, `Docker`, `Bob`, `Sarah`
+- Personal names at query start: `Bob asked about deploy` → `Bob` is an entity
 - Technical terms: `node.js`, `C++`, `.NET`
 - CamelCase: `JavaScript`, `TypeScript`
 - Compound names: `TDS motorsports` → both words are entities
+- Project names: `Project Atlas`, `Horizon team`
 
 **Generic Filler Phrases (BANNED in lex):**
 - "find information about"
@@ -88,14 +93,41 @@ Named entities are proper nouns, brand names, technical terms, and acronyms that
 
 **Examples:**
 
-| Query | Bad Lex (Score: 0.30) | Good Lex (Score: 1.00) |
-|-------|----------------------|------------------------|
+| Query | Bad Lex | Good Lex |
+|-------|---------|----------|
 | `who is TDS motorsports` | `lex: find information about` | `lex: TDS motorsports history` |
 | | `lex: company details` | `lex: TDS motorsports founders` |
+| `meeting with Bob about C++` | `lex: c++ meetings` | `lex: Bob "C++" meeting` |
+| | `vec: programming meeting notes` | `vec: meeting notes with Bob about C++` |
 | `how to use React hooks` | `lex: programming tutorial` | `lex: React hooks tutorial` |
 | | `lex: how to code` | `lex: useEffect useState hooks` |
 
-**Key Rule**: If a query mentions a specific entity (brand, product, technology), EVERY lex line should include that entity or a direct variation of it.
+**Key Rule**: If a query mentions a specific entity (person, brand, product, technology, project name), that entity MUST appear somewhere in the lex+vec output. Dropping a person's name is especially costly.
+
+### 6. Lex Phrase Quoting (bonus, +3 points)
+
+When a query contains multi-word technical terms or proper nouns, lex output should use quoted phrases for exact matching in BM25.
+
+| Criterion | Points |
+|-----------|--------|
+| Uses `"quoted phrases"` in lex when query has multi-word entities | +3 |
+
+**When to quote:**
+- Multi-word proper nouns: `"New York"`, `"Monte Carlo"`
+- Specific technical terms: `"machine learning"`, `"rate limit"`
+- Exact compound terms: `"connection pool"`, `"merge conflict"`
+
+**When to use negation (`-term`):**
+- Disambiguating terms: `rust -corrosion`, `java -coffee`, `apple -fruit`
+- Excluding related-but-wrong topics: `"machine learning" -"deep learning"`
+- Narrowing scope: `docker -kubernetes`, `python -snake`
+
+**Example:**
+```
+Query: python memory leak debugging
+Good lex: "memory leak" python -java -javascript
+Good lex: tracemalloc "garbage collector" profiler
+```
 
 ## Score Calculation
 

+ 72 - 10
finetune/data/qmd_expansion_lex_phrases_negation.jsonl

@@ -1,12 +1,74 @@
 {"query": "performance optimization C++ program", "intent": "optimizing a C++ application", "output": [["lex", "\"C++ performance\" optimization -sports -athlete"], ["lex", "\"memory allocation\" \"cache miss\" profiling"], ["vec", "how to improve the runtime performance of a C++ program"], ["hyde", "C++ performance optimization involves profiling with tools like perf or valgrind, reducing memory allocations, improving cache locality, and avoiding unnecessary copies. Key techniques include move semantics, reserve on vectors, and SIMD intrinsics for hot loops."]]}
 {"query": "python memory leak debugging", "intent": "debugging a Python application", "output": [["lex", "\"memory leak\" python -java -javascript"], ["lex", "\"garbage collector\" reference counting tracemalloc"], ["vec", "how to find and fix memory leaks in a Python application"], ["hyde", "Python memory leaks often occur when objects hold references longer than expected, preventing garbage collection. Use tracemalloc or memory_profiler to track allocations over time. Common causes include circular references, global caches, and event listeners that aren't removed."]]}
-{"query": "connection pool exhaustion database", "intent": "debugging database connectivity issues", "output": [["lex", "\"connection pool\" exhausted timeout -redis -cache"], ["lex", "\"max connections\" database pool overflow"], ["vec", "why does the database connection pool run out of connections under load"], ["hyde", "Connection pool exhaustion occurs when all connections are checked out and new requests must wait or fail. This typically happens when queries run slowly, connections aren't released properly, or traffic spikes beyond pool capacity. Fix by increasing pool size, setting connection timeouts, or optimizing slow queries."]]}
-{"query": "rate limiting API implementation", "intent": "implementing rate limiting in a backend service", "output": [["lex", "\"rate limit\" \"token bucket\" OR \"sliding window\" -ethereum -cryptocurrency"], ["lex", "\"requests per second\" throttle middleware"], ["vec", "how to implement rate limiting for an API endpoint"], ["hyde", "A token bucket rate limiter grants each client N tokens per time window. Each request consumes one token. When tokens run out, requests are rejected with 429 Too Many Requests. Tokens refill at a fixed rate. This allows short bursts while enforcing long-term average rate limits."]]}
-{"query": "SQL query performance slow", "intent": "optimizing a slow database query", "output": [["lex", "\"query plan\" index scan \"full table\" slow -nosql -mongodb"], ["lex", "\"missing index\" \"N+1\" joins optimization"], ["vec", "why is my SQL query running slowly and how do I optimize it"], ["hyde", "Slow SQL queries are usually caused by missing indexes, full table scans, or N+1 query patterns. Use EXPLAIN ANALYZE to view the query plan. Add indexes on columns used in WHERE, JOIN, and ORDER BY clauses. Avoid SELECT * and fetch only the columns needed."]]}
-{"query": "machine learning model overfitting", "intent": "training a machine learning model", "output": [["lex", "\"overfitting\" \"validation loss\" regularization -sports -fitness"], ["lex", "dropout \"weight decay\" \"early stopping\" training"], ["vec", "how to detect and prevent overfitting in a machine learning model"], ["hyde", "Overfitting occurs when a model memorizes training data instead of learning generalizable patterns, leading to high training accuracy but poor validation performance. Prevention techniques include dropout, L1/L2 regularization, data augmentation, and early stopping based on validation loss."]]}
-{"query": "docker container networking", "intent": "configuring Docker networking", "output": [["lex", "\"docker network\" bridge overlay -kubernetes -k8s"], ["lex", "\"container ip\" \"port mapping\" expose publish"], ["vec", "how do Docker containers communicate with each other on the same host"], ["hyde", "Docker containers on the same host communicate via bridge networks. By default, containers on the bridge network can reach each other by IP. Use docker network create to make named networks, then --network flag to attach containers. Services can reference each other by container name as DNS hostname."]]}
-{"query": "authentication token JWT", "intent": "implementing JWT authentication", "output": [["lex", "\"JWT\" \"json web token\" \"secret key\" -oauth -saml"], ["lex", "\"bearer token\" signature expiry claims"], ["vec", "how does JWT authentication work and how do I validate a token"], ["hyde", "JWT tokens consist of three base64-encoded parts: header (algorithm), payload (claims like user id and expiry), and signature. The server validates the signature using a secret key and checks that the token hasn't expired. Never store sensitive data in the payload as it's only encoded, not encrypted."]]}
-{"query": "async await error handling javascript", "intent": "writing async JavaScript code", "output": [["lex", "\"async\" \"await\" \"try catch\" promise -python -rust"], ["lex", "\"unhandled rejection\" \"error boundary\" async"], ["vec", "how to properly handle errors in async/await JavaScript functions"], ["hyde", "Wrap await calls in try/catch blocks to handle rejections. Unhandled promise rejections crash Node.js processes. For parallel operations, use Promise.allSettled() instead of Promise.all() to handle partial failures. Always chain .catch() or use try/catch — never leave promises floating."]]}
-{"query": "git merge conflict resolution", "intent": "resolving a git merge conflict", "output": [["lex", "\"merge conflict\" \"<<<<<<\" rebase resolution -github -gitlab"], ["lex", "\"conflict markers\" \"ours\" \"theirs\" checkout"], ["vec", "how do I resolve a git merge conflict between two branches"], ["hyde", "Git merge conflicts occur when two branches change the same lines. Conflict markers show both versions: <<<<<<< HEAD (your changes), ======= (separator), and >>>>>>> branch-name (incoming). Edit the file to keep the correct version, remove the markers, then git add and git commit to complete the merge."]]}
-{"query": "kubernetes pod crashloopbackoff", "intent": "debugging a Kubernetes deployment", "output": [["lex", "\"CrashLoopBackOff\" pod logs restart -docker -vagrant"], ["lex", "\"container failed\" liveness probe startup"], ["vec", "why is my Kubernetes pod stuck in CrashLoopBackOff and how do I fix it"], ["hyde", "CrashLoopBackOff means the container keeps crashing and Kubernetes is backing off restarts exponentially. Check logs with kubectl logs --previous to see the last crash output. Common causes: misconfigured environment variables, missing secrets, failed liveness probes, or an application crash on startup."]]}
-{"query": "react state management redux", "intent": "managing state in a React application", "output": [["lex", "\"Redux\" \"useReducer\" \"action creator\" -angular -vue"], ["lex", "\"store dispatch\" \"selector\" \"middleware\" thunk"], ["vec", "when should I use Redux versus local React state for state management"], ["hyde", "Redux is best for state shared across many components or that needs to persist across routes. Local useState is fine for UI state scoped to one component. For medium complexity, useContext + useReducer avoids Redux boilerplate. Redux shines for large apps with complex update logic, time-travel debugging, or middleware needs."]]}
+{"query": "connection pool exhaustion database", "intent": "debugging database connectivity issues", "output": [["lex", "\"connection pool\" exhausted timeout -redis -cache"], ["lex", "\"max connections\" database pool overflow"], ["vec", "why does the database connection pool run out of connections under load"], ["hyde", "Connection pool exhaustion occurs when all connections are checked out and new requests must wait or fail. This typically happens when queries run slowly, connections aren't released properly, or traffic spikes beyond pool capacity."]]}
+{"query": "rate limiting API implementation", "intent": "implementing rate limiting in a backend service", "output": [["lex", "\"rate limit\" \"token bucket\" OR \"sliding window\" -ethereum -cryptocurrency"], ["lex", "\"requests per second\" throttle middleware"], ["vec", "how to implement rate limiting for an API endpoint"], ["hyde", "A token bucket rate limiter grants each client N tokens per time window. Each request consumes one token. When tokens run out, requests are rejected with 429 Too Many Requests."]]}
+{"query": "SQL query performance slow", "intent": "optimizing a slow database query", "output": [["lex", "\"query plan\" index scan \"full table\" slow -nosql -mongodb"], ["lex", "\"missing index\" \"N+1\" joins optimization"], ["vec", "why is my SQL query running slowly and how do I optimize it"], ["hyde", "Slow SQL queries are usually caused by missing indexes, full table scans, or N+1 query patterns. Use EXPLAIN ANALYZE to view the query plan and add indexes on columns in WHERE and JOIN clauses."]]}
+{"query": "machine learning model overfitting", "intent": "training a machine learning model", "output": [["lex", "\"overfitting\" \"validation loss\" regularization -sports -fitness"], ["lex", "dropout \"weight decay\" \"early stopping\" training"], ["vec", "how to detect and prevent overfitting in a machine learning model"], ["hyde", "Overfitting occurs when a model memorizes training data instead of learning generalizable patterns, leading to high training accuracy but poor validation performance."]]}
+{"query": "docker container networking", "intent": "configuring Docker networking", "output": [["lex", "\"docker network\" bridge overlay -kubernetes -k8s"], ["lex", "\"container ip\" \"port mapping\" expose publish"], ["vec", "how do Docker containers communicate with each other on the same host"], ["hyde", "Docker containers on the same host communicate via bridge networks. Use docker network create to make named networks, then --network flag to attach containers."]]}
+{"query": "authentication token JWT", "intent": "implementing JWT authentication", "output": [["lex", "\"JWT\" \"json web token\" \"secret key\" -oauth -saml"], ["lex", "\"bearer token\" signature expiry claims"], ["vec", "how does JWT authentication work and how do I validate a token"], ["hyde", "JWT tokens consist of three base64-encoded parts: header, payload with claims, and signature. The server validates the signature using a secret key and checks expiry."]]}
+{"query": "async await error handling javascript", "intent": "writing async JavaScript code", "output": [["lex", "\"async\" \"await\" \"try catch\" promise -python -rust"], ["lex", "\"unhandled rejection\" \"error boundary\" async"], ["vec", "how to properly handle errors in async/await JavaScript functions"], ["hyde", "Wrap await calls in try/catch blocks to handle rejections. Unhandled promise rejections crash Node.js processes. Use Promise.allSettled() for parallel operations with partial failures."]]}
+{"query": "git merge conflict resolution", "intent": "resolving a git merge conflict", "output": [["lex", "\"merge conflict\" \"<<<<<<\" rebase resolution -github -gitlab"], ["lex", "\"conflict markers\" \"ours\" \"theirs\" checkout"], ["vec", "how do I resolve a git merge conflict between two branches"], ["hyde", "Git merge conflicts occur when two branches change the same lines. Conflict markers show both versions. Edit the file to keep the correct version, remove markers, then git add and commit."]]}
+{"query": "kubernetes pod crashloopbackoff", "intent": "debugging a Kubernetes deployment", "output": [["lex", "\"CrashLoopBackOff\" pod logs restart -docker -vagrant"], ["lex", "\"container failed\" liveness probe startup"], ["vec", "why is my Kubernetes pod stuck in CrashLoopBackOff and how do I fix it"], ["hyde", "CrashLoopBackOff means the container keeps crashing and Kubernetes backs off restarts exponentially. Check logs with kubectl logs --previous to see the crash output."]]}
+{"query": "react state management redux", "intent": "managing state in a React application", "output": [["lex", "\"Redux\" \"useReducer\" \"action creator\" -angular -vue"], ["lex", "\"store dispatch\" \"selector\" \"middleware\" thunk"], ["vec", "when should I use Redux versus local React state for state management"], ["hyde", "Redux is best for state shared across many components. Local useState is fine for UI state scoped to one component. For medium complexity, useContext + useReducer avoids Redux boilerplate."]]}
+{"query": "machine learning vs deep learning", "intent": "comparing ML approaches", "output": [["lex", "\"machine learning\" -\"deep learning\" traditional algorithms"], ["lex", "\"deep learning\" \"neural network\" -\"machine learning\" classical"], ["vec", "what is the difference between machine learning and deep learning"], ["hyde", "Machine learning encompasses algorithms that learn from data including decision trees, SVMs, and random forests. Deep learning is a subset using neural networks with multiple layers."]]}
+{"query": "python web scraping beautiful soup", "intent": "scraping web pages with Python", "output": [["lex", "\"Beautiful Soup\" python scraping -selenium -playwright"], ["lex", "\"web scraping\" beautifulsoup4 html parsing"], ["vec", "how to scrape web pages using Beautiful Soup in Python"], ["hyde", "Beautiful Soup is a Python library for parsing HTML and XML. Install with pip install beautifulsoup4. Use requests to fetch pages, then BeautifulSoup to navigate the DOM tree."]]}
+{"query": "rust ownership and borrowing", "intent": "understanding Rust memory model", "output": [["lex", "rust ownership borrowing -corrosion -oxidation -metal"], ["lex", "\"borrow checker\" lifetime \"move semantics\" rust"], ["vec", "how does Rust's ownership and borrowing system work"], ["hyde", "Rust's ownership system ensures memory safety without garbage collection. Each value has one owner. References can borrow values immutably or mutably but not both simultaneously."]]}
+{"query": "java stream api filtering", "intent": "processing Java collections functionally", "output": [["lex", "\"Stream API\" java filter map -coffee -island"], ["lex", "java streams \"lambda expression\" collect"], ["vec", "how to use Java Stream API for filtering and transforming collections"], ["hyde", "Java Streams provide a functional approach to processing collections. Chain operations like filter(), map(), and collect() for declarative data transformation."]]}
+{"query": "apple silicon mac development", "intent": "developing for Apple Silicon", "output": [["lex", "\"Apple Silicon\" M1 M2 M3 development -fruit -recipe"], ["lex", "\"arm64\" \"apple silicon\" xcode native -cider"], ["vec", "how to develop and optimize apps for Apple Silicon Macs"], ["hyde", "Apple Silicon Macs use ARM-based chips (M1, M2, M3). Native arm64 builds run fastest. Use Universal binaries to support both architectures."]]}
+{"query": "spring boot dependency injection", "intent": "configuring Spring IoC", "output": [["lex", "\"Spring Boot\" \"dependency injection\" autowired -season -weather"], ["lex", "\"Spring\" IoC container bean \"component scan\""], ["vec", "how does dependency injection work in Spring Boot applications"], ["hyde", "Spring Boot uses IoC container to manage bean lifecycle. Annotate classes with @Component, @Service, or @Repository. Use @Autowired or constructor injection to wire dependencies."]]}
+{"query": "new york city restaurant recommendations", "intent": "finding restaurants in NYC", "output": [["lex", "\"New York City\" restaurant -state -upstate"], ["lex", "\"NYC\" dining \"best restaurants\" food"], ["vec", "top restaurant recommendations in New York City"], ["hyde", "New York City's dining scene ranges from Michelin-starred restaurants to iconic street food. Popular neighborhoods for dining include the West Village, Williamsburg, and Lower East Side."]]}
+{"query": "san francisco hiking trails", "intent": "finding outdoor activities in SF", "output": [["lex", "\"San Francisco\" hiking trails -49ers -football"], ["lex", "\"Bay Area\" hike outdoors \"Golden Gate\""], ["vec", "best hiking trails in and around San Francisco"], ["hyde", "San Francisco offers urban hikes with stunning views. Popular trails include Lands End, Twin Peaks, and the Presidio trails along the Golden Gate Bridge."]]}
+{"query": "natural language processing transformers", "intent": "understanding NLP architectures", "output": [["lex", "\"natural language processing\" transformers -electrical -power"], ["lex", "NLP \"transformer architecture\" attention -robots"], ["vec", "how do transformer models work for natural language processing"], ["hyde", "Transformer models use self-attention mechanisms to process text in parallel rather than sequentially. The architecture includes encoder and decoder stacks with multi-head attention layers."]]}
+{"query": "red black tree implementation", "intent": "implementing a balanced BST", "output": [["lex", "\"red-black tree\" implementation balancing -color -paint"], ["lex", "\"red black\" BST rotation insertion deletion"], ["vec", "how to implement a red-black tree data structure"], ["hyde", "Red-black trees are self-balancing binary search trees. Each node is colored red or black. Rotations and recoloring maintain balance after insertions and deletions."]]}
+{"query": "azure devops pipeline yaml", "intent": "configuring CI/CD in Azure DevOps", "output": [["lex", "\"Azure DevOps\" pipeline yaml -AWS -github"], ["lex", "\"azure-pipelines.yml\" CI CD build stages"], ["vec", "how to configure CI/CD pipelines in Azure DevOps using YAML"], ["hyde", "Azure DevOps pipelines are defined in azure-pipelines.yml. Define stages, jobs, and steps. Use templates for reusable configurations and variable groups for secrets."]]}
+{"query": "terraform state management remote backend", "intent": "managing infrastructure as code", "output": [["lex", "\"terraform state\" \"remote backend\" locking -ansible -chef"], ["lex", "terraform \"state file\" S3 backend \"state lock\""], ["vec", "how to manage Terraform state with a remote backend"], ["hyde", "Terraform state tracks infrastructure resources. Use a remote backend like S3 with DynamoDB locking for team collaboration and state consistency."]]}
+{"query": "visual studio code extensions", "intent": "customizing VS Code", "output": [["lex", "\"Visual Studio Code\" extensions -\"Visual Studio\" -MSVC"], ["lex", "\"VS Code\" plugins marketplace extensions"], ["vec", "best extensions and plugins for Visual Studio Code"], ["hyde", "VS Code extensions add language support, debugging, and productivity features. Install from the marketplace. Popular extensions include Prettier, ESLint, and GitLens."]]}
+{"query": "go concurrency goroutines channels", "intent": "writing concurrent Go code", "output": [["lex", "goroutines channels concurrency -board -game"], ["lex", "\"go routines\" \"channel\" select sync -baduk"], ["vec", "how to use goroutines and channels for concurrency in Go"], ["hyde", "Go handles concurrency with goroutines (lightweight threads) and channels (typed communication pipes). Use select to wait on multiple channels. The sync package provides mutexes."]]}
+{"query": "swift ui declarative interface", "intent": "building iOS interfaces with SwiftUI", "output": [["lex", "\"SwiftUI\" declarative interface -taylor -singer"], ["lex", "SwiftUI view modifier \"state management\""], ["vec", "how to build user interfaces with SwiftUI's declarative syntax"], ["hyde", "SwiftUI is Apple's declarative UI framework. Describe views as structs conforming to the View protocol. Use @State, @Binding, and @Observable for reactive state management."]]}
+{"query": "cross site scripting prevention", "intent": "securing web applications against XSS", "output": [["lex", "\"cross-site scripting\" XSS prevention -CSS -style"], ["lex", "XSS sanitization \"content security policy\" escaping"], ["vec", "how to prevent cross-site scripting vulnerabilities in web applications"], ["hyde", "Prevent XSS by escaping user input before rendering, using Content Security Policy headers, and sanitizing HTML with libraries like DOMPurify."]]}
+{"query": "amazon web services lambda cold start", "intent": "optimizing serverless latency", "output": [["lex", "\"AWS Lambda\" \"cold start\" latency -shopping -retail"], ["lex", "\"Lambda\" warmup provisioned concurrency -calculus"], ["vec", "how to reduce AWS Lambda cold start latency"], ["hyde", "Lambda cold starts occur when a new execution environment is initialized. Reduce them with provisioned concurrency, smaller deployment packages, and choosing faster runtimes like Go or Rust."]]}
+{"query": "monte carlo simulation finance", "intent": "financial modeling with simulation", "output": [["lex", "\"Monte Carlo\" simulation finance pricing -casino -gambling"], ["lex", "\"Monte Carlo\" \"random sampling\" portfolio risk"], ["vec", "how to use Monte Carlo simulation for financial modeling and risk analysis"], ["hyde", "Monte Carlo simulation uses random sampling to model uncertainty in financial outcomes. Generate thousands of scenarios to estimate option prices, portfolio risk, or probability of ruin."]]}
+{"query": "el nino weather patterns", "intent": "understanding climate phenomena", "output": [["lex", "\"El Nino\" weather patterns -la -nina"], ["lex", "\"El Nino\" ENSO climate \"ocean temperature\""], ["vec", "how does El Nino affect global weather patterns"], ["hyde", "El Nino is a climate pattern involving warming of Pacific Ocean surface temperatures. It disrupts normal weather patterns globally, causing droughts in some regions and flooding in others."]]}
+{"query": "hong kong dim sum restaurants", "intent": "finding dim sum in Hong Kong", "output": [["lex", "\"Hong Kong\" \"dim sum\" restaurant -movie -film"], ["lex", "\"Hong Kong\" yum cha brunch Cantonese"], ["vec", "best dim sum restaurants to visit in Hong Kong"], ["hyde", "Hong Kong is famous for its dim sum culture. Traditional yum cha restaurants serve steamed dumplings, buns, and small plates from rolling carts during morning and lunch hours."]]}
+{"query": "type 2 diabetes management diet", "intent": "managing diabetes through nutrition", "output": [["lex", "\"type 2 diabetes\" diet management -\"type 1\" -juvenile"], ["lex", "\"blood sugar\" \"glycemic index\" \"type 2\" nutrition"], ["vec", "dietary management strategies for type 2 diabetes"], ["hyde", "Managing type 2 diabetes through diet involves controlling carbohydrate intake, choosing low glycemic index foods, and maintaining regular meal timing. Focus on whole grains, vegetables, and lean protein."]]}
+{"query": "post traumatic stress disorder treatment", "intent": "treating PTSD", "output": [["lex", "\"PTSD\" treatment therapy -military -veteran"], ["lex", "\"post-traumatic stress\" EMDR CBT \"trauma therapy\""], ["vec", "effective treatments for post-traumatic stress disorder"], ["hyde", "PTSD treatments include cognitive behavioral therapy (CBT), EMDR (eye movement desensitization), and prolonged exposure therapy. Medication like SSRIs can also help manage symptoms."]]}
+{"query": "carbon fiber manufacturing process", "intent": "understanding materials manufacturing", "output": [["lex", "\"carbon fiber\" manufacturing process -bicycle -car"], ["lex", "\"carbon fiber\" autoclave layup \"resin transfer\""], ["vec", "how is carbon fiber manufactured and what are the production steps"], ["hyde", "Carbon fiber is made by carbonizing polyacrylonitrile (PAN) precursor fibers at high temperatures. The process involves stabilization, carbonization, surface treatment, and sizing before weaving into fabrics."]]}
+{"query": "sourdough starter maintenance", "intent": "maintaining a sourdough culture", "output": [["lex", "\"sourdough starter\" maintenance feeding -san -francisco"], ["lex", "\"sourdough\" fermentation discard hydration"], ["vec", "how to maintain and feed a sourdough starter"], ["hyde", "Feed your sourdough starter equal parts flour and water by weight every 12-24 hours at room temperature. Discard half before feeding to maintain a manageable size and healthy yeast population."]]}
+{"query": "french press coffee technique", "intent": "brewing coffee with a french press", "output": [["lex", "\"french press\" coffee technique ratio -journalism -media"], ["lex", "\"french press\" brew time grind coarse"], ["vec", "how to brew coffee with a french press for best results"], ["hyde", "Use coarsely ground coffee at a 1:15 ratio with water just off the boil (200F). Steep for 4 minutes, then press slowly. Preheat the carafe for consistent temperature."]]}
+{"query": "coral reef bleaching climate change", "intent": "understanding marine ecology threats", "output": [["lex", "\"coral bleaching\" \"climate change\" temperature -hair -cosmetic"], ["lex", "\"coral reef\" bleaching warming ocean -aquarium"], ["vec", "how does climate change cause coral reef bleaching"], ["hyde", "Coral bleaching occurs when ocean temperatures rise above normal, causing corals to expel their symbiotic algae. Prolonged bleaching leads to coral death and reef ecosystem collapse."]]}
+{"query": "supply chain disruption risk management", "intent": "managing supply chain risks", "output": [["lex", "\"supply chain\" disruption \"risk management\" -software -devops"], ["lex", "\"supply chain\" resilience diversification contingency"], ["vec", "how to manage supply chain disruption risks"], ["hyde", "Supply chain risk management involves identifying vulnerabilities, diversifying suppliers, maintaining safety stock, and developing contingency plans for disruptions."]]}
+{"query": "real time operating system embedded", "intent": "choosing an OS for embedded systems", "output": [["lex", "\"real-time operating system\" RTOS embedded -desktop -windows"], ["lex", "\"RTOS\" FreeRTOS \"task scheduling\" deterministic"], ["vec", "what is a real-time operating system and when to use one for embedded systems"], ["hyde", "An RTOS guarantees task execution within strict time constraints. Used in embedded systems where timing is critical: automotive, medical devices, and industrial control."]]}
+{"query": "agile scrum sprint planning", "intent": "running effective sprint planning", "output": [["lex", "\"sprint planning\" scrum agile -running -marathon"], ["lex", "\"scrum\" \"story points\" velocity backlog"], ["vec", "how to run effective sprint planning in agile scrum"], ["hyde", "Sprint planning is a scrum ceremony where the team selects work from the backlog for the upcoming sprint. Estimate story points, set the sprint goal, and ensure the team has capacity."]]}
+{"query": "gradient descent optimization neural network", "intent": "training neural networks", "output": [["lex", "\"gradient descent\" optimization \"learning rate\" -hiking -slope"], ["lex", "\"SGD\" \"Adam optimizer\" backpropagation convergence"], ["vec", "how does gradient descent work for optimizing neural networks"], ["hyde", "Gradient descent minimizes the loss function by iteratively updating weights in the direction of steepest descent. Variants include SGD, Adam, and AdaGrad, each with different learning rate strategies."]]}
+{"query": "mercury retrograde astronomy", "intent": "understanding planetary motion", "output": [["lex", "\"Mercury retrograde\" astronomy orbit -astrology -horoscope"], ["lex", "Mercury \"apparent retrograde\" planet -element -thermometer"], ["vec", "what causes Mercury to appear to move backwards in the sky"], ["hyde", "Mercury retrograde is an apparent backward motion caused by differences in orbital speed. As Earth overtakes Mercury's position, the planet appears to reverse direction against the background stars."]]}
+{"query": "silicon valley startup culture", "intent": "understanding tech entrepreneurship", "output": [["lex", "\"Silicon Valley\" startup culture -TV -show -HBO"], ["lex", "\"Silicon Valley\" venture capital entrepreneurship"], ["vec", "what defines the startup culture in Silicon Valley"], ["hyde", "Silicon Valley's startup culture emphasizes rapid iteration, venture capital funding, and disruptive innovation. The ecosystem includes incubators, angel investors, and a tolerance for failure."]]}
+{"query": "long covid symptoms treatment", "intent": "understanding post-COVID recovery", "output": [["lex", "\"long COVID\" symptoms treatment -acute -vaccine"], ["lex", "\"post-COVID\" fatigue \"brain fog\" recovery"], ["vec", "what are the symptoms and treatments for long COVID"], ["hyde", "Long COVID symptoms persist weeks or months after infection and include fatigue, brain fog, shortness of breath, and joint pain. Treatment focuses on symptom management and gradual rehabilitation."]]}
+{"query": "pandas dataframe groupby aggregation", "intent": "analyzing data with pandas", "output": [["lex", "pandas \"groupby\" aggregation dataframe -animal -bear"], ["lex", "pandas \"group by\" agg sum mean \"pivot table\""], ["vec", "how to use groupby and aggregation functions on a pandas DataFrame"], ["hyde", "Use df.groupby('column').agg() to group rows and compute aggregates like sum, mean, or count. Chain multiple aggregations or use named aggregation for clarity."]]}
+{"query": "dead letter queue message processing", "intent": "handling failed messages in queues", "output": [["lex", "\"dead letter queue\" DLQ \"failed messages\" -postal -mail"], ["lex", "\"dead letter\" retry \"message processing\" SQS RabbitMQ"], ["vec", "what is a dead letter queue and how to handle failed messages"], ["hyde", "A dead letter queue captures messages that fail processing after multiple retries. Monitor DLQ depth, set up alerts, and implement reprocessing logic for recoverable failures."]]}
+{"query": "graph database neo4j cypher", "intent": "querying graph databases", "output": [["lex", "\"Neo4j\" cypher \"graph database\" -SQL -relational"], ["lex", "\"graph query\" Neo4j nodes relationships traversal"], ["vec", "how to query a Neo4j graph database using Cypher"], ["hyde", "Cypher is Neo4j's declarative query language. Use MATCH to find patterns, CREATE to add nodes and relationships, and WHERE for filtering. Pattern matching follows (node)-[rel]->(node) syntax."]]}
+{"query": "reverse proxy nginx load balancing", "intent": "configuring nginx for load balancing", "output": [["lex", "\"reverse proxy\" nginx \"load balancing\" -apache -caddy"], ["lex", "nginx upstream \"proxy_pass\" \"load balancer\""], ["vec", "how to configure nginx as a reverse proxy with load balancing"], ["hyde", "Configure nginx upstream blocks to define backend servers. Use proxy_pass in location blocks to forward requests. Load balancing methods include round-robin, least connections, and IP hash."]]}
+{"query": "binary search tree deletion", "intent": "implementing BST operations", "output": [["lex", "\"binary search tree\" deletion algorithm -forest -plant"], ["lex", "BST delete node \"in-order successor\" rebalance"], ["vec", "how to delete a node from a binary search tree"], ["hyde", "BST deletion has three cases: leaf node (remove directly), one child (replace with child), two children (replace with in-order successor or predecessor then delete that node)."]]}
+{"query": "kubernetes helm chart templating", "intent": "packaging Kubernetes deployments", "output": [["lex", "\"Helm chart\" templating kubernetes -sailing -boat"], ["lex", "helm values.yaml \"chart template\" \"go template\""], ["vec", "how to create and customize Kubernetes Helm charts with templates"], ["hyde", "Helm charts use Go templates to generate Kubernetes manifests. Define defaults in values.yaml, override at install time. Use helpers in _helpers.tpl for reusable template fragments."]]}
+{"query": "convolutional neural network image classification", "intent": "understanding CNN architectures", "output": [["lex", "\"convolutional neural network\" CNN \"image classification\" -news -cable"], ["lex", "CNN convolution pooling \"feature extraction\" -journalism"], ["vec", "how do convolutional neural networks classify images"], ["hyde", "CNNs extract features from images using convolutional layers that learn filters for edges, textures, and shapes. Pooling reduces spatial dimensions. Fully connected layers map features to class probabilities."]]}
+{"query": "stock market index fund investing", "intent": "long-term investment strategy", "output": [["lex", "\"index fund\" investing \"stock market\" -day -trading"], ["lex", "\"S&P 500\" \"index fund\" passive \"expense ratio\""], ["vec", "how to invest in stock market index funds for long-term growth"], ["hyde", "Index funds track a market index like the S&P 500 with low fees. They offer broad diversification, consistent returns matching the market, and outperform most active managers over time."]]}
+{"query": "lithium ion battery degradation", "intent": "understanding battery aging", "output": [["lex", "\"lithium-ion\" battery degradation cycle -mining -extraction"], ["lex", "\"Li-ion\" battery \"capacity fade\" aging charging"], ["vec", "what causes lithium-ion batteries to degrade over time"], ["hyde", "Lithium-ion batteries degrade through repeated charge cycles, high temperatures, and deep discharges. Capacity fades as the electrolyte decomposes and lithium gets trapped in the anode."]]}
+{"query": "functional programming monads haskell", "intent": "understanding Haskell abstractions", "output": [["lex", "monads Haskell \"functional programming\" -monastery -monk"], ["lex", "\"monad\" Maybe IO \"do notation\" Haskell"], ["vec", "what are monads in Haskell and how do they work in functional programming"], ["hyde", "Monads in Haskell wrap computations with context (Maybe for failure, IO for effects). They chain operations with >>= (bind) ensuring effects are sequenced and composable."]]}
+{"query": "design patterns factory method", "intent": "applying creational design patterns", "output": [["lex", "\"factory method\" \"design pattern\" creational -manufacturing -industrial"], ["lex", "\"factory pattern\" abstract creator -assembly -plant"], ["vec", "how does the factory method design pattern work and when to use it"], ["hyde", "The factory method pattern defines an interface for creating objects but lets subclasses decide which class to instantiate. It promotes loose coupling by separating creation from usage."]]}
+{"query": "protocol buffers grpc serialization", "intent": "using efficient RPC serialization", "output": [["lex", "\"Protocol Buffers\" protobuf gRPC -REST -JSON"], ["lex", "\"gRPC\" proto3 serialization \"service definition\""], ["vec", "how to use Protocol Buffers with gRPC for efficient serialization"], ["hyde", "Protocol Buffers define message schemas in .proto files. gRPC uses them for RPC service definitions. protoc generates client and server code. Binary format is smaller and faster than JSON."]]}
+{"query": "chaos engineering resilience testing", "intent": "testing system reliability", "output": [["lex", "\"chaos engineering\" resilience testing -theory -physics"], ["lex", "\"chaos monkey\" \"fault injection\" \"game day\" -random"], ["vec", "how to practice chaos engineering to test system resilience"], ["hyde", "Chaos engineering deliberately injects failures into production systems to verify resilience. Start with hypotheses about expected behavior, then run controlled experiments to find weaknesses."]]}
+{"query": "event sourcing CQRS architecture", "intent": "implementing event-driven systems", "output": [["lex", "\"event sourcing\" CQRS architecture -calendar -planning"], ["lex", "\"event store\" \"command query\" projection -party"], ["vec", "how to implement event sourcing with CQRS architecture pattern"], ["hyde", "Event sourcing stores state changes as immutable events rather than current state. CQRS separates read and write models. Commands produce events, projections build read-optimized views from the event stream."]]}
+{"query": "zero trust network architecture", "intent": "securing network infrastructure", "output": [["lex", "\"zero trust\" network architecture -social -faith"], ["lex", "\"zero trust\" microsegmentation \"identity verification\" -religion"], ["vec", "what is zero trust network architecture and how to implement it"], ["hyde", "Zero trust assumes no implicit trust for any user or device. Every access request is verified regardless of network location. Implement with identity verification, microsegmentation, and least-privilege access."]]}
+{"query": "service mesh istio microservices", "intent": "managing microservice communication", "output": [["lex", "\"service mesh\" Istio microservices -fabric -textile"], ["lex", "Istio sidecar \"traffic management\" -yoga -meditation"], ["vec", "how to use Istio service mesh for microservices communication"], ["hyde", "Istio injects sidecar proxies alongside each microservice to handle traffic routing, load balancing, and mTLS. It provides observability, security, and traffic management without application code changes."]]}
+{"query": "principal component analysis dimensionality reduction", "intent": "reducing data dimensions", "output": [["lex", "\"principal component analysis\" PCA -school -administrator"], ["lex", "PCA \"dimensionality reduction\" eigenvalue variance"], ["vec", "how does PCA reduce dimensions in high-dimensional data"], ["hyde", "PCA finds orthogonal axes of maximum variance in data. Project data onto the top k principal components to reduce dimensions while preserving the most information."]]}
+{"query": "los angeles traffic congestion solutions", "intent": "addressing urban transportation", "output": [["lex", "\"Los Angeles\" traffic congestion -movie -Hollywood"], ["lex", "\"LA\" freeway commute \"public transit\" metro"], ["vec", "solutions for traffic congestion problems in Los Angeles"], ["hyde", "Los Angeles traffic congestion stems from car-dependent infrastructure and sprawl. Solutions include expanding Metro rail, improving bus rapid transit, congestion pricing, and transit-oriented development."]]}
+{"query": "blue green deployment zero downtime", "intent": "deploying without downtime", "output": [["lex", "\"blue-green deployment\" \"zero downtime\" -color -paint"], ["lex", "\"blue green\" deployment rollback cutover -art"], ["vec", "how to implement blue-green deployments for zero-downtime releases"], ["hyde", "Blue-green deployment runs two identical production environments. Route traffic to blue (current), deploy to green (new). After validation, switch the router to green. Rollback by switching back to blue."]]}
+{"query": "rio de janeiro carnival festival", "intent": "learning about Brazilian culture", "output": [["lex", "\"Rio de Janeiro\" carnival festival -movie -animation"], ["lex", "\"Rio\" carnival samba parade \"Sambodromo\""], ["vec", "what is the Rio de Janeiro carnival festival and when does it happen"], ["hyde", "Rio's Carnival is a massive annual festival before Lent featuring samba school parades at the Sambodromo, street parties called blocos, and elaborate costumes. It typically runs for five days."]]}
+{"query": "object relational mapping hibernate", "intent": "mapping Java objects to databases", "output": [["lex", "\"Hibernate\" ORM \"object-relational mapping\" -sleep -bear"], ["lex", "Hibernate JPA \"entity mapping\" \"lazy loading\""], ["vec", "how to use Hibernate ORM for database access in Java"], ["hyde", "Hibernate maps Java objects to database tables using annotations or XML. It handles SQL generation, caching, and lazy loading. JPA is the standard interface that Hibernate implements."]]}
+{"query": "social security retirement benefits", "intent": "understanding retirement planning", "output": [["lex", "\"Social Security\" retirement benefits -cyber -network"], ["lex", "\"Social Security\" \"full retirement age\" -hacking -breach"], ["vec", "how do Social Security retirement benefits work and when to claim"], ["hyde", "Social Security retirement benefits are based on your highest 35 years of earnings. Full retirement age is 66-67 depending on birth year. Claiming early at 62 reduces benefits permanently."]]}
+{"query": "differential equation numerical methods", "intent": "solving differential equations numerically", "output": [["lex", "\"differential equation\" \"numerical methods\" solver -personality -psychology"], ["lex", "ODE \"Runge-Kutta\" \"Euler method\" numerical"], ["vec", "numerical methods for solving differential equations"], ["hyde", "Numerical methods approximate solutions to differential equations through discretization. Euler's method is simplest but inaccurate. Runge-Kutta methods (RK4) offer better accuracy per step."]]}
+{"query": "cross platform mobile development flutter", "intent": "building mobile apps with Flutter", "output": [["lex", "\"Flutter\" \"cross-platform\" mobile -butterfly -insect"], ["lex", "Flutter Dart widget \"hot reload\" -React -Native"], ["vec", "how to build cross-platform mobile apps using Flutter"], ["hyde", "Flutter uses Dart to build native-compiled apps for iOS and Android from a single codebase. Its widget system provides a rich UI toolkit with hot reload for fast development."]]}
+{"query": "renewable energy solar panel efficiency", "intent": "evaluating solar energy", "output": [["lex", "\"solar panel\" efficiency renewable -space -satellite"], ["lex", "\"photovoltaic\" efficiency \"solar cell\" -solar -system"], ["vec", "how efficient are solar panels and what affects their performance"], ["hyde", "Modern solar panels achieve 20-25% efficiency for residential installations. Efficiency depends on cell technology, temperature, shading, angle, and panel degradation over time."]]}
+{"query": "great barrier reef conservation", "intent": "protecting marine ecosystems", "output": [["lex", "\"Great Barrier Reef\" conservation protection -gaming -level"], ["lex", "\"Great Barrier Reef\" marine preservation -aquarium"], ["vec", "conservation efforts to protect the Great Barrier Reef"], ["hyde", "The Great Barrier Reef faces threats from coral bleaching, ocean acidification, and pollution. Conservation efforts include marine protected areas, water quality improvement, and coral restoration programs."]]}
+{"query": "attention mechanism transformer architecture", "intent": "understanding transformer internals", "output": [["lex", "\"attention mechanism\" transformer architecture -ADHD -focus"], ["lex", "\"self-attention\" \"multi-head\" \"query key value\" -electrical"], ["vec", "how does the attention mechanism work in transformer architecture"], ["hyde", "Self-attention computes relevance scores between all pairs of tokens using query, key, and value projections. Multi-head attention runs multiple parallel attention functions for richer representations."]]}
+{"query": "write ahead log database recovery", "intent": "understanding database durability", "output": [["lex", "\"write-ahead log\" WAL database recovery -diary -journal"], ["lex", "WAL \"crash recovery\" \"transaction log\" checkpoint"], ["vec", "how does write-ahead logging enable database crash recovery"], ["hyde", "Write-ahead logging writes changes to a log before modifying data pages. On crash, replay the WAL to restore committed transactions and undo incomplete ones, ensuring durability and consistency."]]}
+{"query": "middle earth tolkien geography", "intent": "exploring Tolkien's fictional world", "output": [["lex", "\"Middle-earth\" Tolkien geography map -real -actual"], ["lex", "\"Lord of the Rings\" Tolkien \"Shire\" \"Mordor\" map"], ["vec", "geography and map of Middle-earth from Tolkien's works"], ["hyde", "Middle-earth's geography spans from the Shire in the northwest to Mordor in the southeast. Key regions include Rohan's plains, Gondor's kingdom, Mirkwood forest, and the Misty Mountains."]]}

+ 50 - 0
finetune/data/qmd_expansion_personal_entities.jsonl

@@ -0,0 +1,50 @@
+{"query": "meeting with Bob about C++", "intent": "discussing C++ implementation details", "output": [["hyde", "Bob and I discussed C++ implementation details during our meeting, covering template metaprogramming and memory management."], ["lex", "Bob \"C++\" meeting"], ["lex", "Bob C++ discussion notes"], ["vec", "meeting notes with Bob about C++ programming"], ["vec", "Bob's discussion about C++ implementation"]]}
+{"query": "Sarah's presentation on Q4 goals", "intent": "reviewing quarterly objectives", "output": [["hyde", "Sarah presented the Q4 goals to the team, outlining revenue targets, product milestones, and hiring plans for the quarter."], ["lex", "Sarah Q4 goals presentation"], ["lex", "Sarah \"Q4\" quarterly goals slides"], ["vec", "Sarah's presentation about Q4 quarterly goals"], ["vec", "Q4 goals and objectives presented by Sarah"]]}
+{"query": "email from Dave about the deployment issue", "intent": "tracking a production deployment problem", "output": [["hyde", "Dave emailed about the production deployment failure, noting that the database migration timed out and rollback was needed."], ["lex", "Dave deployment issue email"], ["lex", "Dave email deploy problem"], ["vec", "email from Dave about the deployment issue"], ["vec", "Dave's message about production deployment problems"]]}
+{"query": "Alex's proposal for switching to TypeScript", "intent": "evaluating a language migration", "output": [["hyde", "Alex proposed migrating our frontend codebase from JavaScript to TypeScript for better type safety and developer experience."], ["lex", "Alex TypeScript proposal migration"], ["lex", "Alex \"TypeScript\" switch proposal"], ["vec", "Alex's proposal to migrate to TypeScript"], ["vec", "TypeScript migration plan proposed by Alex"]]}
+{"query": "conversation with Lisa about the design mockups", "intent": "reviewing UI design progress", "output": [["hyde", "Lisa walked me through the updated design mockups for the new dashboard, including the navigation redesign and responsive layouts."], ["lex", "Lisa design mockups conversation"], ["lex", "Lisa mockups dashboard design"], ["vec", "conversation with Lisa about design mockups"], ["vec", "Lisa's feedback on the design mockup revisions"]]}
+{"query": "standup notes from the Platform team", "intent": "tracking daily team progress", "output": [["hyde", "Platform team standup covered the API gateway migration, database upgrade progress, and the new monitoring rollout."], ["lex", "\"Platform team\" standup notes"], ["lex", "Platform standup daily meeting"], ["vec", "standup meeting notes from the Platform team"], ["vec", "Platform team daily standup updates"]]}
+{"query": "Mike's feedback on the API design doc", "intent": "incorporating review feedback", "output": [["hyde", "Mike reviewed the API design document and suggested using pagination for list endpoints and adding rate limiting headers."], ["lex", "Mike API design doc feedback"], ["lex", "Mike \"API design\" review"], ["vec", "Mike's feedback and comments on the API design document"], ["vec", "API design document review from Mike"]]}
+{"query": "meeting with Jennifer about the hiring pipeline", "intent": "managing engineering recruitment", "output": [["hyde", "Jennifer and I reviewed the engineering hiring pipeline. We have 12 candidates in the interview loop and need to speed up the offer stage."], ["lex", "Jennifer hiring pipeline meeting"], ["lex", "Jennifer interview hiring discussion"], ["vec", "meeting with Jennifer about engineering hiring pipeline"], ["vec", "Jennifer's update on the hiring and interview process"]]}
+{"query": "Tom's analysis of the performance regression", "intent": "debugging a performance issue", "output": [["hyde", "Tom traced the performance regression to a missing database index on the users table that was dropped during the last migration."], ["lex", "Tom \"performance regression\" analysis"], ["lex", "Tom performance issue investigation"], ["vec", "Tom's root cause analysis of the performance regression"], ["vec", "performance regression investigation by Tom"]]}
+{"query": "Rachel's notes on the vendor evaluation", "intent": "comparing vendor options", "output": [["hyde", "Rachel evaluated three vendors for our logging infrastructure: Datadog, Splunk, and Grafana Cloud. She recommended Datadog for cost and features."], ["lex", "Rachel vendor evaluation notes"], ["lex", "Rachel vendor comparison assessment"], ["vec", "Rachel's notes from the vendor evaluation process"], ["vec", "vendor evaluation and comparison by Rachel"]]}
+{"query": "discussion with Chris about the database migration", "intent": "planning infrastructure changes", "output": [["hyde", "Chris outlined the plan to migrate from MySQL to PostgreSQL. The migration will happen in phases starting with the read replicas."], ["lex", "Chris database migration discussion"], ["lex", "Chris MySQL PostgreSQL migration"], ["vec", "discussion with Chris about the database migration plan"], ["vec", "Chris's database migration strategy and timeline"]]}
+{"query": "email thread with Maria about the contract renewal", "intent": "managing vendor relationships", "output": [["hyde", "Maria forwarded the updated contract terms from the vendor. The renewal includes a 15% price increase but adds premium support."], ["lex", "Maria contract renewal email"], ["lex", "Maria vendor contract thread"], ["vec", "email thread with Maria about the contract renewal terms"], ["vec", "Maria's correspondence about vendor contract renewal"]]}
+{"query": "Kevin's demo of the new search feature", "intent": "reviewing a feature demo", "output": [["hyde", "Kevin demoed the new full-text search feature with autocomplete, faceted filters, and highlighted results. Ships next sprint."], ["lex", "Kevin demo search feature"], ["lex", "Kevin \"search feature\" demo presentation"], ["vec", "Kevin's demonstration of the new search feature"], ["vec", "new search feature demo presented by Kevin"]]}
+{"query": "meeting with Priya about the budget review", "intent": "reviewing financial planning", "output": [["hyde", "Priya walked through the Q3 budget actuals versus projections. Infrastructure costs were 20% over budget due to the traffic spike."], ["lex", "Priya budget review meeting"], ["lex", "Priya \"budget review\" Q3 financials"], ["vec", "meeting with Priya about the quarterly budget review"], ["vec", "Priya's budget review and cost analysis"]]}
+{"query": "Daniel's incident report on the outage", "intent": "reviewing a production incident", "output": [["hyde", "Daniel wrote the postmortem for Tuesday's outage. Root cause was a misconfigured load balancer health check that caused cascading failures."], ["lex", "Daniel incident report outage"], ["lex", "Daniel outage postmortem \"incident report\""], ["vec", "Daniel's incident report about the production outage"], ["vec", "outage postmortem and incident report from Daniel"]]}
+{"query": "brainstorm with Emma about the onboarding flow", "intent": "improving user experience", "output": [["hyde", "Emma and I brainstormed improvements to the user onboarding flow, including progressive profiling, interactive tutorials, and a simpler setup wizard."], ["lex", "Emma onboarding flow brainstorm"], ["lex", "Emma \"onboarding\" UX brainstorm"], ["vec", "brainstorming session with Emma about the onboarding flow"], ["vec", "Emma's ideas for improving user onboarding experience"]]}
+{"query": "James asked about the deploy process", "intent": "knowledge sharing on deployments", "output": [["hyde", "James asked how our deployment process works. I walked him through the CI pipeline, staging environment, and production rollout procedure."], ["lex", "James deploy process question"], ["lex", "James deployment procedure"], ["vec", "James asking about the deployment process"], ["vec", "deployment process explanation for James"]]}
+{"query": "notes from the Project Atlas kickoff", "intent": "tracking project initiation", "output": [["hyde", "Project Atlas kickoff meeting covered scope, timeline, and team allocation. Target launch is end of Q2 with a beta in March."], ["lex", "\"Project Atlas\" kickoff notes"], ["lex", "\"Project Atlas\" meeting launch"], ["vec", "kickoff meeting notes for Project Atlas"], ["vec", "Project Atlas project kickoff and planning notes"]]}
+{"query": "feedback from the Horizon team retro", "intent": "improving team processes", "output": [["hyde", "The Horizon team retrospective identified slow code reviews and unclear requirements as the top two issues. Action items assigned to leads."], ["lex", "\"Horizon team\" retro feedback"], ["lex", "Horizon retrospective improvement"], ["vec", "feedback and action items from the Horizon team retrospective"], ["vec", "Horizon team retrospective meeting notes and outcomes"]]}
+{"query": "conversation with Yuki about the localization effort", "intent": "planning internationalization", "output": [["hyde", "Yuki outlined the plan to localize the product into Japanese and Korean. She needs string extraction completed by Friday for the translation vendor."], ["lex", "Yuki localization effort conversation"], ["lex", "Yuki localization i18n translation"], ["vec", "conversation with Yuki about product localization"], ["vec", "Yuki's plan for the localization and translation effort"]]}
+{"query": "Marcus's review of the security audit findings", "intent": "addressing security issues", "output": [["hyde", "Marcus reviewed the third-party security audit. Critical findings include exposed admin endpoints and weak session token generation."], ["lex", "Marcus security audit review"], ["lex", "Marcus \"security audit\" findings"], ["vec", "Marcus's review of the security audit results"], ["vec", "security audit findings reviewed by Marcus"]]}
+{"query": "sync with Laura about customer escalations", "intent": "managing customer issues", "output": [["hyde", "Laura briefed me on three priority customer escalations: data export timeout for Acme Corp, billing discrepancy for TechStart, and API rate limit increase for GlobalTech."], ["lex", "Laura customer escalations sync"], ["lex", "Laura \"customer escalation\" priority"], ["vec", "sync meeting with Laura about customer escalations"], ["vec", "Laura's update on priority customer escalation cases"]]}
+{"query": "one on one with Nathan about career growth", "intent": "supporting career development", "output": [["hyde", "Nathan and I discussed his career development goals. He wants to move into a tech lead role and is interested in the architecture track."], ["lex", "Nathan \"career growth\" 1-on-1"], ["lex", "Nathan career development meeting"], ["vec", "one-on-one with Nathan about career growth and development"], ["vec", "Nathan's career goals and growth discussion"]]}
+{"query": "Emily's update on the data pipeline refactor", "intent": "tracking infrastructure work", "output": [["hyde", "Emily reported that the data pipeline refactor is 70% complete. The new Spark jobs are running 3x faster but the Airflow DAGs still need updating."], ["lex", "Emily \"data pipeline\" refactor update"], ["lex", "Emily pipeline Spark Airflow progress"], ["vec", "Emily's progress update on the data pipeline refactor"], ["vec", "data pipeline refactor status from Emily"]]}
+{"query": "meeting with Ahmed about the mobile app launch", "intent": "planning a product launch", "output": [["hyde", "Ahmed presented the mobile app launch timeline. Beta TestFlight goes out Monday, app store submission on Wednesday, and public launch next Friday."], ["lex", "Ahmed \"mobile app\" launch meeting"], ["lex", "Ahmed app launch timeline"], ["vec", "meeting with Ahmed about the mobile app launch plan"], ["vec", "Ahmed's timeline for the mobile app launch"]]}
+{"query": "Sophia's research on competitor pricing", "intent": "analyzing market positioning", "output": [["hyde", "Sophia analyzed competitor pricing across five direct competitors. Our mid-tier plan is priced 20% higher than average but includes more features."], ["lex", "Sophia competitor pricing research"], ["lex", "Sophia \"competitor analysis\" pricing"], ["vec", "Sophia's research and analysis of competitor pricing"], ["vec", "competitive pricing analysis done by Sophia"]]}
+{"query": "discussion with Carlos about the API rate limits", "intent": "adjusting service configuration", "output": [["hyde", "Carlos proposed increasing the default API rate limit from 100 to 500 requests per minute for paying customers, with burst handling."], ["lex", "Carlos \"API rate limit\" discussion"], ["lex", "Carlos rate limit increase proposal"], ["vec", "discussion with Carlos about API rate limit changes"], ["vec", "Carlos's proposal for adjusting API rate limits"]]}
+{"query": "retro notes from Sprint 23", "intent": "reviewing sprint outcomes", "output": [["hyde", "Sprint 23 retrospective: what went well was the quick bug turnaround. What to improve was the unclear acceptance criteria on feature tickets."], ["lex", "\"Sprint 23\" retro notes"], ["lex", "\"Sprint 23\" retrospective feedback"], ["vec", "retrospective notes from Sprint 23"], ["vec", "Sprint 23 team retrospective outcomes and action items"]]}
+{"query": "conversation with Diana about the accessibility audit", "intent": "addressing accessibility compliance", "output": [["hyde", "Diana shared the accessibility audit results. Twenty-three WCAG AA violations found, mostly missing alt text and insufficient color contrast."], ["lex", "Diana accessibility audit conversation"], ["lex", "Diana WCAG \"accessibility audit\""], ["vec", "conversation with Diana about the accessibility audit findings"], ["vec", "Diana's accessibility audit results and recommendations"]]}
+{"query": "Omar's prototype for the recommendation engine", "intent": "evaluating a new feature prototype", "output": [["hyde", "Omar built a prototype recommendation engine using collaborative filtering. Initial results show a 15% improvement in click-through rate on test data."], ["lex", "Omar prototype \"recommendation engine\""], ["lex", "Omar recommendation algorithm prototype"], ["vec", "Omar's prototype for the product recommendation engine"], ["vec", "recommendation engine prototype built by Omar"]]}
+{"query": "planning meeting for the Falcon release", "intent": "coordinating a release schedule", "output": [["hyde", "The Falcon release planning meeting set the feature freeze for March 15 and the GA date for April 1. Three blockers need resolution this week."], ["lex", "\"Falcon release\" planning meeting"], ["lex", "Falcon release timeline blockers"], ["vec", "planning meeting for the Falcon product release"], ["vec", "Falcon release planning and timeline discussion"]]}
+{"query": "Aisha's presentation on the A/B test results", "intent": "reviewing experiment outcomes", "output": [["hyde", "Aisha presented the A/B test results for the new checkout flow. Variant B showed a 12% conversion lift with statistical significance."], ["lex", "Aisha \"A/B test\" results presentation"], ["lex", "Aisha experiment checkout conversion"], ["vec", "Aisha's presentation on the A/B test experiment results"], ["vec", "A/B test results and analysis presented by Aisha"]]}
+{"query": "one on one with Ryan about team dynamics", "intent": "improving team collaboration", "output": [["hyde", "Ryan raised concerns about communication between the frontend and backend squads. We agreed to introduce a weekly sync between the two teams."], ["lex", "Ryan \"team dynamics\" 1-on-1"], ["lex", "Ryan team communication meeting"], ["vec", "one-on-one with Ryan about team dynamics and collaboration"], ["vec", "Ryan's concerns about team dynamics and communication"]]}
+{"query": "notes from the board meeting with investors", "intent": "tracking strategic decisions", "output": [["hyde", "Board meeting covered Q3 financial results, Series B fundraising timeline, and the product roadmap for 2025. Investors asked about path to profitability."], ["lex", "board meeting investors notes"], ["lex", "\"board meeting\" investor quarterly"], ["vec", "notes from the board meeting with investors"], ["vec", "investor board meeting notes and key discussion points"]]}
+{"query": "Mei-Lin's proposal for the intern program", "intent": "planning an internship structure", "output": [["hyde", "Mei-Lin proposed a structured 12-week intern program with mentorship pairing, weekly tech talks, and a capstone project presentation at the end."], ["lex", "Mei-Lin intern program proposal"], ["lex", "Mei-Lin \"intern program\" structure"], ["vec", "Mei-Lin's proposal for the engineering intern program"], ["vec", "intern program structure proposed by Mei-Lin"]]}
+{"query": "conversation with Raj about migrating to Kubernetes", "intent": "planning infrastructure migration", "output": [["hyde", "Raj outlined a phased Kubernetes migration: start with stateless services, then move databases with persistent volumes, and finally sunset the old EC2 instances."], ["lex", "Raj Kubernetes migration conversation"], ["lex", "Raj \"Kubernetes\" migration plan"], ["vec", "conversation with Raj about migrating infrastructure to Kubernetes"], ["vec", "Raj's plan for the Kubernetes migration"]]}
+{"query": "weekly sync with the Growth team", "intent": "tracking growth initiatives", "output": [["hyde", "Growth team weekly sync covered the new referral program performance, email campaign results, and the upcoming product-led growth experiment."], ["lex", "\"Growth team\" weekly sync"], ["lex", "Growth team meeting updates"], ["vec", "weekly sync meeting notes with the Growth team"], ["vec", "Growth team weekly meeting updates and priorities"]]}
+{"query": "Ivan's analysis of user churn data", "intent": "understanding user retention", "output": [["hyde", "Ivan analyzed user churn patterns and found that users who don't complete onboarding within 24 hours have a 60% higher churn rate."], ["lex", "Ivan churn data analysis"], ["lex", "Ivan \"user churn\" retention analysis"], ["vec", "Ivan's analysis of user churn data and patterns"], ["vec", "user churn analysis and insights from Ivan"]]}
+{"query": "chat with Nora about the new CI pipeline", "intent": "improving developer tooling", "output": [["hyde", "Nora set up the new GitHub Actions CI pipeline with parallel test suites, caching, and automatic preview deployments for pull requests."], ["lex", "Nora CI pipeline chat"], ["lex", "Nora \"CI pipeline\" \"GitHub Actions\""], ["vec", "chat with Nora about the new CI pipeline setup"], ["vec", "Nora's work on the new CI/CD pipeline"]]}
+{"query": "handoff notes from Victor before his vacation", "intent": "managing work continuity", "output": [["hyde", "Victor's handoff notes cover three in-progress PRs, the pending security patch deployment, and the customer demo scheduled for Thursday."], ["lex", "Victor handoff notes vacation"], ["lex", "Victor handoff \"before vacation\""], ["vec", "handoff notes from Victor before his vacation"], ["vec", "Victor's transition notes and pending items before time off"]]}
+{"query": "feedback from the usability testing with Acme Corp", "intent": "incorporating user feedback", "output": [["hyde", "Usability testing with Acme Corp users revealed confusion around the permissions model and a request for bulk import functionality."], ["lex", "\"Acme Corp\" usability testing feedback"], ["lex", "\"Acme Corp\" user testing results"], ["vec", "feedback from usability testing sessions with Acme Corp"], ["vec", "Acme Corp usability testing findings and user feedback"]]}
+{"query": "meeting with the Design Systems team about tokens", "intent": "evolving the design system", "output": [["hyde", "The Design Systems team presented their new design token architecture with semantic naming, dark mode support, and automatic documentation generation."], ["lex", "\"Design Systems\" team tokens meeting"], ["lex", "\"design tokens\" meeting \"Design Systems\""], ["vec", "meeting with the Design Systems team about design tokens"], ["vec", "Design Systems team discussion about design token architecture"]]}
+{"query": "pair programming session with Kai on the auth refactor", "intent": "collaborative code improvement", "output": [["hyde", "Kai and I pair programmed on the auth refactor, extracting the session management into a dedicated service and adding refresh token rotation."], ["lex", "Kai \"pair programming\" auth refactor"], ["lex", "Kai auth refactor session"], ["vec", "pair programming session with Kai on the authentication refactor"], ["vec", "Kai's collaboration on the auth service refactoring"]]}
+{"query": "lunch conversation with Pat about Rust at Stripe", "intent": "discussing Rust adoption at a company", "output": [["hyde", "Pat mentioned Stripe is using Rust for some performance-critical services. They have seen significant latency improvements in their payment processing path."], ["lex", "Pat Rust Stripe conversation"], ["lex", "Pat \"Rust\" \"Stripe\" discussion"], ["vec", "conversation with Pat about Rust usage at Stripe"], ["vec", "Pat's insights about Rust adoption at Stripe"]]}
+{"query": "Ada's writeup on the CDN migration", "intent": "documenting infrastructure changes", "output": [["hyde", "Ada documented the CDN migration from CloudFront to Fastly, including performance benchmarks, configuration differences, and the rollout plan."], ["lex", "Ada CDN migration writeup"], ["lex", "Ada \"CDN migration\" CloudFront Fastly"], ["vec", "Ada's writeup and documentation on the CDN migration"], ["vec", "CDN migration documentation authored by Ada"]]}
+{"query": "workshop notes from the team offsite in Portland", "intent": "capturing offsite planning outcomes", "output": [["hyde", "The Portland offsite workshop focused on team OKRs for H2, architecture vision for 2026, and cross-team collaboration improvements."], ["lex", "Portland offsite workshop notes"], ["lex", "\"team offsite\" Portland workshop"], ["vec", "workshop notes from the team offsite in Portland"], ["vec", "Portland team offsite workshop outcomes and planning"]]}
+{"query": "Tara's RFC on the event-driven architecture", "intent": "evaluating an architecture proposal", "output": [["hyde", "Tara's RFC proposes migrating from synchronous REST calls to an event-driven architecture using Kafka for inter-service communication."], ["lex", "Tara RFC \"event-driven architecture\""], ["lex", "Tara RFC Kafka \"event driven\""], ["vec", "Tara's RFC proposing event-driven architecture migration"], ["vec", "event-driven architecture RFC written by Tara"]]}
+{"query": "call with Jordan from customer success about renewals", "intent": "managing enterprise renewals", "output": [["hyde", "Jordan from customer success flagged three enterprise accounts at risk of non-renewal. Main concerns are missing API features and support response times."], ["lex", "Jordan \"customer success\" renewals call"], ["lex", "Jordan renewal risk enterprise"], ["vec", "call with Jordan from customer success about renewal risks"], ["vec", "Jordan's update on enterprise customer renewals"]]}
+{"query": "discussion with Zara about the testing strategy", "intent": "improving QA approach", "output": [["hyde", "Zara proposed a new testing pyramid: more unit tests, fewer E2E tests, and contract tests between services to catch integration issues earlier."], ["lex", "Zara \"testing strategy\" discussion"], ["lex", "Zara testing pyramid E2E unit"], ["vec", "discussion with Zara about the testing strategy overhaul"], ["vec", "Zara's proposed testing strategy and approach"]]}
+{"query": "follow up with Sam on the billing discrepancy", "intent": "resolving a billing issue", "output": [["hyde", "Sam investigated the billing discrepancy for the enterprise plan. The issue was double-counting usage during the timezone boundary at midnight UTC."], ["lex", "Sam billing discrepancy follow-up"], ["lex", "Sam \"billing\" issue investigation"], ["vec", "follow-up with Sam about the billing discrepancy"], ["vec", "Sam's investigation into the billing discrepancy"]]}

+ 24 - 0
finetune/evals/queries.txt

@@ -47,6 +47,30 @@ how to implement caching with redis in nodejs
 best practices for api rate limiting
 setting up ci cd pipeline with github actions
 
+# Personal entity preservation (issue #247: entity stripping)
+# Model MUST preserve person names in lex and vec output
+meeting with Bob about C++
+Sarah's presentation on Q4 goals
+email from Dave about the deployment issue
+notes from the Project Atlas kickoff
+feedback from the Horizon team retro
+conversation with Lisa about the design mockups
+
+# Quoted phrases (issue #247: lex phrase syntax)
+# Model should use "quoted phrases" for multi-word proper nouns in lex
+natural language processing transformers
+monte carlo simulation finance
+cross site scripting prevention
+visual studio code extensions
+principal component analysis dimensionality reduction
+
+# Negation / disambiguation (issue #247: lex negation syntax)
+# Model should use -term to exclude related-but-wrong results in lex
+rust ownership and borrowing
+java stream api filtering
+apple silicon mac development
+python web scraping beautiful soup
+
 # /only: mode tests - should output ONLY the requested type
 auth /only:lex
 React hooks tutorial /only:lex

+ 68 - 5
finetune/reward.py

@@ -39,6 +39,31 @@ KEY_TERM_STOPWORDS = frozenset({
     'what', 'is', 'how', 'to', 'the', 'a', 'an', 'in', 'on', 'for', 'of',
     'and', 'or', 'with', 'my', 'your', 'do', 'does', 'can', 'i', 'me', 'we',
     'who', 'where', 'when', 'why', 'which', 'find', 'get', 'show', 'tell',
+    'about', 'from', 'into', 'between', 'through', 'during', 'after',
+    'before', 'like', 'than', 'then', 'that', 'this', 'their', 'its',
+    'was', 'were', 'has', 'had', 'been', 'being', 'have', 'not', 'but',
+    'just', 'also', 'very', 'so', 'if', 'at', 'by', 'up', 'out', 'all',
+    'some', 'any', 'no', 'each', 'every', 'both', 'few', 'more', 'most',
+    'other', 'only', 'same', 'such', 'here', 'there', 'asked', 'said',
+    'notes', 'meeting', 'email', 'discussion', 'conversation', 'call',
+})
+
+# Words that commonly start queries but aren't named entities.
+# Used for position-0 entity detection to avoid false positives.
+QUERY_VERB_STOPWORDS = frozenset({
+    'configure', 'setup', 'install', 'build', 'create', 'make', 'run',
+    'start', 'stop', 'check', 'test', 'debug', 'fix', 'update', 'change',
+    'add', 'remove', 'delete', 'use', 'using', 'need', 'want', 'should',
+    'would', 'could', 'help', 'please', 'best', 'good', 'new', 'old',
+    'latest', 'recent', 'setting', 'settings', 'compare', 'comparing',
+    'implement', 'implementing', 'deploy', 'deploying', 'migrate',
+    'migrating', 'optimize', 'optimizing', 'understand', 'understanding',
+    'explain', 'list', 'describe', 'define', 'convert', 'connecting',
+    'performance', 'overview', 'introduction', 'tutorial', 'example',
+    'difference', 'between', 'about', 'review', 'resolve', 'resolving',
+    'troubleshoot', 'troubleshooting', 'monitor', 'monitoring', 'manage',
+    'managing', 'enable', 'disable', 'set', 'write', 'read', 'search',
+    'possible', 'common', 'typical', 'recommended', 'alternative',
 })
 
 GENERIC_LEX_PHRASES = frozenset({
@@ -111,9 +136,12 @@ def clean_model_output(text: str) -> tuple[str, bool]:
 def extract_named_entities(query: str) -> set:
     """Extract named entities using heuristics.
 
-    Detects: ALL-CAPS acronyms (TDS, API), capitalized proper nouns (React),
+    Detects: ALL-CAPS acronyms (TDS, API), capitalized proper nouns (React, Bob),
     technical terms with special chars (node.js, C++), CamelCase (JavaScript),
     and compound names (TDS motorsports -> both words).
+
+    Position-0 words are also detected as entities if they are capitalized and
+    not common query-starting verbs (e.g. "Bob asked about deploy" -> "bob").
     """
     entities = set()
     words = query.split()
@@ -127,18 +155,29 @@ def extract_named_entities(query: str) -> set:
 
         is_entity = False
 
+        # ALL-CAPS acronyms: TDS, API, GPU, AWS
         if clean.isupper() and len(clean) >= 2:
             entities.add(clean.lower())
             is_entity = True
-        elif i > 0 and clean[0].isupper() and clean.lower() not in KEY_TERM_STOPWORDS:
-            entities.add(clean.lower())
-            is_entity = True
+        # Capitalized proper nouns (any position, including first word)
+        elif clean[0].isupper() and clean.lower() not in KEY_TERM_STOPWORDS:
+            if i > 0:
+                # Non-first words: always treat as entity
+                entities.add(clean.lower())
+                is_entity = True
+            elif clean.lower() not in QUERY_VERB_STOPWORDS:
+                # First word: also entity if not a common query verb
+                entities.add(clean.lower())
+                is_entity = True
+        # Technical terms with special chars: node.js, C++, .NET
         elif any(c in clean for c in '.+-#@') and len(clean) >= 2:
             entities.add(clean.lower())
             is_entity = True
+        # CamelCase: JavaScript, TypeScript
         elif len(clean) > 1 and any(c.isupper() for c in clean[1:]) and clean[0].isupper():
             entities.add(clean.lower())
             is_entity = True
+        # Compound names: word following an entity (TDS motorsports)
         elif prev_was_entity and clean.lower() not in KEY_TERM_STOPWORDS:
             entities.add(clean.lower())
             is_entity = True
@@ -454,6 +493,9 @@ def score_expansion_detailed(query: str, expansion: str) -> dict:
             hyde_score += 5
         hyde_score += max(0, 5 - word_repetition_penalty(hyde_text))
 
+    # --- Extract entities (used by both quality and entity sections) ---
+    entities = extract_named_entities(query)
+
     # --- Quality (0-20) ---
     quality_score = 5  # base relevance
     if parsed["lex"] and parsed["vec"]:
@@ -475,10 +517,18 @@ def score_expansion_detailed(query: str, expansion: str) -> dict:
         else:
             deductions.append("lex missing key terms")
 
+    # Bonus: lex uses quoted phrases for multi-word entities (+3)
+    if entities and parsed["lex"]:
+        multi_word_entities = [e for e in entities if " " in e or len(e) > 6]
+        if multi_word_entities:
+            lex_joined = " ".join(parsed["lex"])
+            if '"' in lex_joined:
+                quality_score += 3
+
     # --- Entity Preservation (-45 to +20) ---
     entity_score = 0
-    entities = extract_named_entities(query)
     if entities and parsed["lex"]:
+        # Per-line check: do lex lines contain entities?
         with_entities = sum(1 for l in parsed["lex"] if lex_preserves_entities(l, entities))
         if with_entities == len(parsed["lex"]):
             entity_score += 15
@@ -488,6 +538,14 @@ def score_expansion_detailed(query: str, expansion: str) -> dict:
             entity_score -= 30
             deductions.append(f"lex missing entities: {entities}")
 
+        # Per-entity coverage: is each entity mentioned somewhere in lex+vec?
+        all_output = " ".join(parsed["lex"] + parsed["vec"]).lower()
+        missing_entities = {e for e in entities if e not in all_output}
+        if missing_entities:
+            penalty = len(missing_entities) * 20
+            entity_score -= penalty
+            deductions.append(f"entities dropped: {missing_entities}")
+
         generic_count = sum(1 for l in parsed["lex"] if lex_is_generic(l))
         if generic_count:
             entity_score -= generic_count * 15
@@ -592,6 +650,11 @@ if __name__ == "__main__":
         ("how to use React hooks", "lex: React hooks tutorial\nlex: useEffect useState\nvec: how to use React hooks in functional components"),
         ("auth", "<think>Let me think...</think>\nlex: auth"),
         ("auth", "lex: auth\nThis is some explanation\nvec: more"),
+        # Personal entity tests (issue #247: entity stripping)
+        ("meeting with Bob about C++", 'lex: Bob "C++" meeting\nlex: Bob C++ discussion notes\nvec: meeting notes with Bob about C++ programming'),
+        ("meeting with Bob about C++", "lex: c++ meetings\nvec: programming meeting notes"),  # BAD: Bob is gone
+        # Quoted phrases bonus
+        ("python memory leak debugging", 'lex: "memory leak" python -java\nlex: tracemalloc profiler\nvec: how to find memory leaks in Python'),
         # "/only:" mode tests (slash prefix)
         ("auth /only:lex", "lex: auth setup\nlex: authentication config\nlex: login credentials"),
         ("auth /only:lex", "lex: auth setup\nvec: how to configure authentication"),  # should fail - has vec