How Ngo Duc Hoang Son (@pinanek) and I combined Tree-sitter lexical scope graphs, length-normalized BM25F + Personalized PageRank, and marginal utility density (ρ = ΔU / ΔC) to eliminate "God Object" token monopolization and achieve a 17.59× speedup over optimized Python.
Thank you for visiting! I'm Khanh (published as Khanh Quoc Tran), a Fundamental AI Researcher and Open-Source Systems Creator at the National University of Singapore (NUS). Previously, I was a Research & Development Engineer at the AISIA Research Lab advised by Assoc. Prof. Binh Thanh Nguyen, and a Teaching Assistant & Lecturer at VNUHCM – University of Information Technology advised by Dr. Kiet Van Nguyen. My research builds trustworthy, resource-efficient language models and algorithmic developer tools:
-
Trustworthy, Multimodal & Causal AI for Regulatory Oversight: architecting training-free Bayesian evidence adjudication (
TF-BEAR), cross-modal evasion benchmarks (MedReg-MM), and scalable Knowledge-as-a-Service verification engines [MM-RegCheck (ACM MM'26), VietCheckMed Engine (CIKM'26), ViFactCheck (AAAI'25 Oral), ViHOS (EACL'23 Oral)]. - Low-Resource Complex Table QA & Parameter-Efficient Architectures: developing multi-hop tabular reasoning metrics and compact hybrid neural networks for streaming social media data [Open-ViTabQA (KBS'25, Q1 IF 8.8), PhoBERT-CNN (NCA'22, Q1 IF 6.0)].
- Algorithmic Context Engineering & Developer Systems: formulating codebase context compression for LLMs as a Multiple-Choice Knapsack problem over Tree-sitter AST scope graphs and Personalized PageRank + BM25F centrality in a parallel Rust + PyO3 core — co-created with Ngo Duc Hoang Son (@pinanek) and community contributors including @tyza66 [ContextCraft (Rust + PyO3), PyPI Package].
I graduated Ranked 1st out of 40 (Valedictorian, GPA: 9.3/10.0) with an M.Sc. in Data Science from VNUHCM – University of Science, where I received the VinIF Master's Scholarship (1 of 48 selected nationwide). I am fortunate to have received the EMNLP Outstanding Reviewer Award (2024), the PACLIC 36 Best Paper Runner-up Award, the Digital Water Hackathon Champion Award (Singapore), and the VNU-HCMC President's Compliment Certificate.
Please contact me via email for collaborations!
News
home-assistant/core repository in 7.21 seconds (17.59× faster than optimized Python).
Selected Publications
For the full list of my publications: Google Scholar · Chronological View
-
N. T. Tam*, Khanh Quoc Tran*, B. T. Nguyen.
VietCheckMed: Explainable Regulatory Compliance Checking for Medical Advertisements.
AAAI Conference on Artificial Intelligence (AAAI), 2026.
Accepted (Co-first author) · Engineered for metropolitan public healthcare systems & Pending Patent.
[]
[]
Co-led the conceptualization of the retrieval-augmented generation (RAG) compliance framework, designed the LLM-based reasoning pipeline and FIDES evaluation metric, and led the full experimental analysis for high-stakes medical advertisement regulation.
@inproceedings{tam2026vietcheckmed, title={VietCheckMed: Explainable Regulatory Compliance Checking for Medical Advertisements on Vietnamese Social Media}, author={Tam, Nguyen Thanh and Tran, Khanh Quoc and Pham, Dat Thanh and Le, Truong Phu and Han, Nguyen Hoang Gia and Nguyen, Binh T}, booktitle={Proceedings of the AAAI Conference on Artificial Intelligence}, volume={40}, number={2}, pages={1069--1077}, year={2026} } -
T. Nguyen*, H.-A. Vo*, T. P. Le, K. A. Ta, Khanh Quoc Tran, D. T. M. Ngo, B.-T. T. Dang, L. H. U. Thu, L. Liao, B. T. Nguyen.
MM-RegCheck: Training-Free Causal-Aware Multimodal Reasoning for Regulatory Evasion Detection.
ACM International Conference on Multimedia (ACM MM), 2026.
Accepted (In Press, CORE A*) · Supported by NRF Singapore (AISG-NMLP-2024-002).
[]
[]
Introduces MedReg-MM (5,706 multimodal advertisements paired with 9,978 licensed facilities, Cohen's κ = 0.92) and TF-BEAR (Training-Free Bayesian Evidence Aggregation), which computes evidence-conditioned log-odds attribution (Δ) to enforce strict visual liability under cross-modal evasion (0.8985 Macro-F1 with a 9B backbone).CRediT Role: Co-led framework &
TF-BEARalgorithmic formulation, led full experimental design, ablation &FIDESanalysis, and co-led the rebuttal process while mentoring undergraduate researchers (H.-A. Vo, K. A. Ta, Bao-Thi T. D.).@inproceedings{nguyen2026mmregcheck, author = {Nguyen, Tam and Vo, Hoang-An and Le, Truong Phu and Ta, Khoa Anh and Tran, Khanh and Ngo, Duyen Thi My and Dang, Bao-Thi Trong and Thu, Le Hoang Uyen and Liao, Lizi and Nguyen, Binh}, title = {MM-RegCheck: Training-Free Causal-Aware Multimodal Reasoning for Regulatory Evasion Detection}, booktitle = {Proceedings of the 34th ACM International Conference on Multimedia (MM '26)}, year = {2026}, note = {Accepted / In Press} } -
T. Nguyen*, Khanh Quoc Tran*, A. Vo, K. Ta, T. Le, T. Le, T. Dang, D. Pham, D. Ngo, H. Nguyen, L. Liao, B. T. Nguyen.
VietCheckMed: A Scalable Retrieval-Augmented Engine for Zero-Day Regulatory Oversight.
ACM International Conference on Information and Knowledge Management (CIKM), 2026.
Accepted (In Press, CORE A) · Live RegTech Platform ($0.0004/sample inference).
[]
[Live System]
[]
Operationalizes training-free causal multimodal reasoning into a Knowledge-as-a-Service (KaaS) regulatory platform indexing 9,978 facilities with event-driven vector cache invalidation, hybrid BM25 + dense retrieval, and context caching—achieving 0.898 Macro-F1 at ~$0.0004 per sample.CRediT Role: Co-led KaaS system architecture & hybrid retrieval formulation, led full Pareto latency-cost-accuracy experimental evaluation, and co-led the rebuttal with mentored UIT & HCMUS undergraduate researchers.
@inproceedings{nguyen2026vietcheckmed_cikm, author = {Nguyen, Tam and Tran, Khanh Quoc and Vo, An and Ta, Khoa and Le, Truong and Le, Thu and Dang, Thi and Pham, Dat and Ngo, Duyen and Nguyen, Han and Liao, Lizi and Nguyen, Binh}, title = {VietCheckMed: A Scalable Retrieval-Augmented Engine for Zero-Day Regulatory Oversight}, booktitle = {Proceedings of the 35th ACM International Conference on Information and Knowledge Management (CIKM '26)}, year = {2026}, note = {Accepted / In Press} } -
T. T. Hoa, T. Q. Duy, Khanh Quoc Tran, K. V. Nguyen.
ViFactCheck: A New Benchmark Dataset and Methods for Multi-Domain News Fact-Checking in Vietnamese.
AAAI Conference on Artificial Intelligence (AAAI), 2025.
Oral Presentation · Deployed in VNUHCM-UIT production verification systems.
[]
[]
Co-led the conceptualization and construction of Vietnam's largest multi-domain fact-checking benchmark; designed SOTA baselines using Gemma and XLM-RoBERTa and led fine-grained reasoning analysis across diverse news domains.
@inproceedings{hoa2025vifactcheck, title={Vifactcheck: A new benchmark dataset and methods for multi-domain news fact-checking in vietnamese}, author={Hoa, Tran Thai and Duy, Tran Quang and Tran, Khanh Quoc and Van Nguyen, Kiet}, booktitle={Proceedings of the AAAI Conference on Artificial Intelligence}, volume={39}, number={1}, pages={308--316}, year={2025} } -
D. H. Dao, N. T. K. Huynh, Khanh Quoc Tran, K. V. Nguyen.
Open-ViTabQA: A novel benchmark for Vietnamese question answering on open domain Wikipedia table.
Knowledge-Based Systems (KBS), 2025.
(SCIE Q1, IF: 8.8) · Over 5,000+ paper views since preprint.
[]
[]
Co-designed the BIF evaluation metric capturing logical consistency and semantic nuance in multi-hop table reasoning; co-led dataset curation to increase structural complexity across open-domain Wikipedia tables.
@article{dao2025open, title={Open-ViTabQA: A novel benchmark for Vietnamese question answering on open domain wikipedia table}, author={Dao, Dung Hoang and Huynh, Ngan Thi-Kim and Khanh, Tran Quoc and Van Nguyen, Kiet}, journal={Knowledge-Based Systems}, pages={114391}, year={2025}, publisher={Elsevier} } -
P. G. Hoang, C. D. Luu, Khanh Quoc Tran, K. V. Nguyen, N. L.-T. Nguyen.
ViHOS: Hate Speech Spans Detection for Vietnamese.
Conference of the European Chapter of the Association for Computational Linguistics (EACL), 2023.
Oral Presentation · Pioneered span-level Explainable AI (XAI) for Vietnamese safety.
[]
[]
Pioneered the shift from coarse binary classification to explainable character/token span detection, enabling fine-grained, human-interpretable moderation rationales across Transformer architectures (XLM-R, PhoBERT).
@inproceedings{hoang2023vihos, title={ViHOS: Hate speech spans detection for Vietnamese}, author={Hoang, Phu Gia and Luu, Canh Duc and Tran, Khanh Quoc and Van Nguyen, Kiet and Nguyen, Ngan}, booktitle={Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics}, pages={652--669}, year={2023} } -
Khanh Quoc Tran, A. T. Nguyen, P. G. Hoang, C. D. Luu, T. H. Do, K. V. Nguyen.
Vietnamese Hate and Offensive Detection using PhoBERT-CNN and Social Media Streaming Data.
Neural Computing and Applications (NCA), 2022.
(First Author · SCIE Q1, IF: 6.0) · Awarded VNU-HCMC President's Certificate of Merit.
[]
[]
Conceptualized, designed, and implemented the parameter-efficient PhoBERT-CNN architecture outperforming pure Transformer baselines; integrated into UIT-ViSomCens with a 30% reduction in human moderation overhead.
@article{quoc2023vietnamese, title={Vietnamese hate and offensive detection using PhoBERT-CNN and social media streaming data}, author={Quoc Tran, Khanh and Trong Nguyen, An and Hoang, Phu Gia and Luu, Canh Duc and Do, Trong-Hop and Van Nguyen, Kiet}, journal={Neural Computing and Applications}, volume={35}, number={1}, pages={573--594}, year={2023}, publisher={Springer} }
Papers and research projects done by undergraduate students I have mentored, supervised, or collaborated with closely at VNUHCM-UIT & AISIA Lab (100+ students mentored, leading to 20 student-led publications at AAAI, PACLIC, and VLSP):
- T. Nguyen, H.-A. Vo, T. P. Le, K. A. Ta, Khanh Quoc Tran, et al. MM-RegCheck (ACM MM 2026) & VietCheckMed Engine (ACM CIKM 2026). Co-led algorithmic design, full experimental evaluation & rebuttals while mentoring UIT undergraduate researchers into top-tier ACM venues.
- N. T. Tam, Khanh Quoc Tran*, B. T. Nguyen. VietCheckMed: Explainable Regulatory Compliance Checking for Medical Advertisements. AAAI Conference on Artificial Intelligence (AAAI), 2026. Mentored student research team from conceptualization to AAAI acceptance.
- T. T. Hoa, T. Q. Duy, Khanh Quoc Tran, K. V. Nguyen. ViFactCheck: A New Benchmark Dataset and Methods for Multi-Domain News Fact-Checking in Vietnamese. AAAI Conference on Artificial Intelligence (AAAI), 2025. (Oral Presentation) · Student-led benchmark curation & LLM evaluation.
- D. H. Dao, N. T. K. Huynh, Khanh Quoc Tran, K. V. Nguyen. Open-ViTabQA: A novel benchmark for Vietnamese question answering on open domain Wikipedia table. Knowledge-Based Systems (SCIE Q1, IF: 8.8), 2025. Supervised undergraduate thesis & open-source Hugging Face release (5K+ Paper views).
- Student Research Groups supervised at VNUHCM-UIT (2021–2025). 17 Additional Student-Led Publications across PACLIC (including PACLIC 36 Best Paper 1st Runner-up) and VLSP Shared Tasks. Coached team UIT-VINSV to 3rd Place at the UIT Data Science Contest 2023.
Production open-source compilers and research infrastructure bridging algorithmic theory and developer workflows:
-
Khanh Quoc Tran,
Ngo Duc Hoang Son (@pinanek),
and community contributors (@tyza66).
ContextCraft: AST-Aware, Dependency-Graph-Ranked, Token-Budgeted Semantic Codebase Compressor for LLMs.
Rust + PyO3 Core & Python SDK (
contextcraft-aion PyPI), 2026. Compiles 30,018 files (home-assistant/core) in 7.21s (17.59× faster than Python). - Khanh Quoc Tran. AgentScaffold.io: Composable Stack-Fragment Registry & Multi-Target Rule Compiler for AI Coding Agents. Open-Source Developer Tooling Initiative (Project #02), 2026.
Open-Source Systems Spotlight: ContextCraft
ContextCraft (GitHub · PyPI · Astro Docs) solves the Multiple-Choice Knapsack Problem (MCKP) over 35 Tree-sitter language grammars and Personalized PageRank + BM25F graphs. With our new Rust + Rayon + PyO3 engine, it compresses a 119,813-token repository into an exact 7,991 / 8,000-token budget (14.99×) and processes home-assistant/core (30,018 files) in 7.214 seconds.
@khanhtq29vn
(Creator)
Ngo Duc Hoang Son (@pinanek)
(Co-Creator · Rust & AST Core)
@tyza66
(Contributor · #17)
Publications
(*) denotes equal contribution / co-first authorship. Full citation metrics on Google Scholar.
2026
2025
2023
2022
Open-Source Systems & Algorithmic Engineering
Beyond academic papers, I architect deterministic compilers and developer tools with strict static typing, parallel Rust execution, and mathematical guarantees.
--encoding CLI tokenizer selection flag (#17 / #5).Switch token budgets below to observe how marginal utility density (ρ = ΔU / ΔC) prevents "God Object" monopolization:
| Top Architectural File (by Personalized PageRank) | PageRank | Assigned Tier | Selected / Raw Tokens | Why this tier? |
|---|
Click any fidelity tier below to inspect how ContextCraft's Tree-sitter builder transforms source code:
import hmac
from contextcraft.ast import ByteRange, ParsedAst, Symbol
class StructuralSkeletonBuilder(SkeletonBuilder):
"""Surgically elides function bodies in reverse byte order."""
def build(self, parsed: ParsedAst) -> str:
if parsed.has_errors:
return parsed.source.decode("utf-8")
replacements = sorted(
self._replacements(parsed),
key=lambda edit: (edit[0].start_byte, -edit[0].end_byte),
)
buffer = bytearray(parsed.source)
for span, content in reversed(replacements):
buffer[span.start_byte : span.end_byte] = content
return buffer.decode("utf-8")
Evaluated on home-assistant/core (30,018 files) with GIL release and parallel Rayon workers (PR #34 by @pinanek):
| Engine | Wall Time | Peak RAM |
|---|---|---|
| Baseline Python | 1,753.21 s | 53.0 GB |
| Optimized Python | 126.91 s | 925.8 MB |
| Rust + PyO3 (Ours) | 7.214 s | 1.54 GB |
Teaching & Student Mentorship
Applied NLP for Social Good (Undergraduate Research Seminar)
Conceptualized and launched a specialized undergraduate research seminar focusing on Trustworthy AI, fact-checking, explainable hate speech detection, and ethical deployment of low-resource language models.
Machine Learning & Social Media Mining (Undergraduate & Graduate Courses)
Co-developed lecture materials, hands-on PyTorch laboratories, and programming assignments integrating contemporary findings from ACL, EMNLP, AAAI, and NeurIPS. Led technical workshops on Transformer Architectures & Parameter-Efficient Fine-Tuning (LoRA / Unsloth) for 200+ students.
Undergraduate Thesis & Research Mentorship (100+ Students Mentored)
- Supervised 10+ undergraduate research projects and mentored 100+ students, resulting in 20+ diverse research outcomes and featured publications at AAAI, PACLIC, and VLSP.
- Coached team UIT-VINSV to win 3rd Place at the UIT Data Science Contest 2023.
- Core faculty member for ASIIN International Accreditation, aligning the Data Science curriculum with European and global quality standards.
Honors, Fellowships & Academic Service
Technical Blog & Research Notes
A retrospective on our four-year research arc building verifiable, human-interpretable NLP systems for Vietnamese—from character-span hate speech detection (EACL'23 Oral) to multi-domain news verification (AAAI'25 Oral) and medical regulatory compliance (AAAI'26).
Why Codebase Context Packing is a Multiple-Choice Knapsack Problem - and How Rust + Rayon Solved 30,018 Files in 7.2 Seconds
When feeding a repository into an LLM for architectural review or debugging, existing packers (repomix, gitingest) concatenate every file verbatim in alphabetical order. On a 119,813-token repository, truncating at an 8,000-token budget discards 88% of the codebase-blinding the model to core modules that happen to start with letters later in the alphabet.
1. Mathematical Formulation & "God Object" Immunity
In ContextCraft, every file i is parsed via Tree-sitter into four monotonic AST representations l ∈ {0, 1, 2, 3} (TREE, SIGS, SKEL, FULL) with concave semantic utilities u(l) ∈ {0.0, 0.45, 0.82, 1.00}. Rather than greedily awarding FULL to the highest-PageRank file, our solver orders candidate upgrades by marginal utility density:
Because ΔTokens sits in the denominator, an oversized 2,523-token hub file like structural.py (6.9% PageRank) has a low marginal density for the jump from SKEL (389 tokens) to FULL (2,523 tokens). The solver automatically keeps structural.py at SKEL-saving 2,134 tokens so surrounding modules can retain full or skeletal fidelity.
2. Migrating the Engine to Rust + Rayon + PyO3 (PR #34)
To scale this pipeline to massive enterprise monorepos like home-assistant/core (30,018 files), Ngo Duc Hoang Son (@pinanek) re-architected the compression engine in Rust with Rayon data parallelism and PyO3 bindings (releasing Python's GIL). Wall-clock time dropped from 1,753.21 seconds in our initial prototype and 126.91 seconds in optimized Python down to 7.214 seconds (utilizing 1083.4% multi-core CPU).
From Binary Classification to Span-Level & Regulatory Explainability in Low-Resource NLP
In high-stakes domains such as content moderation, multi-domain news verification, and medical advertisement regulation, black-box binary predictions ("hateful" vs. "clean", "compliant" vs. "violating") are insufficient for human decision-makers.
Across our research sequence from PhoBERT-CNN (NCA'22) and ViHOS (EACL'23 Oral) to ViFactCheck (AAAI'25 Oral) and VietCheckMed (AAAI'26), we systematically shifted low-resource Vietnamese NLP from coarse sequence classification to fine-grained character span extraction, multi-hop tabular verification (Open-ViTabQA, KBS'25), and retrieval-augmented regulatory compliance checking.